Thread: Arrays..
View Single Post
  #4  
Old 07-16-2007, 06:15 PM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
You're mixing GS2 with GS1 up at the top there. You would use
PHP Code:
//GS1
if (created) {
  
setstring this.events,test,race,idle;
}

if (
playerchats && startswith(:select,#c)) {
  
tokenize #c;
  
if (lindexof(#t(1),this.events) == -1) {
    
setplayerprop #c,Error: Event not found!;
  
} else {
    
setplayerprop #c,Event chosen!;
  
}

PHP Code:
//GS2
function onCreated() {
  
this.events = {"test""race""idle"};
}
function 
onPlayerChats() {
  if (
player.chat.starts(":select")) {
    
temp.tokens player.chat.tokenize();
    if (
this.events.index(temp.tokens[1]) == -1) {
      
player.chat "Error: Event not found!";
    }
    else {
      
player.chat "Event chosen!";
    }
  }

__________________
Reply With Quote