06.05.2010, 13:24
Quote:
public OnPlayerEnterRaceCheckpoint(playerid) { if(RaceParticipant[playerid]>=1) // See if the player is participating in a race, allows race builders to do their stuff in peace. { if(RaceParticipant[playerid] == 6) // Player reaches the checkered flag. { new name[MAX_PLAYER_NAME], LapTime, RaceTime; LapTime=GetLapTick(playerid); RaceTime=GetRaceTick(playerid); GetPlayerName(playerid, name, MAX_PLAYER_NAME); RaceParticipant[playerid]=0; RaceSound(playerid,1139); format(ystring,sizeof(ystring),"Race News: %s has finished the race %s, position: %d",name,CRaceName,Ranking); RJoined[playerid] = 0; if (Ranking < 4) SendClientMessageToAll(COLOR_GREEN,ystring); else SendClientMessage(playerid,COLOR_GREEN,ystring); if(Racemode == ORacemode && ORacelaps == Racelaps) { new LapString[10],RaceString[10], laprank, racerank; LapString=BeHuman(LapTime); RaceString=BeHuman(RaceTime); format(ystring,sizeof(ystring),"~w~Racetime: %s",RaceString); if(ORacemode!=0) format(ystring,sizeof(ystring),"%s~n~Laptime: %s",ystring,LapString); laprank=CheckBestLap(playerid,LapTime); if(laprank == 1) { format(ystring,sizeof(ystring),"%s~n~~y~LAP RECORD!",ystring); } racerank=CheckBestRace(playerid,RaceTime); if(racerank == 1) { format(ystring,sizeof(ystring),"%s~n~~y~TRACK RECORD!",ystring); } GameTextForPlayer(playerid,ystring,13000,3); } if(Ranking<4) { new winrar; if(Ranking == 1 && Participants == 1) winrar=Pot; // If the player was only participant, give the whole pot. else if(Ranking == 1 && Participants == 2) winrar=Pot/6*4; // If only 2 participants, give 4/6ths of the pot. else winrar=Pot/6*PrizeMP; // Otherwise 3/6ths, 2/6ths and 1/6th. SafeGivePlayerMoney(playerid,winrar); format(ystring,sizeof(ystring),"You have earned $%d from the race!",winrar); PrizeMP--; SendClientMessage(playerid,COLOR_GREEN,ystring); } Ranking++; Participants--; DisablePlayerRaceCheckpoint(playerid); if(Participants == 0) { endrace(); } } else if (RaceStart == 0 && RaceParticipant[playerid]==1) // Player arrives to the start CP for 1st time { SendClientMessage(playerid,COLOR_YELLOW,"Type /ready when you are ready to start."); SendClientMessage(playerid,COLOR_YELLOW,"NOTE: Your controls will be locked once the countdown starts."); RaceParticipant[playerid]=2; } else if (RaceStart==1) // Otherwise switch to the next race CP. { RaceSound(playerid,113; SetNextCheckpoint(playerid); } } return 1; } |
I'm using this:
PlayerInfo[i][pExp]++;