prevent occupied gang vehicle from being spawned

This commit is contained in:
Lorenc Pekaj 2018-11-09 15:45:07 +11:00
parent 65dd9d68d0
commit 6a0ab57505
2 changed files with 10 additions and 2 deletions

View File

@ -210,7 +210,7 @@ stock calculateVehicleSellPrice( vehicleid )
iModel = GetVehicleModel( vehicleid ) iModel = GetVehicleModel( vehicleid )
; ;
if ( !GetVehicleHealth( vehicleid, fHealth ) || !IsCarjackableVehicleModel( iModel ) || g_adminSpawnedCar{ vehicleid } || g_buyableVehicle{ vehicleid } || Iter_Contains( business, g_isBusinessVehicle[ vehicleid ] ) ) if ( !GetVehicleHealth( vehicleid, fHealth ) || !IsCarjackableVehicleModel( iModel ) || g_adminSpawnedCar{ vehicleid } || g_buyableVehicle{ vehicleid } || g_gangVehicle{ vehicleid } || Iter_Contains( business, g_isBusinessVehicle[ vehicleid ] ) )
return 0; return 0;
if ( fHealth > 1000.0 ) if ( fHealth > 1000.0 )

View File

@ -26,7 +26,7 @@
/* ** Constants ** */ /* ** Constants ** */
static const GANG_VEHICLE_PRICE_FACTOR = 4; static const GANG_VEHICLE_PRICE_FACTOR = 4;
static const GANG_VEHICLE_SPAWN_COOLDOWN = 180; static const GANG_VEHICLE_SPAWN_COOLDOWN = 300;
/* ** Variables ** */ /* ** Variables ** */
enum E_GANG_VEHICLE_DATA enum E_GANG_VEHICLE_DATA
@ -282,6 +282,14 @@ hook OnDialogResponse( playerid, dialogid, response, listitem, inputtext[ ] )
return SendError( playerid, "This vehicle cannot be spawned for another %s.", secondstotime( g_gangVehicleData[ gangid ] [ slotid ] [ E_ACTIVATION_TIME ] - current_time ) ); return SendError( playerid, "This vehicle cannot be spawned for another %s.", secondstotime( g_gangVehicleData[ gangid ] [ slotid ] [ E_ACTIVATION_TIME ] - current_time ) );
} }
new
occupierid = IsVehicleOccupied( g_gangVehicleData[ gangid ] [ slotid ] [ E_VEHICLE_ID ] );
if ( occupierid != -1 ) {
GangVehicles_ShowSpawnList( playerid, gangid );
return SendError( playerid, "This vehicle cannot be spawned right now as it is occupied by %s(%d).", ReturnPlayerName( occupierid ), occupierid );
}
new Float: facility_x, Float: facility_y, Float: facility_z, Float: rotation; new Float: facility_x, Float: facility_y, Float: facility_z, Float: rotation;
GetGangFacilityPos( facilityid, facility_x, facility_y, facility_z ); GetGangFacilityPos( facilityid, facility_x, facility_y, facility_z );