From 1252bb5d89bbbe18793ce6bdde5c1f70a09b567e Mon Sep 17 00:00:00 2001 From: Lorenc Pekaj Date: Wed, 10 Oct 2018 19:03:48 +1100 Subject: [PATCH] move vehicle functions to gta\vehicle_data.pwn --- gamemodes/irresistible/gta/vehicle_data.pwn | 65 +++++++++++++++++++ gamemodes/sf-cnr.pwn | 70 +-------------------- 2 files changed, 68 insertions(+), 67 deletions(-) diff --git a/gamemodes/irresistible/gta/vehicle_data.pwn b/gamemodes/irresistible/gta/vehicle_data.pwn index 4d4f803..5f361b1 100644 --- a/gamemodes/irresistible/gta/vehicle_data.pwn +++ b/gamemodes/irresistible/gta/vehicle_data.pwn @@ -42,6 +42,7 @@ stock const g_aVehicleNames[ 212 ] [ ] = { "Utility Trailer"} }; +/* ** Functions ** */ stock GetVehicleModelFromName( szVehicleName[ ] ) { for( new i = 400; i <= 611; i++ ) @@ -50,3 +51,67 @@ stock GetVehicleModelFromName( szVehicleName[ ] ) return -1; } + +stock IsBoatVehicle(value) +{ + static const valid_values[6] = { + 29425665, -2143286272, 0, 0, 0, 32 + }; + + if (430 <= value <= 595) { + value -= 430; + return (valid_values[value >>> 5] & (1 << (value & 31))) || false; + } + return false; +} + +stock IsAirVehicle(value) +{ + static const valid_values[6] = { + 1073742081, 135268352, -1073676096, 192, 262408, 98305 + }; + + if (417 <= value <= 593) { + value -= 417; + return (valid_values[value >>> 5] & (1 << (value & 31))) || false; + } + return false; +} + +stock IsBikeVehicle(value) +{ + static const valid_values[5] = { + 1105921, 1610612738, 1536, 0, 1056 + }; + + if (448 <= value <= 586) { + value -= 448; + return (valid_values[value >>> 5] & (1 << (value & 31))) || false; + } + return false; +} + +stock IsTrailerVehicle(model) { + static const valid_values[6] = { + 32769, 0, 0, 0, 270532608, 112640 + }; + + if (435 <= model <= 611) { + model -= 435; + return (valid_values[model >>> 5] & (1 << (model & 31))) || false; + } + return false; +} + +stock IsLowriderVehicle(model) +{ + static const valid_values[6] = { + 1, 0, 0, 469762048, 201326592, 24 + }; + + if (412 <= model <= 576) { + model -= 412; + return (valid_values[model >>> 5] & (1 << (model & 31))) || false; + } + return false; +} diff --git a/gamemodes/sf-cnr.pwn b/gamemodes/sf-cnr.pwn index c676e59..529fa6e 100644 --- a/gamemodes/sf-cnr.pwn +++ b/gamemodes/sf-cnr.pwn @@ -13474,70 +13474,6 @@ public OnHelpHTTPResponse( index, response_code, data[ ] ) return 1; } -stock IsBoatVehicle(value) -{ - static const valid_values[6] = { - 29425665, -2143286272, 0, 0, 0, 32 - }; - - if (430 <= value <= 595) { - value -= 430; - return (valid_values[value >>> 5] & (1 << (value & 31))) || false; - } - return false; -} - -stock IsAirVehicle(value) -{ - static const valid_values[6] = { - 1073742081, 135268352, -1073676096, 192, 262408, 98305 - }; - - if (417 <= value <= 593) { - value -= 417; - return (valid_values[value >>> 5] & (1 << (value & 31))) || false; - } - return false; -} - -stock IsBikeVehicle(value) -{ - static const valid_values[5] = { - 1105921, 1610612738, 1536, 0, 1056 - }; - - if (448 <= value <= 586) { - value -= 448; - return (valid_values[value >>> 5] & (1 << (value & 31))) || false; - } - return false; -} - -stock IsTrailerVehicle(model) { - static const valid_values[6] = { - 32769, 0, 0, 0, 270532608, 112640 - }; - - if (435 <= model <= 611) { - model -= 435; - return (valid_values[model >>> 5] & (1 << (model & 31))) || false; - } - return false; -} - -stock IsLowriderVehicle(model) -{ - static const valid_values[6] = { - 1, 0, 0, 469762048, 201326592, 24 - }; - - if (412 <= model <= 576) { - model -= 412; - return (valid_values[model >>> 5] & (1 << (model & 31))) || false; - } - return false; -} - public OnPlayerClickPlayer(playerid, clickedplayerid, source) { return 1; @@ -14358,9 +14294,9 @@ stock SetPlayerColorToTeam( playerid ) default_color = COLOR_DEFAULT; // set color according to wanted level - if ( p_WantedLevel[ playerid ] > 11 ) default_color = COLOR_WANTED12; - else if ( p_WantedLevel[ playerid ] > 5 ) default_color = COLOR_WANTED6; - else if ( p_WantedLevel[ playerid ] > 1 ) default_color = COLOR_WANTED2; + if ( p_WantedLevel[ playerid ] >= 12 ) default_color = COLOR_WANTED12; + else if ( p_WantedLevel[ playerid ] >= 6 ) default_color = COLOR_WANTED6; + else if ( p_WantedLevel[ playerid ] >= 1 ) default_color = COLOR_WANTED2; else if ( p_GangID[ playerid ] != INVALID_GANG_ID ) default_color = g_gangData[ p_GangID[ playerid ] ] [ E_COLOR ]; // set alpha for invisible players to 0