PDA

View Full Version : Clearing ALL clientr.vars


sssssssssss
02-08-2014, 03:01 AM
Is there a way to clear all clientr.vars? Without knowing all the clientr.vars set?

If there isn't some sort of "built in" way, how would I go about doing this in script? I don't even know where to start to grab random var names.

I need to wipe characters clean...

Blah64
02-08-2014, 06:50 AM
serverside do something like:

temp.clientrvars = findplayer(player.acccount).clientr.getdynamicvarn ames();
for (temp.curvar :temp.clientrvars)
findplayer(player.account).clientr.(@temp.curvar) = null;

xAndrewx
02-08-2014, 07:57 AM
temp.pl = findplayer("xAndrewx");
for (temp.var: temp.pl.getstringkeys("clientr."))
temp.pl.clientr.(@ temp.var) = null;

Is an alternative

sssssssssss
02-08-2014, 01:29 PM
serverside do something like:

temp.clientrvars = findplayer(player.acccount).clientr.getdynamicvarn ames();
for (temp.curvar :temp.clientrvars)
findplayer(player.account).clientr.(@temp.curvar) = null;

This didn't remove any of them. temp.clientrvars is echoing "0";


temp.pl = findplayer("xAndrewx");
for (temp.var: temp.pl.getstringkeys("clientr."))
temp.pl.clientr.(@ temp.var) = null;

Is an alternative

This threw these errors:
Script: Function sssssssssss.getstringkeys not found at line 185 in script of -System/CharCreate
Script: Function sssssssssss.getstringkeys not found at line 189 in script of -System/CharCreate


:/

Jakov_the_Jakovasaur
02-08-2014, 02:46 PM
getstringkeys() is not a player function

you can however add it into a class which is joined to the player and it will accomplish the same thing -


/*
you probably want to add some callstack checks here to ensure that only permitted scripts are calling this function, or otherwise only join this class to the player before you want to reset them
*/
public function resetClientrVars()
for(temp.key : getstringkeys("this.clientr."))
this.clientr.(@ temp.key) = "";

100Zero100
02-08-2014, 03:28 PM
Are you attempting to do Blah64's suggestion in an onCreated on the serverside?

He put findplayer(player.account), which is redundant for "player." Either way, if you tried that in the onCreated, where there is no player scope, that would explain why it wouldn't work.

Doing:


function onCreated() {
temp.t = findPlayer("Restraint").clientr.getDynamicVarNames();
echo(t.size());
}

in a serversided script, I got the echo "90" -- seems right to me.

sssssssssss
02-08-2014, 06:56 PM
Ohh goodness.....
I had an extra "c" in player.account....

Blah's way works fine yes.