25.07.2015, 16:29
The problem is that you are declaring the id of the player you used the command on after using it to validate whether that player is in jail or not (sscanf).
Also, make that variable a boolean.
Also, make that variable a boolean.
pawn Code:
new bool:sJailed[MAX_PLAYERS] = false;
pawn Code:
// When you jail someone:
sJailed[lookupid] = true;
pawn Code:
// When you un-jail someone:
sJailed[lookupid] = false;
pawn Code:
// To validate whether a player is jailed or not:
// For accessibility:
#define function%0(%1) forward%0(%1); public%0(%1)
// Function:
function bool:IsPlayerJailed(playerid) return sJailed[playerid];
pawn Code:
When checking if the player is in jail:
if(IsPlayerJailed(lookupid))
pawn Code:
When checking if the player is not in jail:
if(!IsPlayerJailed(lookupid))