Graal Forums  

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

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 03-30-2007, 01:46 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Some gs2 help...

Ok, I am making a simple level ban system.
Now, I can add the string to the clientr.levelbans, but how do I remove a certain var from it?
So, when a staff says /ban oo_jazz_oo event_something.nw then that is added to clientr.levelbans.
When a staff says /unban oo_jazz_oo event_something.nw, how do I get that var from the clientr.levelbans and delete it?
Reply With Quote
  #2  
Old 03-30-2007, 01:47 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
PHP Code:
clientr.levelbans.remove(tokens[1]); //Assuming tokens[1] == account of player 
Reply With Quote
  #3  
Old 03-30-2007, 01:50 AM
oo_jazz_oo oo_jazz_oo is offline
Jazz teh Awesome
oo_jazz_oo's Avatar
Join Date: Jul 2006
Location: California
Posts: 596
oo_jazz_oo is a jewel in the roughoo_jazz_oo is a jewel in the rough
Send a message via MSN to oo_jazz_oo
Wont that remove the first var in the list of clientr.levelbans?
What if event_something.nw is the 4th in line? Or 20th?
I need the script to find that var in the line of vars and delete it...
Reply With Quote
  #4  
Old 03-30-2007, 01:55 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by oo_jazz_oo View Post
Wont that remove the first var in the list of clientr.levelbans?
What if event_something.nw is the 4th in line? Or 20th?
I need the script to find that var in the line of vars and delete it...

No it doesnt remove the first "var" in the array.


It removes whatever you tell it to in the params (I.E remove(paramshere) ).
Reply With Quote
  #5  
Old 03-30-2007, 01:57 AM
cbk1994 cbk1994 is offline
the fake one
cbk1994's Avatar
Join Date: Mar 2003
Location: San Francisco
Posts: 10,718
cbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond reputecbk1994 has a reputation beyond repute
Send a message via AIM to cbk1994
remove() ... takes the index, doesn't it? Do something like this ...
PHP Code:
clientr.levelbans.deleteclientr.levelbans.index( var ) ); 
That for sure will work, assuming you replace var with the thing you want to delete.
__________________
Reply With Quote
  #6  
Old 03-30-2007, 02:01 AM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
I still don't know what you guys don't understand about what I said x-x

remove works just fine for this
Reply With Quote
  #7  
Old 03-30-2007, 02:53 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Where "tokens[1]" is, is where your parameter will go, if you tokenize the player chat before having to remove the player.

I.E.

PHP Code:

function onPlayerChats()
{

if (
player.chat.starts"/remove" )) 
{
tokens player.chat.tokenize();
clientr.levelbans.remove(tokens[1]); //Assume this is the account of player
}

__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #8  
Old 03-30-2007, 03:02 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
PHP Code:
clientr.levelbans.remove("event_something.nw"); 
In your case right for now, but if you have a tokens array set then use that
Reply With Quote
  #9  
Old 03-30-2007, 03:41 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Rapidwolve View Post
PHP Code:
clientr.levelbans.remove("event_something.nw"); 
In your case right for now, but if you have a tokens array set then use that
No, he's trying to remove people using "/remove accountnamehere level" or "/delete accountnamehere llevel"

In which case, what I posted should work for the most part.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #10  
Old 03-30-2007, 05:08 AM
Rapidwolve Rapidwolve is offline
Registered User
Join Date: Jul 2006
Posts: 1,241
Rapidwolve is an unknown quantity at this point
Oh, now that changes things up. Why is he using a clientr prefix o_o
Reply With Quote
  #11  
Old 03-30-2007, 05:38 AM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Quote:
Originally Posted by Rapidwolve View Post
Oh, now that changes things up. Why is he using a clientr prefix o_o
I was also curious as to this, you could use a DB or server string or something. Clientr is for players bro. :P
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #12  
Old 03-30-2007, 04:27 PM
Gambet Gambet is offline
Registered User
Join Date: Oct 2003
Posts: 2,712
Gambet is on a distinguished road
Quote:
Originally Posted by killerogue View Post
In which case, what I posted should work for the most part.


You wrote the same thing I did -_-
Reply With Quote
  #13  
Old 03-30-2007, 04:37 PM
xXziroXx xXziroXx is offline
Malorian
xXziroXx's Avatar
Join Date: May 2004
Posts: 5,289
xXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant futurexXziroXx has a brilliant future
Directly from the wiki for you doubters.

PHP Code:
obj.delete(index)
obj.remove(obj2
__________________
Follow my work on social media post-Graal:Updated august 2025.
Reply With Quote
  #14  
Old 03-30-2007, 09:12 PM
killerogue killerogue is offline
Registered Omega
killerogue's Avatar
Join Date: Apr 2006
Location: United States
Posts: 1,920
killerogue is on a distinguished road
Send a message via AIM to killerogue Send a message via MSN to killerogue
Ah, delete then.
__________________


REMEMBER, IF YOU REP ME, LEAVE A NAME!

Quote:
Originally Posted by haunter View Post
Graal admins don't die. They go to hell and regroup.
Quote:
Originally Posted by Inverness View Post
Without scripters, your graphics and levels wouldn't do anything but sit there and look pretty.
Reply With Quote
  #15  
Old 03-30-2007, 09:15 PM
godofwarares godofwarares is offline
Webmaster
godofwarares's Avatar
Join Date: Dec 2006
Location: Florida
Posts: 552
godofwarares is on a distinguished road
Send a message via ICQ to godofwarares Send a message via AIM to godofwarares Send a message via MSN to godofwarares Send a message via Yahoo to godofwarares
Simply done:

PHP Code:
var = "godofwarares"// An example. Var should equal your account.
clientr.levelbans.remove(clientr.levelbans.index(var)); 
__________________
What signature? I see no signature?

Last edited by godofwarares; 03-30-2007 at 10:30 PM.. Reason: Whoops.
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 08:42 AM.


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