Graal Forums

Graal Forums (https://forums.graalonline.com/forums/index.php)
-   NPC Scripting (https://forums.graalonline.com/forums/forumdisplay.php?f=8)
-   -   Access list (https://forums.graalonline.com/forums/showthread.php?t=30614)

aesquivel 06-02-2002 04:44 AM

Access list
 
I need some help with an npc that lets me set who can have access to a room. like i cna do add "aesquivel" and it will let the account aesquievl in if you can help me im me on aim : Hax0r8669

thanx

BBflat 06-02-2002 05:39 AM

Re: Access list
 
Quote:

Originally posted by aesquivel
I need some help with an npc that lets me set who can have access to a room. like i cna do add "aesquivel" and it will let the account aesquievl in if you can help me im me on aim : Hax0r8669

thanx

Okay, when a player enters, tokenize all the accounts, then go through a for loop, seeing if the player's account is equal to any of the tokens. If the account matches one, set a variable. If the variable has not changed at the end, warp the player out.

aesquivel 06-02-2002 05:43 AM

Re: Re: Access list
 
Quote:

Originally posted by BBflat

Okay, when a player enters, tokenize all the accounts, then go through a for loop, seeing if the player's account is equal to any of the tokens. If the account matches one, set a variable. If the variable has not changed at the end, warp the player out.

so...


NPC Code:

if (playerenters) {
tokenize #a;
}
for (#a) {
}



okay im stuck now... help plz??

Falcor 06-02-2002 05:58 AM

thanks to the new string arrays. tokinization is not neccisary.. just do

if(lindex(#a,list) != -1)

-1 being the value it returns if your account isn't in the array.

aesquivel 06-02-2002 06:01 AM

how do i add ppl to the list??

Python523 06-02-2002 06:09 AM

setstring this.stringname,account1,account2,account3,ect;
the list is the string name, in this case this.stringname

Falcor 06-02-2002 06:13 AM

if your list is "this.stringname" then you would substitute "list" with "this.stringname"
be careful when using string array. lists don't need #s() but strings do. :)

aesquivel 06-02-2002 06:14 AM

okay now im kinda even more confused well sorta

NPC Code:

if (playerenters) {
if(lindex(#a,list) != -1) {
setlevel2 onlinestartlocal.graal,30,30;
}
}
if (playerchats) {
if (startswith(Add,??) {
setstring this.stringname,account1,account2,account3,ect;
}
}


coudl some one help me out with what i have so far?

Saga2001 06-02-2002 06:35 AM

its not lindex, its lindexof( str, list)...

;)

aesquivel 06-02-2002 06:55 AM

Could some one fix this plz
NPC Code:

if (playerenters) {
if(lindexof(#a,list) != -1) {
setlevel2 onlinestartlocal.graal,30,30;
}
}
if (playerchats) {
if (startswith(Add,??) {
setstring this.stringname,account1,account2,account3,ect;
}
}


Falcor 06-02-2002 07:27 AM

Quote:

Originally posted by aesquivel
Could some one fix this plz
NPC Code:

if (playerenters) {
if(lindexof(#a,list) != -1) {
setlevel2 onlinestartlocal.graal,30,30;
}
}
if (playerchats) {
if (startswith(Add,??) {
setstring this.stringname,account1,account2,account3,ect;
}
}


I will not hand you the solution on a silver platter but here is your problems:

1.
NPC Code:

if(lindexof(#a,list) != -1) {



and list is your list? I think not. You need to specify your list as this.stringname
please don't take things THIS literally. Copy-paste doesn't work when we are just explaining the commands, not giving you a script. Our examples are suppliments to the informations in commands.rtf. Please get scripting background before asking advanced questions.

2.
NPC Code:

if (startswith(Add,??) {



Hate to break it to you but "??" will never start with "Add", not even if you think happy thoughts and get pixie dust.

3.
NPC Code:

setstring this.stringname,account1,account2,account3,ect;



again, copy paste isn't what we want you to do. Figure out the commands. we are litterally saying

setstring THE_STRING_NAME_YOU_WANT_PLEASE_PUT_HERE,ACCOUNT #1,ETC.

you must interperate that as "Oh. maybe i should substitute this literal things with acual code... so
setstring this.accounts,aesquivel,Falcor,Stefan,Man_from_mar s;
or whatever the accounts you want to be in the string.

aesquivel 06-02-2002 07:37 AM

i know that i was jus puting it there so that i could figure out the problem that i had... and the ?? was for i have no freakin clue what goes next!


All times are GMT +2. The time now is 12:38 PM.

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