SA-MP Forums Archive
Making races - 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: Making races (/showthread.php?tid=144447)



Making races - RedFusion - 27.04.2010

Hey, I am working on a racingserver but my checkpoints is not appearing..

I did a little try to start with.
Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
	SetPlayerRaceCheckpoint (playerid,0,1430.0835,207.2409,18.1294,1507.9691,237.9281,18.1316,2);//Checkpoint 1
	SetPlayerRaceCheckpoint (playerid,1,1507.9691,237.9281,18.1316,1631.6682,267.4311,19.4609,2);//Checkpoint 2
	return 1;
}

public OnPlayerLeaveRaceCheckpoint(playerid)
{
	DisablePlayerRaceCheckpoint (playerid);
	return 1;
}
Can you see anything wrong in this?


Re: Making races - Correlli - 27.04.2010

You can only show one race CP at the time. And you should set the race CP before, because OnPlayerEnterRaceCheckpoint is called when player enters the race CP.


Re: Making races - RedFusion - 27.04.2010

So where am i supposed to put it?


Re: Making races - Correlli - 27.04.2010

I don't know, how do you want it? In a command, timer?


Re: Making races - RedFusion - 27.04.2010

No. I am supposed to spawn, enter a car and race


Re: Making races - Correlli - 27.04.2010

So set a race CP when you spawn or when player's on-foot state changes to driver state.


Re: Making races - RedFusion - 27.04.2010

What, OnPlayerEnterVehicle or OnPlayerKeyStateChange :S


Re: Making races - Rac3r - 27.04.2010

It''s not stealing, I see it as learning from that masters. Check this script out, coded by Ryder:
http://forum.sa-mp.com/index.php?topic=169121.0
Genius way to switching what CP to show.

Basically you need a start point (something like add players to race). That would show checkpoint 1.
When OnPlayerEnterCheckpoint is called, show checkpoint 2 (in your case, the finish checkpoint).

Quote:
Originally Posted by Don Correlli
You can only show one race CP at the time.
True, but using normal checkpoints (not race checkpoints) can have a similar effect.
Or (as we do) use a map icon to show where the next checkpoint is.


Re: Making races - RedFusion - 27.04.2010

It was to hard to understand, but i put the first checkpoint on OnPlayerEnterVehicle,
And the rest of them on OnPlayerEnterRaceCheckpoint


Re: Making races - Correlli - 27.04.2010

OnPlayerEnterVehicle can be called even if player cancels his entry. Use OnPlayerStateChange and check for old state (on-foot) and new state (driver).