31.08.2012, 14:26
Hello, i've scripted my own race system. Everything seems work apart from the last two checkpoints. The second to last checkpoint shows but doesn't function meaning the last one wont show at all.
OnPlayerEnterDynamicCheckpoint
My OtherRaceInfo Var
Kind Regards, Luis.
OnPlayerEnterDynamicCheckpoint
pawn Код:
public OnPlayerEnterDynamicRaceCP(playerid, checkpointid) {
if(checkpointid == CheckpointIDRace[playerid] && IsRaceOn == true && IsPlayerInRace(playerid)) {
new string[128];
DestroyDynamicRaceCP(CheckpointIDRace[playerid]);
PlayerCheckpoint[playerid]++;
CheckpointIDRace[playerid] = CreateDynamicRaceCP(OtherRaceInfo[ChosenRace][MarkerType], AroundTheCountry[PlayerCheckpoint[playerid]][X], AroundTheCountry[PlayerCheckpoint[playerid]][Y], AroundTheCountry[PlayerCheckpoint[playerid]][Z], AroundTheCountry[PlayerCheckpoint[playerid]+1][X], AroundTheCountry[PlayerCheckpoint[playerid]+1][Y], AroundTheCountry[PlayerCheckpoint[playerid]+1][Z], OtherRaceInfo[ChosenRace][CheckpointSize], -1, -1, playerid, 500.0);
PlayerBestLap[playerid] = gettime() - RaceStartTime;
new
seconds = PlayerBestLap[playerid] % 60,
minutes = (PlayerBestLap[playerid] - seconds) / 60,
format(string, sizeof string, "~n~~n~~n~~n~~n~~n~~n~~n~~b~%s~n~~r~Checkpoints Remaining: ~w~%d/%d~n~Time: %02d:%02d", OtherRaceInfo[ChosenRace][Name], PlayerCheckpoint[playerid], OtherRaceInfo[ChosenRace][TotalCheckpoints], minutes, seconds);
GameTextForPlayer(playerid, string, 28000000, 3);
if(PlayerCheckpoint[playerid] >= OtherRaceInfo[ChosenRace][TotalCheckpoints]) {
IsRaceOn = false;
//PlayerCheckpoint[playerid] = -1;
ChosenRace = 0;
DestroyDynamicRaceCP(CheckpointIDRace[playerid]);
format(string, sizeof string, "RACE: {FFFFFF}The race is now over. {FF0000}%s {FFFFF}has won!", GetPlayerNameEx(playerid));
SendClientMessageToAll(COLOR_PURPLE, string);
GameTextForAll(" ", 100, 3);
StopAudioStreamForPlayer(playerid);
DestroyVehicle(GetPlayerVehicleID(playerid));
}
}
return 1;
}
pawn Код:
enum raceInfo1 {
ID,
MarkerType,
Name[100],
Float:CheckpointSize,
TotalCheckpoints,
RaceMusic[250],
CarID,
};
new OtherRaceInfo[][raceInfo1] = {
{0, 0, "Around the Country", 6.5, 18, "http://media.soundcloud.com/stream/gY5IsvLMrLgR?stream_token=9iHHs", 541}
};