SA-MP Forums Archive
Define Checkpoints For OnPlayerEnterCheckpoint? - 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: Define Checkpoints For OnPlayerEnterCheckpoint? (/showthread.php?tid=272434)



Define Checkpoints For OnPlayerEnterCheckpoint? - Rolyy - 28.07.2011

Title says it all, How to define Checkpoints like as in OnPlayerPickUpPickup (if(pickupid == cash)).
Because there's no such thing on the OnPlayerSpawn callback..


pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerCheckpoint(playerid, 1982.6150, -220.6680, -0.2432, 3.0);
    return 1;
}
 
public OnPlayerEnterCheckpoint(playerid)
{
    CreateVehicle(520, 1982.6150, -221.0145, -0.2432, 82.2873, -1, -1, 60000);
    DisablePlayerCheckpoint(playerid);
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerEnterCheckpoint



pawn Код:
new cash;
 
public OnGameModeInit()
{
    cash = CreatePickup(1274, 2, 0.0, 0.0, 9.0);
    return 1;
}
 
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == cash) GivePlayerMoney(playerid,10000);
    return 1;
}
https://sampwiki.blast.hk/wiki/OnPlayerPickUpPickup


Re: Define Checkpoints For OnPlayerEnterCheckpoint? - iPLEOMAX - 28.07.2011

There can only be One Checkpoint at a time. Checkpoints are not like pickups...

If you want to create Several Checkpoints, you should use timers or functions to check a players range per time, and then SetPlayerCheckpoint + setting a var. This will enable you to determine when a player is near a certain checkpoint.

Example (not pawn, but some words)

Positions: X1,Y1,Z1 & X2, Y2, Z2.
Now you want 2 checkpoints on these 2 places.

So, use a timer to check players range position, if a player is in range of X1, Y1, Z1
> SetPlayerCheckpoint, playerid, X1, Y1, Z1 + a variable (1).

if a player is in range of X2, Y2, Z2
> SetPlayerCheckpoint, playerid, X2, Y2, Z2 + a variable (2).

And then OnPlayerEnterCheckpoint(playerid) to check the var(id) and all.

Hope this helps.


Re: Define Checkpoints For OnPlayerEnterCheckpoint? - Rolyy - 28.07.2011

Quote:
Originally Posted by iPLEOMAX
Посмотреть сообщение
There can only be One Checkpoint at a time. Checkpoints are not like pickups...

If you want to create Several Checkpoints, you should use timers or functions to check a players range per time, and then SetPlayerCheckpoint + setting a var. This will enable you to determine when a player is near a certain checkpoint.

Example (not pawn, but some words)

Positions: X1,Y1,Z1 & X2, Y2, Z2.
Now you want 2 checkpoints on these 2 places.

So, use a timer to check players range position, if a player is in range of X1, Y1, Z1
> SetPlayerCheckpoint, playerid, X1, Y1, Z1 + a variable (1).

if a player is in range of X2, Y2, Z2
> SetPlayerCheckpoint, playerid, X2, Y2, Z2 + a variable (2).

And then OnPlayerEnterCheckpoint(playerid) to check the var(id) and all.

Hope this helps.
I was also thinking about something like this, okay its clear for me now. Thank you for your explanation and your time >:].

Regards,
Rolyy