Quote:
Originally Posted by fowlplay4
Bonus: If you want to send an object and it's vars to the client-side you can do it like this:
PHP Code:
function onCreated() { temp.example = new TStaticVar(); // not necessary in this example temp.example.a = "hello "; temp.example.b = "world"; temp.example.c = "!"; temp.example.b.a = " <3"; temp.data = temp.example.savevarstoarray(false); findplayer("fowlplay4").triggerclient(this.name, "data", temp.data); }
//#CLIENTSIDE
function onActionClientside() { if (params[0] == "data") { temp.data = params[1]; temp.example = new TStaticVar(); temp.example.loadvarsfromarray(temp.data); echo(temp.example.a @ temp.example.b @ temp.example.c @ temp.example.b.a); } }
|
Curiosity, why do we need
savevarstoarray(false)? And no need for
TStaticVar(); except after clientside triggered..? Interesting.