SA-MP Forums Archive
Race Checkpoint - 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: Race Checkpoint (/showthread.php?tid=100389)



Race Checkpoint - [DFE]Roy - 04.10.2009

Hello,

our race script works but only the second race (NRG Race) but the first one (Standart Race) is buggy. The Standart Race loads only the first checkpoint and if I pass it, then load it the second checkpoint of the NRG race? (I hope everyone can understand my problem on my terrible English... )

Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
	if(RennenBegonnen == 1) {
 	if(Racer[playerid] == 1) {
 	DisablePlayerRaceCheckpoint(playerid);
  	gPlayerPos[playerid]++;
    if(LastCP[playerid] == 1) {
    GivePlayerMoney(playerid, 10000);
  	RaceOn = 0;
    LastCP[playerid] = 0;
  	EndCD = 30;
	RaceEndT = SetTimer("RaceEndTimer", 1000, 0);
	if(Score2 > 0) {
 	SetPlayerScore(playerid, GetPlayerScore(playerid) + Score[Score2-1]);
 	Score2--;}
 	}
 	if(gPlayerPos[playerid] < sizeof (StandartCheckpoint)) {
	if(gPlayerPos[playerid] == sizeof (StandartCheckpoint) - 1) {
	SetPlayerRaceCheckpoint(playerid, 1, StandartCheckpoint[gPlayerPos[playerid]][0], StandartCheckpoint[gPlayerPos[playerid]][1], StandartCheckpoint[gPlayerPos[playerid]][2], 0, 0, 0, 12);
	LastCP[playerid] = 1;
	}else{
	SetPlayerRaceCheckpoint(playerid, 0, StandartCheckpoint[gPlayerPos[playerid]][0],
    StandartCheckpoint[gPlayerPos[playerid]][1],
    StandartCheckpoint[gPlayerPos[playerid]][2],
    StandartCheckpoint[gPlayerPos[playerid] + 1][0],
    StandartCheckpoint[gPlayerPos[playerid] + 1][1],
 	StandartCheckpoint[gPlayerPos[playerid] + 1][2], 12);
    RaceOn = 1;
	}
	}
	if(gPlayerPos[playerid] < sizeof (NRGCheckpoint)) {
	if(gPlayerPos[playerid] == sizeof (NRGCheckpoint) - 1) {
	SetPlayerRaceCheckpoint(playerid, 1, NRGCheckpoint[gPlayerPos[playerid]][0], NRGCheckpoint[gPlayerPos[playerid]][1], NRGCheckpoint[gPlayerPos[playerid]][2], 0, 0, 0, 12);
	LastCP[playerid] = 1;
	}else{
	SetPlayerRaceCheckpoint(playerid, 0, NRGCheckpoint[gPlayerPos[playerid]][0],
    NRGCheckpoint[gPlayerPos[playerid]][1],
    NRGCheckpoint[gPlayerPos[playerid]][2],
    NRGCheckpoint[gPlayerPos[playerid] + 1][0],
    NRGCheckpoint[gPlayerPos[playerid] + 1][1],
 	NRGCheckpoint[gPlayerPos[playerid] + 1][2], 12);
	RaceOn = 1;
	}
	}
	}
	}
	return 1;
}


public OnPlayerLeaveRaceCheckpoint(playerid)
{
	if(RennenBegonnen == 1) {
	if(Racer[playerid] == 1) {
	DisablePlayerRaceCheckpoint(playerid);
    gPlayerPos[playerid]++;
  	if(gPlayerPos[playerid] < sizeof (StandartCheckpoint)) {
	SetPlayerRaceCheckpoint(playerid, 0, StandartCheckpoint[gPlayerPos[playerid]][0],
 	StandartCheckpoint[gPlayerPos[playerid]][1],
    StandartCheckpoint[gPlayerPos[playerid]][2],
    StandartCheckpoint[gPlayerPos[playerid] + 1][0],
    StandartCheckpoint[gPlayerPos[playerid] + 1][1],
    StandartCheckpoint[gPlayerPos[playerid] + 1][2], 12);
	RaceOn = 1;
	}
	if(gPlayerPos[playerid] < sizeof (NRGCheckpoint)) {
	SetPlayerRaceCheckpoint(playerid, 0, NRGCheckpoint[gPlayerPos[playerid]][0],
 	NRGCheckpoint[gPlayerPos[playerid]][1],
    NRGCheckpoint[gPlayerPos[playerid]][2],
    NRGCheckpoint[gPlayerPos[playerid] + 1][0],
    NRGCheckpoint[gPlayerPos[playerid] + 1][1],
    NRGCheckpoint[gPlayerPos[playerid] + 1][2], 12);
	RaceOn = 1;
	}
 	}
 	}
	return 1;
}



Re: Race Checkpoint - MadeMan - 04.10.2009

You don't need to put new checkpoints under OnPlayerLeaveRaceCheckpoint.


Re: Race Checkpoint - [DFE]Roy - 04.10.2009

Quote:
Originally Posted by MadeMan
You don't need to put new checkpoints under OnPlayerLeaveRaceCheckpoint.
But then nothing loads if I pass a checkpoint...



Re: Race Checkpoint - MadeMan - 04.10.2009

Quote:
Originally Posted by [DFE
Roy ]
But then nothing loads if I pass a checkpoint...
What OnPlayerEnterRaceCheckpoint does then?

You need OnPlayerEnterRaceCheckpoint

but

you don't need OnPlayerLeaveRaceCheckpoint


Re: Race Checkpoint - [DFE]Roy - 04.10.2009

I tryed without OnPlayerLeaveCheckpoint but it is more buggy then! I dont know why, ok then anything is wrong in OnPlayerEnterCheckpoint?


Re: Race Checkpoint - MadeMan - 04.10.2009

Try with this:

pawn Код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
    if(RennenBegonnen == 1)
    {
        if(Racer[playerid] == 1)
        {
            DisablePlayerRaceCheckpoint(playerid);
            gPlayerPos[playerid]++;
            if(LastCP[playerid] == 1)
            {
                GivePlayerMoney(playerid, 10000);
                RaceOn = 0;
                LastCP[playerid] = 0;
                EndCD = 30;
                RaceEndT = SetTimer("RaceEndTimer", 1000, 0);
                if(Score2 > 0)
                {
                    SetPlayerScore(playerid, GetPlayerScore(playerid) + Score[Score2-1]);
                    Score2--;
                }
            }
            if(gPlayerPos[playerid] < sizeof (StandartCheckpoint))
            {
                if(gPlayerPos[playerid] == sizeof (StandartCheckpoint) - 1)
                {
                    SetPlayerRaceCheckpoint(playerid, 1, StandartCheckpoint[gPlayerPos[playerid]][0], StandartCheckpoint[gPlayerPos[playerid]][1], StandartCheckpoint[gPlayerPos[playerid]][2], 0, 0, 0, 12);
                    LastCP[playerid] = 1;
                }
                else
                {
                    SetPlayerRaceCheckpoint(playerid, 0, StandartCheckpoint[gPlayerPos[playerid]][0],
                    StandartCheckpoint[gPlayerPos[playerid]][1],
                    StandartCheckpoint[gPlayerPos[playerid]][2],
                    StandartCheckpoint[gPlayerPos[playerid] + 1][0],
                    StandartCheckpoint[gPlayerPos[playerid] + 1][1],
                    StandartCheckpoint[gPlayerPos[playerid] + 1][2], 12);
                    RaceOn = 1;
                }
            }
        }
    }
    return 1;
}



Re: Race Checkpoint - [DFE]Roy - 04.10.2009

And the other race? (NRG Checkpoints) Should I put it under:
Код:
if(gPlayerPos[playerid] < sizeof (StandartCheckpoint))
			{
				if(gPlayerPos[playerid] == sizeof (StandartCheckpoint) - 1)
				{
					SetPlayerRaceCheckpoint(playerid, 1, StandartCheckpoint[gPlayerPos[playerid]][0], StandartCheckpoint[gPlayerPos[playerid]][1], StandartCheckpoint[gPlayerPos[playerid]][2], 0, 0, 0, 12);
					LastCP[playerid] = 1;
				}
				else
				{
					SetPlayerRaceCheckpoint(playerid, 0, StandartCheckpoint[gPlayerPos[playerid]][0],
					StandartCheckpoint[gPlayerPos[playerid]][1],
					StandartCheckpoint[gPlayerPos[playerid]][2],
					StandartCheckpoint[gPlayerPos[playerid] + 1][0],
					StandartCheckpoint[gPlayerPos[playerid] + 1][1],
					StandartCheckpoint[gPlayerPos[playerid] + 1][2], 12);
					RaceOn = 1;
?


Re: Race Checkpoint - MadeMan - 04.10.2009

Does the other race work now?


Re: Race Checkpoint - [DFE]Roy - 04.10.2009

Yes thanks, the standart race work now but now the other one?


Re: Race Checkpoint - MadeMan - 04.10.2009

How did the NRG race worked before? Do you have 2 races at same time? Can you show the NRG race code?