Booleans help! - 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)
+--- Thread: Booleans help! (
/showthread.php?tid=563673)
Booleans help! -
HighHP - 16.02.2015
so I just started using Booleans, and this doesn't work and hoping someone could help me
Код:
if(strcmp(cmd, "/God", true) == 0)
{
if (PlayerStats[playerid][pAdmin] >= 2)
{
new bool:god;
if(god == true)
{
SetPlayerHealth(playerid,999);
}
if(god == false)
{
SetPlayerHealth(playerid,100);
}
}
return 1;
}
Re: Booleans help! -
$$inSane - 16.02.2015
pawn Код:
new bool:god[MAX_PLAYERS];
public OnPlyerConnect(playerid)
{
god[playerid] = false;
return 1;
}
pawn Код:
if(strcmp(cmd, "/God", true) == 0)
{
if (PlayerStats[playerid][pAdmin] >= 2)
{
if(! god[playerid])
{
god[playerid] = true, SetPlayerHealth(playerid,999);
}
else
{
god[playerid] = false, SetPlayerHealth(playerid,100);
}
}
return 1;
}
Re: Booleans help! -
HighHP - 22.02.2015
Still doesn't work
Re: Booleans help! -
Stoyanov - 22.02.2015
On the top of the script:
Код:
new bool:god[MAX_PLAYERS];
Under OnPlayerConnect:
Код:
public OnPlyerConnect(playerid)
{
god[playerid] = 0;
return 1;
}
Код:
if(strcmp(cmd, "/God", true) == 0)
{
if (PlayerStats[playerid][pAdmin] >= 2)
{
if(god[playerid] == 0)
{
god[playerid] = 1;
SetPlayerHealth(playerid,999);
}
else
{
god[playerid] = 0;
SetPlayerHealth(playerid,100);
}
}
return 1;
}
This ?!