24.02.2013, 10:08
Not bad, but just pointing out somethings -
It should be -
Also, you should show an example of how to use return true; and return false;
and a little more further explain HOW a normal variable differs from a boolean, what's the advantage/disadvantage etc.
It should be -
pawn Код:
new bool:isplayerongodmode[MAX_PLAYERS] = false;
CMD:god(playerid)
{
if(isplayerongodmode[playerid] == false) //Checking if the 'state' of the player is NOT GOD MODE.
{
SetPlayerHealth(playerid, 999); //Setting the player's health to infinity.
isplayerongodmode[playerid] = true; //Setting the player's mode to 'ON GOD MODE'.
}
if(isplayerongodmode == true) //Checking if the 'state' of the player is GOD MODE.
{
SendClientMessage(... "You are already on god mode!"); //Sending him the error message.
}
return 1;
}
pawn Код:
stock bool:IsAdminConnected()
{
for(new x= 0; x < MAX _PLAYERS; x++)
{
if(IsPlayerAdmin(x)) return true;
}
return false;
}