23.11.2011, 20:30
A collective amount of if statements to return the conditions as false if false would be another way of doing this.
pawn Код:
CMD:getdrugs(playerid, params[])
{
if(jobVariables[playerVariables[playerid][pJob]][jJobType] != 1) return false;
if(playerVariables[playerid][pCheckpoint] != 0) return false
if(playerVariables[playerid][pMoney] < 1000) return false
if(IsPlayerInRangeOfPoint(playerid, 5, -1668.8607, 2590.7776, 81.3594))
{
SetPlayerCheckpoint(playerid, -2503.8687, 2366.1311, 4.9807, 10);
SendClientMessage(playerid, COLOR_WHITE, "Reach the checkpoint to collect your Drugs.");
playerVariables[playerid][pCheckpoint] = 2;
playerVariables[playerid][pMoney] -= 1000;
playerVariables[playerid][pDrugrunTime] = 1;
}
return 1;
}
- pJobType must be 1
- pMoney must be greater than 1000
- pCheckpoint must be 0
- The player must be in range of the coordinates given