Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   New Scripting Engine (GS2) (https://forums.graalonline.com/forums/forumdisplay.php?f=153)
-   -   Some gs2 help... (https://forums.graalonline.com/forums/showthread.php?t=73160)

oo_jazz_oo 03-30-2007 01:46 AM

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?

Gambet 03-30-2007 01:47 AM

PHP Code:

clientr.levelbans.remove(tokens[1]); //Assuming tokens[1] == account of player 


oo_jazz_oo 03-30-2007 01:50 AM

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...

Gambet 03-30-2007 01:55 AM

Quote:

Originally Posted by oo_jazz_oo (Post 1294424)
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) ).

cbk1994 03-30-2007 01:57 AM

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.

Gambet 03-30-2007 02:01 AM

I still don't know what you guys don't understand about what I said x-x

remove works just fine for this

killerogue 03-30-2007 02:53 AM

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
}



Rapidwolve 03-30-2007 03:02 AM

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

killerogue 03-30-2007 03:41 AM

Quote:

Originally Posted by Rapidwolve (Post 1294450)
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.

Rapidwolve 03-30-2007 05:08 AM

Oh, now that changes things up. Why is he using a clientr prefix o_o

killerogue 03-30-2007 05:38 AM

Quote:

Originally Posted by Rapidwolve (Post 1294489)
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

Gambet 03-30-2007 04:27 PM

Quote:

Originally Posted by killerogue (Post 1294459)
In which case, what I posted should work for the most part.



You wrote the same thing I did -_-

xXziroXx 03-30-2007 04:37 PM

Directly from the wiki for you doubters.

PHP Code:

obj.delete(index)
obj.remove(obj2


killerogue 03-30-2007 09:12 PM

Ah, delete then.

godofwarares 03-30-2007 09:15 PM

Simply done:

PHP Code:

var = "godofwarares"// An example. Var should equal your account.
clientr.levelbans.remove(clientr.levelbans.index(var)); 



All times are GMT +2. The time now is 07:20 AM.

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