Issue with race system - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Issue with race system (
/showthread.php?tid=618777)
Issue with race system -
Jack Shred - 09.10.2016
Hi everyone! I'm having an issue with my 4 room based race system. The player has to make a room in the lobby, and then someone joins. All of this works for room 1 (id 0) but in any other room it does not teleport the loser, it does not remove the car of the winner, but it does remove the car of the loser. The code is the following:
Код:
new rID[4][MAX_PLAYERS];
new vrID[4][5];
enum gRoomInfo
{
Creator[MAX_PLAYER_NAME],
Wager,
Vehicle,
Interior,
bool:Temp,
bool:Active,
Players,
Rounds,
VW,
}
new gRoom[4][gRoomInfo];
Код:
else if(pRound[playerid] == gRoom[pRoom[playerid]][Rounds] - 1)
{
new pRoomSub = pRoom[playerid];
SetTimerEx("EndRace", 5000, false, "i", pRoomSub);
for(new i; i <= gRoom[pRoom[playerid]][Players]; i++)
{
if(rID[pRoom[playerid]][i] == rID[pRoom[playerid]][playerid])
{
SendClientMessage(playerid, 0xFF0000AA, "[Server]: Congratulations! You won the race.");
GivePlayerMoney(playerid, gRoom[pRoom[playerid]][Wager]*(gRoom[pRoom[playerid]][Players] - 1));
}
else if(rID[pRoom[playerid]][i] != rID[pRoom[playerid]][playerid] && InRace[i] == true)
{
SendClientMessage(i, 0xFF0000AA, "[Server]: You lost the race..");
GivePlayerMoney(i, -gRoom[pRoom[playerid]][Wager]);
}
if(rID[pRoomSub][i] >= 0 && rID[pRoomSub][i] <= gRoom[pRoomSub][Players] && InRace[i] == true)
{
SetPlayerInterior(i, 0);
SetPlayerPos(i, 2692.4453,-1707.2877,11.8478);
SetPlayerVirtualWorld(i, gRoom[pRoomSub][VW]);
DestroyVehicle(vrID[pRoom[playerid]][i]);
DisablePlayerRaceCheckpoint(i);
pCheckPoint[i] = 999;
pRound[i] = 999;
pRoom[i] = 999;
rID[pRoomSub][i] = 999;
InRace[i] = false;
}
}
}
Can anyone help? Any other hints are also very welcome. Thank you!!
Re: Issue with race system -
Jack Shred - 11.10.2016
Bump