21.01.2016, 22:46
Hmm i finnaly fix this just removed +1] @ last "SetPlayerRaceCheckpoint", all works.
Код:
new Float:CheckPoints[10][3] =
{
{-2127.3611,-81.2161,35.1019},
{-2167.1638,-71.8486,34.9774},
{-2256.0537,-191.7249,34.9743},
{-2204.0200,-466.3755,49.3204},
{-2226.0217,-740.3702,64.3937},
{-2312.0801,-782.2291,90.6318},
{-2422.8140,-609.5429,132.3662},
{-2628.3250,-494.8151,69.9621},
{-2355.0166,-460.1673,80.0940},
{-2790.6455,-483.1252,7.1875}
};
public OnPlayerSpawn(playerid)
{
new Random = random(sizeof(RandomSpawns));
new Clover = CreateVehicle(521,RandomSpawns[Random][0], RandomSpawns[Random][1], RandomSpawns[Random][2],0.0000,149,149,-1);// Nosakām {X,Y,Z,-},
PutPlayerInVehicle(playerid, Clover, 0); // Ieliekam spēlētāju maљīnā, kā vadītāju
TogglePlayerControllable(playerid,0); // Sasaldējam dalībnieku
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
Player_CheckPoint[i] = 0;
SetPlayerRaceCheckpoint(i,0,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7);
IsRaceRunning = true;
}
}
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
if(IsRaceRunning == true) { Player_CheckPoint[playerid]++; }
if(Player_CheckPoint[playerid] < 9 && IsRaceRunning == true)
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid,0,CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],CheckPoints[Player_CheckPoint[playerid]+1][0],CheckPoints[Player_CheckPoint[playerid]+1][1],CheckPoints[Player_CheckPoint[playerid]+1][2],9.7);
return 1;
}
if(Player_CheckPoint[playerid] == 9 && IsRaceRunning == true)
{
DisablePlayerRaceCheckpoint(playerid);
SetPlayerRaceCheckpoint(playerid,1,CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],9.7);
return 1;
}
if(Player_CheckPoint[playerid] == 10 && IsRaceRunning == true)
{
for(new i = 10; i < MAX_PLAYERS; i++)
{
DisablePlayerRaceCheckpoint(playerid);
}
GetPlayerName(playerid,WinnerName,sizeof(WinnerName));
format(stringwin,sizeof(stringwin),"[RACE] The race is over, %s has won and achieved $%d!",WinnerName,winner_money);
SendClientMessageToAll(0xFF0000FF,stringwin);
GivePlayerMoney(playerid,winner_money);
IsRaceRunning = false;
new currentveh;
currentveh = GetPlayerVehicleID(playerid);
DestroyVehicle(currentveh);
return 1;
}
return 1;
}

