job checkpoints
#1

Eh. I'd like to make some checkpoints in my jobs. Now what the problem is here:

I don't really know how to make checkpoints, do I make them like this:
PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
       if(
lawnmower[playerid] == 1)
       {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playeridsize,x,y,z);
        }
        if(
lawnmower[playerid] == 1)
       {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playeridsize,x,y,z);
        }
return 
1;

or:

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
       if(
lawnmower[playerid] == 1)
       {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playeridsize,x,y,z);
        }
        }
        case 
1;
         {
        if(
lawnmower[playerid] == 1)
       {
        
DisablePlayerCheckpoint(playerid);
        
SetPlayerCheckpoint(playeridsize,x,y,z);
        }
        }
        case 
2;
return 
1;

I want 10 checkpoints i got coords and everything but I don't know how to make more?
Reply
#2

May this will help you

pawn Код:
#include <a_samp>

// variable
new lawnmower[MAX_PLAYERS];

public OnPlayerEnterCheckpoint(playerid)
{
    if(lawnmower[playerid] == 1)
    {
        lawnmower[playerid] =2;
        SetPlayerCheckpoint(playerid, size,x,y,z);
    }
    if(lawnmower[playerid] == 2)
    {
        lawnmower[playerid] =3;
        SetPlayerCheckpoint(playerid, size,x,y,z);
    }
    if(lawnmower[playerid] == 3)
    {
        lawnmower[playerid] =4;
        SetPlayerCheckpoint(playerid, size,x,y,z);
    }
    // this for your las checkpoint (finish the job)
    if(lawnmower[playerid] == 4)
    {
        lawnmower[playerid] =0;
        DisablePlayerCheckpoint(playerid);
        SendClientMessage(playerid,-1,"** You has finished the job!");
        GivePlayerMoney(playerid,100000)
    }
    return 1;
}
Reply
#3

Код:
CMD:startjob(playerid,params[])
{
if(lawnmower[playerid] != 0)
{
SendClientMessage(playerid,0xFFFFFFFF,"You are already on job!");
return 1;
}
SetPlayerCheckpoint(playerid, size,x,y,z);  // first checkpoint
SendClientMessage(playerid,0xFFFFFFFF,"You have started the job, go through the checkpoints to recive the paycheck.");
lawnmower[playerid] = 1;
return 1;
}


public OnPlayerEnterCheckpoint(playerid)
{
        if(lawnmower[playerid] == 1)
        {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, size,x,y,z); // checkpoint 2
        lawnmower[playerid] += 1;
        }
        if(lawnmower[playerid] == 2) // if the player enters the checkpoint 2
       {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, size,x,y,z); //checkpoint 3
        lawnmower[playerid] += 1;
        }
        if(lawnmower[playerid] == 3) // if the player enters the checkpoint 3
       {
        DisablePlayerCheckpoint(playerid);
        SetPlayerCheckpoint(playerid, size,x,y,z);
        lawnmower[playerid] += 1;
        }
 //now go on like this till it gets to 10 give him the paycheck and set lawnmower[playerid] back to 0
return 1;
}
EDIT:damn i was little too late
Reply
#4

Gonna use that first one. Thank you.
Reply
#5

I'll give some reputation later. I have to wait 24 hours to give rep. I won't forget don't worry guys. You both will get reputation, thanks veeeery muuuuuuchh
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)