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!";
}
}
}