Booleans help!
#1

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

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;
    }
Reply
#3

Still doesn't work
Reply
#4

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 ?!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)