if(HireCar[playerid] != 299) { gLastDriver[HireCar[playerid]] = 300; gCarLock[HireCar[playerid]] = 0; UnLockCar(HireCar[playerid]); if(reason != 0) { SetVehicleToRespawn(HireCar[playerid]); } }
else if(PlayerToPoint(5.0,playerid,2055.9575,-1924.6010,13.4655)) { new Float:health; new veh; veh = GetPlayerVehicleID(playerid); GetVehicleHealth(veh, health); if(health >= 800.0) { SendClientMessage(playerid,COLOR_GREEN,"STAATUS: Auto On Peaaegu Terve, Test Lдbitud."); PlayerInfo[playerid][pCarLic] = 1; SetVehicleToRespawn(veh); DrivingTest[playerid] = 0; DisablePlayerCheckpoint(playerid); } else { SendClientMessage(playerid,COLOR_RED,"STAATUS: Sa Ei Lдbinud Testi, Ehk Veab Teinekord Paremini!"); SetVehicleToRespawn(veh); DrivingTest[playerid] = 0; DisablePlayerCheckpoint(playerid); } DrivingStep[playerid] = 0; }
else if(level >= 401) { new money = 6000; format(string, sizeof(string), "You sold a car for $%d, your reload time is 12 minutes.", money); SendClientMessage(playerid, COLOR_WHITE, string); SafeGivePlayerMoney(playerid, money); PlayerInfo[playerid][pCarTime] = 720; } GameTextForPlayer(playerid, "~y~Sold the car", 2500, 1); CP[playerid] = 0; DisablePlayerCheckpoint(playerid); SetVehicleToRespawn(GetPlayerVehicleID(playerid));
if (IsABus(vehicleid) && GetPlayerState(i) == 2 && PlayerInfo[i][pJob] != 14) { SetVehicleToRespawn(vehicleid); }
else if(UnloadTankerTime[i] == 15) { UnloadTankerTime[i] = 0; TogglePlayerControllable(i, 1); Gas[tmpcar] = GasMax; SetVehicleToRespawn(GetPlayerVehicleID(i)); SetVehicleToRespawn(tmptrailer); }
for(new v=0; v<MAX_VEHICLES; v++) { SetVehicleToRespawn(v); // Respawnib autosi }
public BusrouteEnd(playerid, vehicleid) { if (BusrouteEast[playerid][0] != 0 || BusrouteWest[playerid][0] != 0) { SendClientMessage(playerid, COLOR_BLUE, "Bus route ended."); GameTextForPlayer(playerid, "~r~Bus Route Ended", 5000, 3); PlayerPlaySound(playerid, 1055, 0.0, 0.0, 0.0); } DisablePlayerCheckpoint(playerid); if (vehicleid != 0) SetVehicleToRespawn(vehicleid); BusrouteEast[playerid][0] = 0; BusrouteEast[playerid][1] = 0; //BusrouteEast[playerid][2] = 0; BusrouteWest[playerid][0] = 0; BusrouteWest[playerid][1] = 0; //BusrouteWest[playerid][2] = 0; return 1; }
Originally Posted by Joe_
Run a BLANK script and try it, if the bug doesn't remain, it's a bug within your gamemode, if it does remain, post this in 'Bug Reports' thread.
|
stock IsVehicleOccupied(vehicleid)
{
for(new i; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && GetPlayerVehicleID(i) == vehicleid) return 1;
}
return 0;
Originally Posted by _Jay_
How would (inefficiently) checking if a vehicle is occupied resolve the problem?
It could be anything - check OnPlayerInteriorChange and OnPlayerEnterExitModShop. The vehicle may not necessary be respawning. Debug OnVehicleSpawn. |
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid) { if((newinteriorid == 5 || newinteriorid == 2 || newinteriorid == 12) && GetPlayerVirtualWorld(playerid) == 0) SetPlayerVirtualWorld(playerid, 1); if((oldinteriorid == 5 || oldinteriorid == 2 || oldinteriorid == 12) && newinteriorid == 0 && GetPlayerVirtualWorld(playerid) == 1) SetPlayerVirtualWorld(playerid, 0); return 1; }