01.10.2016, 15:53
Quote:
Code:
else if(gTeam[playerid] == LSPD) { SendClientMessage(playerid, 0xFF0000, "[ERROR]: you can't use this on a law enforcer!"); return 1; { return 1; Code:
else if(!IsPlayerConnected(targetid)) { SendClientMessage(playerid, 0xFF0000, "[ERROR]: Invalid ID!"); return 1! } |
PHP Code:
if(IsPlayerConnected(playerid))
{
// Some code ...
}
else
{
if(!IsPlayerConnected(playerid))
{
// Some other code ...
}
}
PHP Code:
if(IsPlayerConnected(playerid))
{
// Some code ...
return 1;
}
else if(!IsPlayerConnected(playerid))
{
// Some other code ...
return 1;
}
To drop the whole else statement altogether, the function would have to return a value in the if statement above that:
PHP Code:
if(condition)
{
// Some code...
return someValue;
}
// Code under this if statement is automatically the else statement, that is without explicitely using the else keyword.
return someOtherValue;
Here's another mistake I came across:
EDIT: Your boolean variable 'isCuffed' will only work when nobody is cuffed. Once 1 player on the server is cuffed, nobody else can get cuffed.