Admin color - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Admin color (
/showthread.php?tid=209002)
Admin color -
xir - 09.01.2011
i have some problems with my admincolor, it gets the admincolor and all ingame, but i can get killed, if i slap my self etc... and i cant figure it out why...
here is the code
pawn Код:
dcmd_admincolor(playerid, params[])
{
if(!PLVL[playerid]) return 0;
if(PlayerInfo[playerid][pAdminLevel] >=1)
{
if(sscanf(params, "d", AdminColor)) return SendClientMessage(playerid, Yellow, "Usage: /admincolor 1/0");
if(strcmp(params, "1", true)==0)
{
SetPlayerHealth(playerid, 1000000000.0);
AdminColor1[playerid] = 1;
SetPlayerColor(playerid, AdminColor);
}
else if(strcmp(params, "0", true)==0)
{
if(PlayerInfo[playerid][pAdminLevel] >=1)
AdminColor1[playerid] = 0;
SetPlayerColor(playerid, Blue);
}
} else if(PlayerInfo[playerid][pAdminLevel] == 0) return 0;
return 1;
Re: Admin color -
TheYoungCapone - 09.01.2011
Then don't slap yourself I don't know whats wrong.
Re: Admin color -
xir - 09.01.2011
It's also when I get killed, then theres no point in having that cmd, and i need i
Re: Admin color -
xir - 10.01.2011
bump
Re: Admin color -
[SU]Balli - 10.01.2011
SetPVarInt
And get it at OnPlayerSpawn?
Re: Admin color -
xir - 10.01.2011
show me example?
Re: Admin color -
MadeMan - 10.01.2011
You can't figure out why you get killed?
Re: Admin color -
xir - 10.01.2011
No :O
Re: Admin color -
Kwarde - 10.01.2011
Try this:
GetPlayerHealth(playerid, 999999999);
And also, use SetPVarInt to set "AdminColor" to 1, and if you wanna /slap and "AdminColor" == 1, you can't slap.
Example:
Turning AdminColor via SetPVarInt on:
SetPVarInt(playerid, "AdminColor", 1);
To turn it off, set 1 to 0.
Check if it's on and prevent slapping or something
if(GetPVarInt(playerid, "AdminColor") == 1) return 0;
Kind Regards,
Kevin
Re: Admin color -
alpha500delta - 10.01.2011
Or you use sccanf then pAdminLevel
pawn Код:
new str[128], id;
if(sscanf(params, "us", id,str)) return SendClientMessage(playerid, COLOR, "Usage: /slap <Playerid> <Reason>");
if(PlayerInfo[id][pAdminLevel] > 1337) return SendClientMessage(playerid, COLOR, "You cannot slap this admin!");
else
{
//Code here
}
return 1;