Okay so I made an attempt at scripting the same system in GS2 using Carlito's example as my base, but I couldn't get
format to work with
player.chat. Also tried to do something like
this.chat = temp.list "message" but I couldn't get it to work either. Does anyone know why?
Eventually I want to display the people on the blacklist. I know I could do something simple like
this.chat = this.deniedList, but the output looks pretty ugly. Is there a better method of displaying the contents of the array?
PHP Code:
function onCreated() {
this.commandList = {"account1","account2"};
}
function onPlayerChats() {
if (player.account in this.commandList) {
if (player.chat.starts("/add")) {
temp.list = player.chat.tokenize()[1];
onAddPlayer(temp.list);
}
if (player.chat.starts("/remove")) {
temp.list = player.chat.tokenize()[1];
onRemovePlayer(temp.list);
}
}
}
function onAddPlayer(temp.list) {
if (temp.list in this.commandList) {
player.chat = "Cannot add admin to list";
}
else {
if (temp.list in this.deniedList) {
player.chat = "Account already on list.";
}
else {
this.deniedList.add(temp.list);
player.chat = "Account added to list.";
}
}
}
function onRemovePlayer(temp.list) {
if (temp.list in this.deniedList) {
this.deniedList.remove(temp.list);
player.chat = "Account removed from list.";
}
else {
player.chat = "Account not on list.";
}
}
function onPlayerEnters() {
if (player.account in this.deniedList) {
player.chat = "You were removed from this level.";
player.setlevel2("levelname.nw",x,y);
}
}
[EDIT]Also still need a method to remove players from the level if they're already inside.