View Single Post
  #5  
Old 01-28-2012, 08:42 AM
scriptless scriptless is offline
Banned
Join Date: Dec 2008
Location: N-Pulse
Posts: 1,412
scriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to beholdscriptless is a splendid one to behold
Quote:
Originally Posted by fowlplay4 View Post
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."hello ";
  
temp.example."world";
  
temp.example."!";
  
temp.example.b." <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.temp.example.temp.example.temp.example.b.a);
  }

Curiosity, why do we need savevarstoarray(false)? And no need for TStaticVar(); except after clientside triggered..? Interesting.
Reply With Quote