PDA

View Full Version : retrieving and updating stuff in serveroptions


Cherrykao
09-28-2007, 05:10 AM
I'm just wondering if there was a possible way of retrieving (and possibly updating) a list of all player accounts in the "staff=" and staffguilds "staffguilds=" in the serveroptions from a script - either wNPC or just a regular script on the serverside.


And since I'm on the topic of serveroptions, howcome in the "profilevars=", you can't use arrays to display stuff like doing:

Health=playerstats[1],MP=playerstats[2]

I think it's wasteful to create single player flags for each type of profile variables, when you can just create one player flag as an array and use the indexes to display the type of variables to be shown in the player's profile.

zokemon
09-28-2007, 05:37 AM
profilevars looks at variables as strings, that's why. It would have to tokenize the string to do it like an array.

Cherrykao
09-28-2007, 05:41 AM
profilevars looks at variables as strings, that's why. It would have to tokenize the string to do it like an array.

that makes sense now, but what about updating stuff and pulling information from serveroptions?

zokemon
09-28-2007, 07:48 PM
I wish you could... Seems like this is planned as a possible update for the future though. I would love to be able to have stafftools auto add based on rc access. You could then just give rights to the tool based on folder rights.

Skyld
09-28-2007, 07:55 PM
I wish you could... Seems like this is planned as a possible update for the future though. I would love to be able to have stafftools auto add based on rc access. You could then just give rights to the tool based on folder rights.
There is already the player.hasright() function for checking folder rights, and player.hasrightflag(str rightname) function for checking if they have normal rights (where rightname is from the following list: warptoxy, warptoplayer, warpplayers, updatelevel, disconnectplayers, viewattributes, setownattributes, resetattributes, adminmessage, changerights, banplayers, changecomments, changestaffaccounts, setserverflags, changeoptions, changefolderconfig, changefolderrights, NPC-Control).

zokemon
09-28-2007, 08:12 PM
There is already the player.hasright() function for checking folder rights, and player.hasrightflag(str rightname) function for checking if they have normal rights (where rightname is from the following list: warptoxy, warptoplayer, warpplayers, updatelevel, disconnectplayers, viewattributes, setownattributes, resetattributes, adminmessage, changerights, banplayers, changecomments, changestaffaccounts, setserverflags, changeoptions, changefolderconfig, changefolderrights, NPC-Control).

Yeah I know that, that's why I said that ;)

napo_p2p
09-28-2007, 09:56 PM
There used to be a way to do a: load/savelines("serveroptions.txt");

Obviously, that posed a credible security threat. It hasn't been allowed since the NPC Server rights have been added (server does not allow NPC Server to have rights to serveroptions.txt).

If you want to check for if a person is staff, an easy thing to do is just make sure every staff member has warptoxy and just check for that right (AKA: What Skyld said).

Inverness
09-28-2007, 10:21 PM
serveroptions.<varname>

staffarray = serveroptions.staff.tokenize(",");


function onActionPlayerOnline() {
if ((player.account in serveroptions.staff.tokenize(",")) || (player.account in serveroptions.norcstaff.tokenize(","))) {
clientr.staff = true;
}
}

serveroptions. is accessible serverside only, don't like that fact too much.

coreys
09-29-2007, 12:05 AM
serveroptions. is accessible serverside only, don't like that fact too much.
Yeah, since I believe it's read-only, that doesn't make much sense. It's not like it would be some sort of security flaw to have it readable clientside.

zokemon
09-29-2007, 04:36 AM
serveroptions.<varname>

staffarray = serveroptions.staff.tokenize(",");


function onActionPlayerOnline() {
if ((player.account in serveroptions.staff.tokenize(",")) || (player.account in serveroptions.norcstaff.tokenize(","))) {
clientr.staff = true;
}
}

serveroptions. is accessible serverside only, don't like that fact too much.

Ahh, didn't notice that was added. :cool: