Basic client -> server interaction for a level NPC.
PHP Code:
function onCreated() {
// Gives the triggeraction something to hit on the server-side
this.setshape(1, 32, 32);
}
function onActionExample(npcid) {
if (params[0] == npcid) {
this.chat = "Trigger received from" SPC player.account @ "!";
}
}
//#CLIENTSIDE
function onPlayerChats() {
if (player.chat == "example") triggerExample();
}
function triggerExample() {
triggeraction(this.x + 1, this.y + 1, "Example", this.id);
}
I've never had a reason to send a message back to the level NPC specifically though, your code can probably re-factored or sent directly to the Weapon NPC via triggerclient that needs the information from the server.