SA-MP Forums Archive
Job checkpoints - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Job checkpoints (/showthread.php?tid=139094)



Job checkpoints - Steven82 - 03.04.2010

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.


Re: Job checkpoints - Carlton - 03.04.2010

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?


Re: Job checkpoints - Steven82 - 03.04.2010

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

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



Re: Job checkpoints - Carlton - 03.04.2010

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.


Re: Job checkpoints - Steven82 - 03.04.2010

Oh...