Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting > Old Scripting Engine (GS1)
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-31-2017, 10:13 AM
maximus_asinus maximus_asinus is offline
RIP DarkCloud_PK
Join Date: Oct 2001
Location: Canada
Posts: 3,746
maximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond reputemaximus_asinus has a reputation beyond repute
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.
__________________
Save Classic!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 06:25 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.