|
Incubator
|
 |
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
|
|
Do clientside, just make it so when you kill a baddy it dies on other player's clients too. Its not hard.
Quote:
|
Originally Posted by DustyPorViva
but since you can only send data to the clientside through attr's...
|
When an npc is created on clientside it would have an ID variable which you can use to locate it from any client. Thats how you go from serverside to clientside.
PHP Code:
// Script in the NPC public function sendserverkill(omit, leveln) { for (temp.i: allplayers) { if (i.account == omit || i.level.name != leveln) continue; with (i) System.clientfunction2(null, "npcfunction", this.id, "onServerKill"); } } //#CLIENTSIDE function onServerKill() { // When the kill message is received from server. } function sendserverkill() { System.serverfunction2(null, "npcfunction", this.level, this.id, "sendserverkill", player.account, this.level); }
It is using this class:
PHP Code:
// Serverside to Clientside Function public function clientfunction(fobj, fname, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) { temp.out = 0;
triggerclient("gui", this.name, "clientfunction", fobj, fname, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); waitfor(this, "ClientFunctionEnd", 5); temp.out = thiso.cfreturn; thiso.cfreturn = null; return temp.out; } public function clientfunction2(fobj, fname, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) { triggerclient("gui", this.name, "clientfunction2", fobj, fname, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); } public function npcfunction(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) { temp.obj = findlevel(p0); for (temp.i: obj.npcs) { if (i.id == p1) { i.(@ p2)(p3, p4, p5, p6, p7, p8, p9); break; } } } function onActionServerSide() { if (params[0] == "end") { thiso.cfreturn = params[1]; trigger("ClientFunctionEnd", null); } else if (params[0] == "serverfunction") { if (params[1] != null) triggerclient("gui", this.name, "end", makevar(params[1] @ "." @ params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12])); else triggerclient("gui", this.name, "end", makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12])); } else if (params[0] == "serverfunction2") { if (params[1] != null) makevar(params[1] @ "." @ params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]); else makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]); } } //#CLIENTSIDE function onActionClientSide() { if (params[0] == "end") { thiso.sfreturn = params[1]; trigger("ServerFunctionEnd", null); } else if (params[0] == "clientfunction") { if (params[1] != null) triggerserver("gui", this.name, "end", makevar(params[1] @ "." @ params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12])); else triggerserver("gui", this.name, "end", makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12])); } else if (params[0] == "clientfunction2") { if (params[1] != null) makevar(params[1] @ "." @ params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]); else makevar(params[2])(params[3], params[4], params[5], params[6], params[7], params[8], params[9], params[10], params[11], params[12]); } } public function npcfunction(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) { findnpcbyid(p0).(@ p1)(p2, p3, p4, p5, p6, p7, p8, p9); } public function serverfunction(fobj, fname, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) { temp.out = 0; triggerserver("gui", this.name, "serverfunction", fobj, fname, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); waitfor(this, "ServerFunctionEnd", 5); out = thiso.sfreturn; thiso.sfreturn = null; return out; } public function serverfunction2(fobj, fname, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9) { triggerserver("gui", this.name, "serverfunction2", fobj, fname, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
For some reason, clientside level objects don't have anything in their npcs variable, only on serverside.
You could also make your own system for keeping track of baddy objects by ID on clientside and serverside. |
Last edited by Inverness; 01-18-2008 at 09:12 AM..
|