[Tutorial] Checkpoint system - 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: Tutorials (
https://sampforum.blast.hk/forumdisplay.php?fid=70)
+---- Thread: [Tutorial] Checkpoint system (
/showthread.php?tid=417737)
Checkpoint system -
lcp9 - 22.02.2013
Hey guys i want to show you how to make a checkpoint system i mean you must drive from One Checkpoint to other
or more than two checkpoints:
first you have to make a cmd to set a checkpoint (if you want you can do it too if you enter vehicle etc...)
here is the cmd with ocmd (you can write it to other command przessorr iif you want!)
:
PHP код:
ocmd:job(playerid,params[])
{
if( GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 515 &&
GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 578 &&
GetVehicleModel( GetPlayerVehicleID( playerid ) ) != 455 )
//here you can write i which vehicle to drive
return SendClientMessage( playerid, 0xFFFFFFFF, "You Need to be in a Flatbed , Roadtrain or DFT30 to do this work!" );
Tutorialcheck[playerid] = 1;
SetPlayerCheckpoint(playerid,1363.5885,-1289.5168,13.5469,5.0);//here say where the driver have to drive at the 1st time
SendClientMessage(playerid,BLAU,"Drive to Ammushop 1 ");
return 1;
}
at the top you have to make this for the checkpoint:
PHP код:
new Tutorialcheckpoint[20];
so now you have to write under OnPlayerEnterCheckpoint:
PHP код:
{
if(Tutorialcheck[playerid] == 1)
{
DisablePlayerCheckpoint(playerid);
Tutorialcheck[playerid] = 2;
SetPlayerCheckpoint(playerid, 1003.7125,-1356.2329,13.3246, 5.0);//here say where the driver have to drive at the 2nd time
SendClientMessage(playerid,BLAU,"Drive to next checkpoint!");
return 1;
}
if(Tutorialcheck[playerid] == 2)
if(IsPlayerInRangeOfPoint(playerid,7.0,1003.7125,-1356.2329,13.3246))
{
DisablePlayerCheckpoint(playerid);
fuhrer[playerid] = 3;
SetPlayerCheckpoint(playerid, 238.5253,-44.6169,1.5781, 5.0);//here say where the driver have to drive at the 3nd time
SendClientMessage(playerid,BLAU,"Drive to next checkpoint!");
return 1;
}
if(Tutorialcheck[playerid] == 3)
if(IsPlayerInRangeOfPoint(playerid,7.0,238.5253,-44.6169,1.5781))
{
DisablePlayerCheckpoint(playerid);
Tutorialcheck[playerid] = 0;
GivePlayerMoney(playerid, +30000);//money
SetPlayerScore(playerid, GetPlayerScore(playerid) +1);//score
return 1;
}
}
return 0;
}