SetPvar -
Neil. - 20.01.2013
fixed
Re: SetPvar -
Neil. - 20.01.2013
Bump.
Help please?
Re: SetPvar -
LarzI - 20.01.2013
First of all, you should read this:
http://forum.sa-mp.com/showthread.ph...ighlight=speed
Second of all: Is this your own script? In that case I presume someone gave you code without explaining.
If you're already storing admin levels in a 2D-array (PlayerInfo), then you can simply replace the GetPVarInt line with "PlayerInfo[ playerid ][ Admin ]":
pawn Код:
if(!IsPlayerAdmin(playerid) && PlayerInfo[ playerid ][ Admin ] <= 0)
Re: SetPvar -
Threshold - 20.01.2013
pawn Код:
SetPVarInt(playerid, "Admin", PlayerInfo[playerid][Admin]);
is basically like:
pawn Код:
INI_WriteInt(file, "Admin", PlayerInfo[playerid][Admin]);
or:
pawn Код:
myvariable = PlayerInfo[playerid][Admin];
So when loading, or when checking if they are an admin in a separate filterscript, you would do this:
pawn Код:
CMD:mycommand(playerid, params[])
{
if(GetPVarInt(playerid, "Admin") < 2) return SendClientMessage(playerid, 0xFF0000FF, "You need to be level 2 admin.");
//code continues...
return 1;
}
You place GetPVarInt, where ever you want to CHECK the admin level, and SetPVarInt whenever you want to SAVE the admin level, like when logging in, or when using a command like /setlevel that will change the players admin level.
EDIT: Above post explains in detail these functions really, but if you're wanting to use your admin level in a filterscript of some sort, you can use PVars
Re: SetPvar -
Neil. - 20.01.2013
Quote:
Originally Posted by LarzI
First of all, you should read this: http://forum.sa-mp.com/showthread.ph...ighlight=speed
Second of all: Is this your own script? In that case I presume someone gave you code without explaining.
If you're already storing admin levels in a 2D-array (PlayerInfo), then you can simply replace the GetPVarInt line with "PlayerInfo[ playerid ][ Admin ]":
pawn Код:
if(!IsPlayerAdmin(playerid) && PlayerInfo[ playerid ][ Admin ] <= 0)
|
I use an admin system of which I downloaded
I downloaded an fs as well which is called a temporary ban. I want to set the pVars for them to cross communicate (fs and the gamemode)
So that the /temporaryban command will work on my admin levels as well, instead of (IsPlayerAdmin)
Re: SetPvar -
LarzI - 20.01.2013
Quote:
Originally Posted by Ken97
I use an admin system of which I downloaded
I downloaded an fs as well which is called a temporary ban. I want to set the pVars for them to cross communicate (fs and the gamemode)
So that the /temporaryban command will work on my admin levels as well, instead of (IsPlayerAdmin)
|
Ah, in that case PVars are usable.
You want to set the PVars after reading the player's files. When a player's file is read, you probably store the adminlevel into the array PlayerInfo, so you simply have to set the PVars after that, so that it holds the correct information.