SA-MP Forums Archive
[Include] Compatible Upgrades Function's - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] Compatible Upgrades Function's (/showthread.php?tid=281906)



Compatible Upgrades Function's - AirKite - 08.09.2011

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/


AW: Compatible Upgrades Function's - umarmalik - 08.09.2011

Looking Nice!!

GOing to test.


Re: Compatible Upgrades Function's - Redgie - 08.09.2011

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?


Re: Compatible Upgrades Function's - Horrible - 09.09.2011

cool
GJ man!


Re: Compatible Upgrades Function's - AirKite - 10.09.2011

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.


Re: Compatible Upgrades Function's - [US]Kenguru - 10.09.2011

does it work for neon ?


Re: Compatible Upgrades Function's - AirKite - 10.09.2011

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


Re: Compatible Upgrades Function's - AirKite - 11.09.2011

Added new function (GetComponentName). // by BigETI


Re: Compatible Upgrades Function's - SDraw - 20.09.2011

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!!


Re: Compatible Upgrades Function's - Leeo_Perez - 20.09.2011

cool