Admin color
#1

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;
Reply
#2

Then don't slap yourself I don't know whats wrong.
Reply
#3

It's also when I get killed, then theres no point in having that cmd, and i need i
Reply
#4

bump
Reply
#5

SetPVarInt

And get it at OnPlayerSpawn?
Reply
#6

show me example?
Reply
#7

You can't figure out why you get killed?
Reply
#8

No :O
Reply
#9

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
Reply
#10

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;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)