08.09.2011, 16:21
(
Последний раз редактировалось AirKite; 11.09.2011 в 14:17.
)
Compatible Upgrades Function's
Version: 1.2
History:Version: 1.2
[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
*/
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++;
}
}
////////////////////////////////////////////////////////////////////////////////////////////
http://solidfiles.com/d/5947/