Old bug - Not fixed - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP (
https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (
https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread:  Old bug - Not fixed (
/showthread.php?tid=405933)
 
Old bug - Not fixed - 
Kyle -  08.01.2013
This was attempted to fix in RC2 of 0.3e.
"- Fixed bug where the player might get teleported to 0,0,0 if they're surfing a vehicle that gets respawned/deleted."
This doesn't work for trains with no carridges.
Re: Old bug - Not fixed - 
Kyle -  09.03.2015
bump.
Re: Old bug - Not fixed - 
Abagail -  09.03.2015
pawn Code:
stock SetVehicleToRespawnEx(vehicleid)
{
    if(vehicleid == INVALID_VEHICLE_ID) return SetVehicleToRespawn(vehicleid);
    if(GetVehicleModel(vehicleid) == 537 || GetVehicleModel(vehicleid) == 538 || GetVehicleModel(vehicleid) == 449)
    {
        for (new i = 0; i != MAX_PLAYERS; ++i)
        {
            if(IsPlayerConnected(i))
            {
                if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID && GetPlayerSurfingVehicleID(playerid) == vehicleid)
                {
                    GetPlayerPos(playerid, x, y, z);
                    SetPlayerPos(playerid, x+2.5, x, y, z+0.5);
                    
                    continue;
                }
            }
        }
        
        return SetVehicleToRespawn(vehicleid);
    }
}
#if defined _ALS_SetVehicleToRespawn
  #undef SetVehicleToRespawn
#else
#define _ALS_SetVehicleToRespawn
#endif
#define SetVehicleToRespawn SetVehicleToRespawnEx
stock DestroyVehicleEx(vehicleid)
{
    if(vehicleid == INVALID_VEHICLE_ID) return DestroyVehicle(vehicleid);
    if(GetVehicleModel(vehicleid) == 537 || ( GetVehicleModel (vehicleid )) == 538 || GetVehicleModel(vehicleid) == 449)
    {
        for (new i = 0; i != MAX_PLAYERS; ++i)
        {
            if(IsPlayerConnected(i))
            {
                if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID && GetPlayerSurfingVehicleID(playerid) == vehicleid)
                {
                    GetPlayerPos(playerid, x, y, z);
                    SetPlayerPos(playerid, x+2.5, x, y, z+0.5);
                    continue;
                }
            }
        }
        return DestroyVehicle(vehicleid);
    }
}
#if defined _ALS_DestroyVehicle
  #undef DestroyVehicle
#else
#define _ALS_DestroyVehicle
#endif
#define DestroyVehicle DestroyVehicleEx
 
Basically set's their position off a bit and completes the operation, this isn't tested but is a possible fix.
Re: Old bug - Not fixed - 
Kyle -  10.03.2015
Quote:
| 
					Originally Posted by Abagail  
pawn Code: stock SetVehicleToRespawnEx(vehicleid){
 if(vehicleid == INVALID_VEHICLE_ID) return SetVehicleToRespawn(vehicleid);
 if(vehicleid == 537 || vehicleid == 538 || vehicleid == 449)
 {
 for (new i = 0; i != MAX_PLAYERS; ++i)
 {
 if(IsPlayerConnected(i))
 {
 if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID && GetPlayerSurfingVehicleID(playerid) == vehicleid)
 {
 GetPlayerPos(playerid, x, y, z);
 SetPlayerPos(playerid, x+2.5, x, y, z+0.5);
 
 continue;
 }
 }
 }
 
 return SetVehicleToRespawn(vehicleid);
 }
 }
 
 #if defined _ALS_SetVehicleToRespawn
 #undef SetVehicleToRespawn
 #else
 #define _ALS_SetVehicleToRespawn
 #endif
 
 #define SetVehicleToRespawn SetVehicleToRespawnEx
 
 stock DestroyVehicleEx(vehicleid)
 {
 if(vehicleid == INVALID_VEHICLE_ID) return DestroyVehicle(vehicleid);
 if(vehicleid == 537 || vehicleid == 538 || vehicleid == 449)
 {
 for (new i = 0; i != MAX_PLAYERS; ++i)
 {
 if(IsPlayerConnected(i))
 {
 if(GetPlayerSurfingVehicleID(playerid) != INVALID_VEHICLE_ID && GetPlayerSurfingVehicleID(playerid) == vehicleid)
 {
 GetPlayerPos(playerid, x, y, z);
 SetPlayerPos(playerid, x+2.5, x, y, z+0.5);
 
 continue;
 }
 }
 }
 
 return DestroyVehicle(vehicleid);
 }
 }
 
 #if defined _ALS_DestroyVehicle
 #undef DestroyVehicle
 #else
 #define _ALS_DestroyVehicle
 #endif
 
 #define DestroyVehicle DestroyVehicleEx
 
Basically set's their position off a bit and completes the operation, this isn't tested but is a possible fix. | 
 What about when OnVehicleDeath is called because the car died or went into water.