Thread: emoticons event
View Single Post
  #5  
Old 06-02-2009, 11:42 PM
zokemon zokemon is offline
That one guy...
zokemon's Avatar
Join Date: Mar 2001
Location: Sonoma County, California
Posts: 2,925
zokemon is a jewel in the roughzokemon is a jewel in the rough
Send a message via ICQ to zokemon Send a message via AIM to zokemon Send a message via MSN to zokemon Send a message via Yahoo to zokemon
Quote:
Originally Posted by Frankie View Post
this is what I came up with so far but it doesn't want to work.

PHP Code:
stuff 
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.this.list.accounts.index(player.account);
  if (
== -1) {
    
this.list.accounts.add(player.account);
    
this.list.emoticons.add(params[0]);
  }
  else 
this.list.emoticons.replace(iparams[0]);

Then using your scheduleevent serverside: once the time has run out, do something like:

PHP Code:
for (temp.players) {
  
temp.this.list.accounts.index(p.account);
  if (
== -|| this.list.emoticons[i] != currentemoticonkick();

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.
__________________
Do it with a DON!
Reply With Quote