Quote:
Originally Posted by Frankie
this is what I came up with so far but it doesn't want to work.
I also found out that array.index doesn't work when you have an array inside of an array -.-
|
Like I said, you should use a triggeraction and should be setting a this. variable for the emoticon variable, not using a client. variable. client. variables only really should be used when you need to save something to the player, not for something temporary (doesn't matter after you logoff) like this. Same thing with the serverr variable. While nice, it's kind of a waste of memory as the npc's scope shouldn't have to leave the level it self so there's no reason it can't use variables scoped to it self (this.).
If you are using the serverr variable to say tell the server the event is going on, then maybe that's a viable solution but personally, I would just trigger() or call a function of some core events WNPC for setting such a thing.
The real bane I find with classic servers (where I feel they fall short) is that scripters attach a million and a half client. and clientr. variables to the player which can really slow down the loading time of the server (3/4 of the variables aren't even needed to be saved). server. and serverr. aren't so bad but I still tend to avoid them unless I have to use them. There's almost always a better method
Anyways back to your script, the triggeractions will tell the serverside script when a player has a new emoticon. You could do like:
PHP Code:
function onActionGotEmoticon() {
temp.i = this.list.accounts.index(player.account);
if (i == -1) {
this.list.accounts.add(player.account);
this.list.emoticons.add(params[0]);
}
else this.list.emoticons.replace(i, params[0]);
}
Then using your scheduleevent serverside: once the time has run out, do something like:
PHP Code:
for (temp.p : players) {
temp.i = this.list.accounts.index(p.account);
if (i == -1 || this.list.emoticons[i] != currentemoticon) kick();
}
If currentemoticon never is NULL or 0 when you get to this point, you can just remove the i == -1 part since this.list.emoticons[-1] will give you those results.
That help?
Also, how does array.index not work in an array? I've never found it not to work unless I'm using it wrong.