function SetupRaceForPlayer(playerid) { CPProgess[playerid] = 0; TogglePlayerControllable(playerid, false); CPCoords[playerid][3] = 0; SetCP(playerid, CPProgess[playerid], CPProgess[playerid]+1, TotalCP, RaceType); if(IsOdd(playerid)) Index2 = 1; else Index2 = 0; switch(Index2) { case 0: { if(PlayersCount[0] == 1) { RaceVehCoords[0][0] -= (6 * floatsin(-RaceVehCoords[0][3], degrees)); RaceVehCoords[0][1] -= (6 * floatcos(-RaceVehCoords[0][3], degrees)); CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2, RaceVehCoords[0][3], random(126), random(126), (60 * 60)); SetPlayerPos(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2); SetPlayerFacingAngle(playerid, RaceVehCoords[0][3]); PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0); Camera(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2], RaceVehCoords[0][3], 20); } } case 1: { if(PlayersCount[1] == 1) { RaceVehCoords[1][0] -= (6 * floatsin(-RaceVehCoords[1][3], degrees)); RaceVehCoords[1][1] -= (6 * floatcos(-RaceVehCoords[1][3], degrees)); CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2, RaceVehCoords[1][3], random(126), random(126), (60 * 60)); SetPlayerPos(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2); SetPlayerFacingAngle(playerid, RaceVehCoords[1][3]); PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0); Camera(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2], RaceVehCoords[1][3], 20); } } } switch(Index2) { case 0: { if(PlayersCount[0] != 1) { CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2, RaceVehCoords[0][3], random(126), random(126), (60 * 60)); SetPlayerPos(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2); SetPlayerFacingAngle(playerid, RaceVehCoords[0][3]); PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0); Camera(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2], RaceVehCoords[0][3], 20); PlayersCount[0] = 1; } } case 1: { if(PlayersCount[1] != 1) { CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2, RaceVehCoords[1][3], random(126), random(126), (60 * 60)); SetPlayerPos(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2]+2); SetPlayerFacingAngle(playerid, RaceVehCoords[1][3]); PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0); Camera(playerid, RaceVehCoords[1][0], RaceVehCoords[1][1], RaceVehCoords[1][2], RaceVehCoords[1][3], 20); PlayersCount[1] = 1; } } } new string[128]; #if defined RACE_IN_OTHER_WORLD SetPlayerVirtualWorld(playerid, 10); #endif InfoTimer[playerid] = SetTimerEx("TextInfo", 500, 1, "e", playerid); if(JoinCount == 1) format(string, sizeof(string), "RaceName: ~w~%s~n~~p~~h~Checkpoint: ~w~%d/%d~n~~b~~h~RaceTime: ~w~%s~n~~y~RacePosition: ~w~1/1~n~ ", RaceName, CPProgess[playerid], TotalCP, TimeConvert(RaceTime)); else format(string, sizeof(string), "RaceName: ~w~%s~n~~p~~h~Checkpoint: ~w~%d/%d~n~~b~~h~RaceTime: ~w~%s~n~~y~RacePosition: ~w~%d/%d~n~ ", RaceName, CPProgess[playerid], TotalCP, TimeConvert(RaceTime), RacePosition[playerid], JoinCount); TextDrawSetString(RaceInfo[playerid], string); //TextDrawShowForPlayer(playerid, RaceInfo[playerid]); JoinCount++; return 1; }
if(PlayersCount[0] == 1) { RaceVehCoords[0][0] -= (6 * floatsin(-RaceVehCoords[0][3], degrees)); RaceVehCoords[0][1] -= (6 * floatcos(-RaceVehCoords[0][3], degrees)); SetVehicleVirtualWorld(GetPlayerVehicleID(playerid ), 10),CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2, RaceVehCoords[0][3], random(126), random(126), (60 * 60)); SetPlayerPos(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2); SetPlayerFacingAngle(playerid, RaceVehCoords[0][3]); PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0); Camera(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2], RaceVehCoords[0][3], 20); }
if(PlayersCount[0] == 1) { SetVehicleVirtualWorld(GetPlayerVehicleID(playerid ), 10); RaceVehCoords[0][0] -= (6 * floatsin(-RaceVehCoords[0][3], degrees)); RaceVehCoords[0][1] -= (6 * floatcos(-RaceVehCoords[0][3], degrees)); CreatedRaceVeh[playerid] = CreateVehicle(RaceVehicle, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2, RaceVehCoords[0][3], random(126), random(126), (60 * 60)); SetPlayerPos(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2]+2); SetPlayerFacingAngle(playerid, RaceVehCoords[0][3]); PutPlayerInVehicle(playerid, CreatedRaceVeh[playerid], 0); Camera(playerid, RaceVehCoords[0][0], RaceVehCoords[0][1], RaceVehCoords[0][2], RaceVehCoords[0][3], 20);
SetVehicleVirtualWorld(CreatedRaceVeh[playerid], 10);//Luego de crear el vehiculo
Eso pasa porque no tienes ni idea de lo que el codigo hace. Te sugiero para evitarte futuros problemas como este que cuando uses un codigo, intentes al menos comprender que es lo que hace sin necesidad de testearlo.
pawn Код:
|