Well you'll need to use triggerserver, and triggerclient to send data back and forth to the client. Then on the server-side you can have a DB NPC called Family (using it for the sake of the example), or so on.
In your Family's DB script you can write some accessors and mutators, here's some very generic ones.
PHP Code:
// Notice that the functions are declared public
// that is so other scripts can call them directly.
public function getValue(dbvar) {
return this.(@dbvar);
}
public function setValue(dbvar, value) {
this.(@dbvar) = value;
}
Then in the server-side portion of your Family's weapon script, you can set and access them using it like so:
PHP Code:
function onCreated() {
this.db = findnpc("Family");
}
function onActionServerSide() {
if (params[0] == "exampleSituation") {
this.db.setValue("kids", 3);
}
else if (params[0] == "getKidsData") {
temp.val = this.db.getValue("kids");
player.triggerclient(this.name, "kidsdata", temp.val);
}
}
//#CLIENTSIDE
function onCreated() {
// Due to the nature of this example, I am using two
// triggerservers in the same call. NEVER do this in actual code.
triggerserver("gui", this.name, "exampleSituation");
triggerserver("gui", this.name, "getKidsData");
}
function onActionClientSide() {
if (params[0] == "kidsdata") {
player.chat = "I have " @ params[1] @ " kids!";
}
}