[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


Messages In This Thread
Compatible Upgrades Function's - by AirKite - 08.09.2011, 16:21
AW: Compatible Upgrades Function's - by umarmalik - 08.09.2011, 16:24
Re: Compatible Upgrades Function's - by Redgie - 08.09.2011, 19:25
Re: Compatible Upgrades Function's - by Horrible - 09.09.2011, 01:56
Re: Compatible Upgrades Function's - by AirKite - 10.09.2011, 09:13
Re: Compatible Upgrades Function's - by [US]Kenguru - 10.09.2011, 11:05
Re: Compatible Upgrades Function's - by AirKite - 10.09.2011, 16:14
Re: Compatible Upgrades Function's - by AirKite - 11.09.2011, 14:21
Re: Compatible Upgrades Function's - by SDraw - 20.09.2011, 17:29
Re: Compatible Upgrades Function's - by Leeo_Perez - 20.09.2011, 17:39

Forum Jump:


Users browsing this thread: 1 Guest(s)