[Include] Compatible Upgrades Function's
#1

Compatible Upgrades Function's
Version: 1.2
History:
[v:1.0 ] [07.09.2011] - First release. (Name: GetVehicleCompatibleUpgrades, IncFileName: agvcu.inc)
[v:1.1 ] [08.09.2011] - Include renamed (Name: Compatible Upgrades Function's, IncFileName: acuf.inc)
[v:1.1 ] [08.09.2011] - Added new function (IsVehicleUpgradeCompatible).
[v:1.1 ] [08.09.2011] - Transfer on Switch\Case.
[v:1.2 ] [11.09.2011] - Added new function (GetComponentName). // by BigETI

Description:
This include adds a new functions, which help find compatible upgrades.

Functions
pawn Код:
GetComponentName(componentid)
/*
componentid = The componentid that needs to be added to the vehicle.
returns: String, component name.
*/


IsVehicleUpgradeCompatible(model,componentid)
/*
model = Vehicle model id
componentid = The componentid that needs to be added to the vehicle.
returns: 0 not compatible, 1 compatible
*/


GetVehicleCompatibleUpgrades(model, count, &component = 0)
/*
model = Vehicle model id
count = Watch example :D
component = Variable to store the componentid, passed by reference
returns: componentid
*/
Example:
pawn Код:
////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////// EXAMPLE 1  
    new player_in_car = GetPlayerVehicleID(playerid);
    if(IsVehicleUpgradeCompatible(GetVehicleModel(player_in_car),1014))
    {
        AddVehicleComponent(vehicle, 1014);
    }
/////////////////////////// EXAMPLE 2  
    new component = GetVehicleCompatibleUpgrades(562, 1);
   
/////////////////////////// EXAMPLE 3  
    new component;
    GetVehicleCompatibleUpgrades(562, 1, component);
   
/////////////////////////// EXAMPLE 4  
    for(new vehiclemodel=400; vehiclemodel < 611; vehiclemodel++)
    {
        new component, count=1;
        while(GetVehicleCompatibleUpgrades(vehiclemodel, count, component))
        {
            printf("VehicleModel %d, Compatible with %s [%d] component", vehiclemodel, GetComponentName(component), component);
            count++;
        }
    }
   
////////////////////////////////////////////////////////////////////////////////////////////
Download
http://solidfiles.com/d/5947/
Reply
#2

Looking Nice!!

GOing to test.
Reply
#3

It's a fantastic thing, extremely useful, but not finished.

EDITED: Apologies, part of my post was incorrect.

However, why is the radio not a listed component for them all?
Reply
#4

cool
GJ man!
Reply
#5

Thank's!
Quote:
Originally Posted by Redgie
Посмотреть сообщение
However, why is the radio not a listed component for them all?
It's have effect for all? I do not think so.
Reply
#6

does it work for neon ?
Reply
#7

Quote:
Originally Posted by [US]Kenguru
Посмотреть сообщение
does it work for neon ?
It's work for all gta singleplayer upgrades. Neon it's object, compatible for all, even player head
Reply
#8

Added new function (GetComponentName). // by BigETI
Reply
#9

Thank you very much!!!
I thought that I'll sit days and nights to find compatible components, but you saved me.
And again, THANK YOU!!
Reply
#10

cool
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)