job help
#1

Ok I tried to make a new job and when I type /getjob when I got a job, it says I need to quit it, and then I quit it and type /getjob it don't work

Код:
pDrugs,
Код:
pDrugrunTime
the Command:
Код:
CMD:getdrugs(playerid, params[]) {
    if(jobVariables[playerVariables[playerid][pJob]][jJobType] != 1) return 1;

	if(IsPlayerInRangeOfPoint(playerid, 5, -1668.8607, 2590.7776, 81.3594)) {
	    if(playerVariables[playerid][pCheckpoint] == 0) {
	        if(playerVariables[playerid][pMoney] >= 1000) {
		        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;
	        }
	        else {
				return SendClientMessage(playerid, COLOR_GREY, "You need to pay $1000 to collect Drugs.");
			}
	    }
	    else {
	        new
	            messageString[90];

	        format(messageString, sizeof(messageString), "You already have an active checkpoint (%s), reach it first, or /killcheckpoint.", getPlayerCheckpointReason(playerid));
			SendClientMessage(playerid, COLOR_WHITE, messageString);
		}
	}

	return 1;
}
I copied all of the Materials one and it still don't work >.<
Reply
#2

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
These must be true in order for functions within the compound statement to successfully execute.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)