SA-MP Forums Archive
Checkpoints[+rep] - 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)
+--- Thread: Checkpoints[+rep] (/showthread.php?tid=521975)



Checkpoints[+rep] - Bek_Loking - 25.06.2014

Hello I made a script where a guy types /employment and he employs himself as a lawnmower. Then he types /mowland to start doing job. My problem is: How do I make checkpoints? I got coordinates for checkpoints, but how do I make one, and how do I make when he passes through one, the second one appears and so on until the last one where he receives a message like: Job well done, here's your pay 500$ and it gives the money to him? I made this script about the job it may help:

TO EMPLOY:

PHP код:
CMD:employmower(playeridparams[])
{
    if(
lawnmower[playerid] == 1SendClientMessage(playeridCOLOR_RED,"[ERROR]{FFFFFF}You're already employed as lawn-mower!");
    else if(
employment[playerid] == 1SendClientMessage(playeridCOLOR_RED"You already have a job!");
    else if(!
IsPlayerInRangeOfPoint(playerid,3,1895.7168,1729.1393,10.8153)) SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You're not near mowers' hut");
    else
    {
        
SendClientMessage(playeridCOLOR_LIGHTGREEN"[SUCCESS!]{FFFFFF}You've employed yourself as a lawnmower!");
        
employment[playerid] = 1;
        
lawnmower[playerid] = 1;
    }
    return 
1;

To start mowing:


PHP код:
CMD:mowland(playeridparams[])
{
new 
vid GetPlayerVehicleID(playerid);
if(
lawnmower[playerid] == 0SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You're not employed as lawnmower!") ;
else if(!
IsPlayerInRangeOfPoint(playerid5,1878.5900,1758.6154,10.4470)) SendClientMessage(playeridCOLOR_RED"[ERROR]{FFFFFF}You're not near mowers' job starting line!");
else if(
vid == 572 || IsPlayerInRangeOfPoint(playerid,5,1878.5900,1758.6154,10.4470))
{
job[playerid] = 1;
SendClientMessage(playeridCOLOR_LIGHTGREEN"[SUCCESS!]{FFFFFF}You've started lawnmowing. Go through checkpoints to finish your job!");
}
return 
1;

How do I make at this mowland that it displays checkpoints? Will be glad to give reputation!


Re : Checkpoints[+rep] - Clad - 25.06.2014

pawn Код:
SetPlayerCheckPoint(playerid, coordinates and size);



Re: Checkpoints[+rep] - Rittik - 25.06.2014

Код:
SetPlayerCheckpoint(playerid, Float:x, Float:y, Float:z, Float:size);



Re: Checkpoints[+rep] - Bek_Loking - 25.06.2014

I know that, but how do I make the thing when a guy hits a checkpoint it displays a new one.


Re : Checkpoints[+rep] - Clad - 25.06.2014

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    DisablePlayerCheckpoint(playerid);
    return 1;
}



Re: Checkpoints[+rep] - Bek_Loking - 25.06.2014

I have a problem with understanding people, is this how I do it:

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    
DisablePlayerCheckpoint(playerid);
    
SetPlayerCheckpoint(playerid coords);
    return 
1;

Do I make a new callback for every checkpoint or?


Re : Re: Checkpoints[+rep] - Clad - 25.06.2014

Quote:
Originally Posted by Bek_Loking
Посмотреть сообщение
I have a problem with understanding people, is this how I do it:

PHP код:
public OnPlayerEnterCheckpoint(playerid)
{
    
DisablePlayerCheckpoint(playerid);
    
SetPlayerCheckpoint(playerid coords);
    return 
1;

Do I make a new callback for every checkpoint or?
You're doing good, But make sure the Coordinates have with them the checkpoint size or it won't appear.


Re: Checkpoints[+rep] - Rittik - 25.06.2014

pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
    if(lawnmower[playerid] == 1)
    {
    DisablePlayerCheckpoint(playerid);
    SetPlayerCheckpoint(playerid coords);  //Your code goes here....
    }
    return 1;
}



Re: Checkpoints[+rep] - Bek_Loking - 25.06.2014

Alright, correct me if I'm wrong. It should go 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;
}
// and so on..? or?