Race Checkpoint
#1

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;
}
Reply
#2

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

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

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
Reply
#5

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

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;
}
Reply
#7

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;
?
Reply
#8

Does the other race work now?
Reply
#9

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

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


Forum Jump:


Users browsing this thread: 1 Guest(s)