Job checkpoints
#1

I am sorry i have been flooding today , but how to make a checkpoint, i have cords, but like how do i make when you enter it, it destroys it and then you have to go to another one, etc.

Then at the end you get paid for the whole job.
Reply
#2

You have to set variables so the servers knows which checkpoint to create for the player next. I'll show you a example code of this. I used SetPlayerCheckpoint, and DisablePlayerCheckpoint.

pawn Код:
new
    Checkpoint[MAX_PLAYERS],
    bool:DoingJob[MAX_PLAYERS];

public OnPlayerConnect(playerid) {
    Checkpoint[playerid] = 0, DoingJob[playerid] = false;
}

public OnPlayerSpawn(playerid) {
   SendClientMessage(playerid, BLUE, "Go to the checkpoints to do your job.");
   SetPlayerCheckpoint(playerid, x, y, z, other parameters);
   DoingJob[playerid] = true;
}

public OnPlayerEnterCheckpoint(playerid) {
   if(DoingJob[playerid] == true) continue;
   switch(Checkpoint[playerid]) {
     case 0: {
        SendClientMessage(playerid, BLUE, "You've entered your first CP");
        Checkpoint[playerid] ++;
        SetPlayerCheckpoint(New coordinates and params);
     }
     case 1: {
        SendClientMessage(playerid, BLUE, "You've entered your final CP");
        GivePlayerMoney(playerid, 500000); // The pay at the end.
        Checkpoint[playerid] = 0;
        DoingJob[playerid] = false;
        DisablePlayerCheckpoint(playerid);
     }
   }
}
And so on, do you get my pattern?
Reply
#3

No kinda not really. Is there a simpler way by like

Код:
#define job1 (then the cordinates)
Reply
#4

Quote:
Originally Posted by Steven82
No kinda not really. Is there a simpler way by like

Код:
#define job1 (then the cordinates)
That way will be longer and more confusing. If you don't set a variable or something to a player that means when a player enters any checkpoint the same thing will happen with all of them. So pretty much the answer is no.
Reply
#5

Oh...
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)