removes player from player-owned Journeys when they disconnect

This commit is contained in:
Damen 2019-01-25 00:02:36 -05:00
parent 130f1c581e
commit b9066187e6
2 changed files with 32 additions and 1 deletions

View File

@ -518,3 +518,30 @@ stock GetPlayerCausticSoda( playerid ) return p_CausticSoda{ playerid };
stock SetPlayerCausticSoda( playerid, amount ) { stock SetPlayerCausticSoda( playerid, amount ) {
p_CausticSoda{ playerid } = amount; p_CausticSoda{ playerid } = amount;
} }
stock RemovePlayersFromJourney( vehicleID )
{
new Float: x, Float: y, Float: z;
foreach ( new playerid : Player )
{
if ( GetPlayerVirtualWorld( playerid ) == ( vehicleID + VW_METH ) && !p_Spectating{ playerid } )
{
haltMethamphetamine( playerid, vehicleID );
GetVehiclePos( vehicleID, x, y, z );
SetPlayerPos( playerid, x, y, z );
SetPlayerInterior( playerid, 0 );
SetPlayerVirtualWorld( playerid, 0 );
p_MuriaticAcid{ playerid } = 0;
p_CausticSoda{ playerid } = 0;
p_Methamphetamine{ playerid } = 0;
p_HydrogenChloride{ playerid } = 0;
SendServerMessage( playerid, "You have been removed from a player-owned Journey as the player who owned it has left the server." );
}
}
return 1;
}

View File

@ -846,7 +846,11 @@ stock dischargeVehicles( playerid )
if ( p_OwnedVehicles[ playerid ] ) if ( p_OwnedVehicles[ playerid ] )
{ {
for( new v; v < MAX_BUYABLE_VEHICLES; v++ ) for( new v; v < MAX_BUYABLE_VEHICLES; v++ )
DestroyBuyableVehicle( playerid, v, .db_remove = false ); {
if ( g_vehicleData[ playerid ][ v ][ E_MODEL ] == 508 ) RemovePlayersFromJourney( g_vehicleData[ playerid ][ v ][ E_VEHICLE_ID ] );
DestroyBuyableVehicle( playerid, v, .db_remove = false );
}
} }
return 1; return 1;
} }