SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 04/10/2009, 01:48 PM   #1
[DFE]Roy
Big Clucker
 
Join Date: Jul 2009
Posts: 59
Reputation: 0
Default Race Checkpoint

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... )

Code:
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;
}
[DFE]Roy is offline  
Old 04/10/2009, 02:05 PM   #2
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,472
Reputation: 237
Default Re: Race Checkpoint

You don't need to put new checkpoints under OnPlayerLeaveRaceCheckpoint.
MadeMan is offline  
Old 04/10/2009, 02:08 PM   #3
[DFE]Roy
Big Clucker
 
Join Date: Jul 2009
Posts: 59
Reputation: 0
Default Re: Race Checkpoint

Quote:
Originally Posted by MadeMan
You don't need to put new checkpoints under OnPlayerLeaveRaceCheckpoint.
But then nothing loads if I pass a checkpoint...
[DFE]Roy is offline  
Old 04/10/2009, 02:09 PM   #4
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,472
Reputation: 237
Default Re: Race Checkpoint

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
MadeMan is offline  
Old 04/10/2009, 02:19 PM   #5
[DFE]Roy
Big Clucker
 
Join Date: Jul 2009
Posts: 59
Reputation: 0
Default Re: Race Checkpoint

I tryed without OnPlayerLeaveCheckpoint but it is more buggy then! I dont know why, ok then anything is wrong in OnPlayerEnterCheckpoint?
[DFE]Roy is offline  
Old 04/10/2009, 02:25 PM   #6
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,472
Reputation: 237
Default Re: Race Checkpoint

Try with this:

pawn Code:
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;
}
MadeMan is offline  
Old 04/10/2009, 02:29 PM   #7
[DFE]Roy
Big Clucker
 
Join Date: Jul 2009
Posts: 59
Reputation: 0
Default Re: Race Checkpoint

And the other race? (NRG Checkpoints) Should I put it under:
Code:
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;
?
[DFE]Roy is offline  
Old 04/10/2009, 02:33 PM   #8
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,472
Reputation: 237
Default Re: Race Checkpoint

Does the other race work now?
MadeMan is offline  
Old 04/10/2009, 02:36 PM   #9
[DFE]Roy
Big Clucker
 
Join Date: Jul 2009
Posts: 59
Reputation: 0
Default Re: Race Checkpoint

Yes thanks, the standart race work now but now the other one?
[DFE]Roy is offline  
Old 04/10/2009, 02:42 PM   #10
MadeMan
High-roller
 
MadeMan's Avatar
 
Join Date: Jun 2007
Posts: 3,472
Reputation: 237
Default Re: Race Checkpoint

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

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] [FS] Simple Checkpoint Race (DRIFT) [ZFM]Zuc Filterscripts 15 30/05/2010 09:11 PM
[FilterScript] [FS] Style Race + Checkpoint (or not) + Pictures + Video [nl]rockline[nl] Filterscripts 11 22/05/2010 08:42 PM
Race checkpoint streamer? Torran Help Archive 8 23/02/2010 11:42 AM
A little Help with a race checkpoint please. Stig Help Archive 1 07/01/2010 10:59 PM
Race checkpoint help shithead Help Archive 12 25/07/2009 06:48 PM


All times are GMT. The time now is 06:28 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.