Checkpoint
#1

PHP код:
public OnPlayerEnterRaceCheckpoint(playerid)
{
if(
RaceStarted == 1)
{
    if(
Joined[playerid] == true)
    {
    if(
CPProgess[playerid] == TotalCP -1)
    {
        new
            
TimeStamp,
            
TotalRaceTime,
            
string[256],
            
rFile[256],
            
rTime[3],
            
Prize[2],
            
TempTotalTime,
            
TempTime[3]
        ;
        
Position++;
        
TimeStamp GetTickCount();
        
TotalRaceTime TimeStamp RaceTick;
        
ConvertTime(var, TotalRaceTimerTime[0], rTime[1], rTime[2]);
        switch(
Position)
        {
            case 
1:
            {
            
Prize[0] = (random(random(5000)) + 10000), Prize[1] = 10;
            
pData[playerid][RaceWon]++;
            }
            case 
2Prize[0] = (random(random(4500)) + 9000), Prize[1] = 9;
            case 
3Prize[0] = (random(random(4000)) + 8000), Prize[1] = 8;
            case 
4Prize[0] = (random(random(3500)) + 7000), Prize[1] = 7;
            case 
5Prize[0] = (random(random(3000)) + 6000), Prize[1] = 6;
            case 
6Prize[0] = (random(random(2500)) + 5000), Prize[1] = 5;
            case 
7Prize[0] = (random(random(2000)) + 4000), Prize[1] = 4;
            case 
8Prize[0] = (random(random(1500)) + 3000), Prize[1] = 3;
            case 
9Prize[0] = (random(random(1000)) + 2000), Prize[1] = 2;
            default: 
Prize[0] = random(random(1000)), Prize[1] = 1;
        }
        
format(stringsizeof(string), ">> \"%s\" has finished the race in position \"%d\"."pName(playerid), Position);
        
SendClientMessageToAll(WHITEstring);
        new 
IRC[100+1000];
        
format(IRCsizeof(IRC), "0,13* %s (ID: %d) has finished the race in position %d.",GetName(playerid),playeridPosition);
        
IRC_GroupSay(groupIDIRC_CHANNELIRC);
        
format(stringsizeof(string), "    - Time: \"%d:%d.%d\"."rTime[0], rTime[1], rTime[2]);
        
SendClientMessageToAll(WHITEstring);
        
format(stringsizeof(string), "    - Prize: \"$%d and +%d Score\"."Prize[0], Prize[1]);
        
SendClientMessageToAll(WHITEstring);
        if(
FinishCount <= 5)
        {
            
format(rFilesizeof(rFile), "/rRaceSystem/%s.RRACE"RaceName);
            
format(stringsizeof(string), "BestRacerTime_%d"TimeProgress);
            
TempTotalTime dini_Int(rFilestring);
            
ConvertTime(var1TempTotalTimeTempTime[0], TempTime[1], TempTime[2]);
            if(
TotalRaceTime <= dini_Int(rFilestring) || TempTotalTime == 0)
            {
                
dini_IntSet(rFilestringTotalRaceTime);
                
format(stringsizeof(string), "BestRacer_%d"TimeProgress);
                if(
TempTotalTime != 0format(stringsizeof(string), ">> \"%s\" has broken the record of \"%s\" with \"%d\" seconds faster on the \"%d\"'st/th place!"pName(playerid), dini_Get(rFilestring), -(rTime[1] - TempTime[1]), TimeProgress+1);
                    else 
format(stringsizeof(string), ">> \"%s\" has broken a new record of on the \"%d\"'st/th place!"pName(playerid), TimeProgress+1);
                
SendClientMessageToAll(GREEN"  ");
                
SendClientMessageToAll(GREENstring);
                
SendClientMessageToAll(GREEN"  ");
                
format(stringsizeof(string), "BestRacer_%d"TimeProgress);
                
dini_Set(rFilestringpName(playerid));
                
TimeProgress++;
            }
        }
        
FinishCount++;
        
GivePlayerMoney(playeridPrize[0]);
        
SetPlayerScore(playeridGetPlayerScore(playerid) + Prize[1]);
        
DisablePlayerRaceCheckpoint(playerid);
        
CPProgess[playerid]++;
        if(
FinishCount >= JoinCount) return StopRace();
    }
    else
    {
        
CPProgess[playerid]++;
        
CPCoords[CPProgess[playerid]][3]++;
        
RacePosition[playerid] = floatround(CPCoords[CPProgess[playerid]][3], floatround_floor);
        
SetCP(playeridCPProgess[playerid], CPProgess[playerid]+1TotalCPRaceType);
        
PlayerPlaySound(playerid11370.00.00.0);
    }
    }
}
    return 
1;

In that if iam ready to the race after the race starts if iam on the checkpoint i must leave and enter why?
Reply
#2

Whaat are you saying, can you pleaaase try to explain a bit more next time?

Let me know what happens, and what did you expect to happen
Reply
#3

Quote:
Originally Posted by denNorske
Посмотреть сообщение
Whaat are you saying, can you pleaaase try to explain a bit more next time?

Let me know what happens, and what did you expect to happen
When i load a race i let the player can control the car to get on the checkpoint when the countdown starts nothing happens he must leave the checkpoint and enter it again to switch to next checkpoint, Just need when player enter the 1st checkpoint to be ready when the countdown finishes the next one appear
Reply
#4

Then disable the first checkpoint, and only show the next one when it has started.

that function explains what its doing : OnPlayerEnterCheckpoint. It will not be called if the player is already inside
Reply
#5

Quote:
Originally Posted by denNorske
Посмотреть сообщение
Then disable the first checkpoint, and only show the next one when it has started.

that function explains what its doing : OnPlayerEnterCheckpoint. It will not be called if the player is already inside
I don't want to disable it i want just if the race is not started he stays on the 1st textdraw when race starts he takes the 1st one and then switch
Reply
#6

Quote:
Originally Posted by Loinal
Посмотреть сообщение
I don't want to disable it i want just if the race is not started he stays on the 1st textdraw when race starts he takes the 1st one and then switch
When you start a race i guess you have a variabile named "Race[idrace][Started]". I have this one to check in OnPlayerEnterRaceCheckpoint if the race is started or not.

Just doing this:

Код:
if(Race[RacePL[playerid][IdRace]][Started] == 0)
				return 1;
If the race is started then the code go forward .. and then you can show him the next checkpoint.
Reply
#7

Why not do what's said... When the race starts, simply make the next checkpoint get shown.

The callback isn't called when the player is already IN the checkpoint, as the callback is fired when they ENTER the checkpoint.
Reply
#8

Fixed and explained over teamviewer with you.
Solved
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)