[Include] [INC] Vehicle functions v0.2.1 R2
#1

Vehicle Functions
This is very useful include. I took some functions from MTA, and some written by me. It's not irregular, because MTA is open source project.

Changes:

0.2.1:

• Added GetVehicleName.
• Added GetVehicleModelIDFromName
R2: Some bug fixes.

0.2:

• Added GetVehicleParamsEx bug fix.
• Added GetVehicleInterior.
• Added GetVehicleColor.
• Added GetVehiclePaintjob.

0.1.1:

• Added IsLicensePlate.
• Added GetVehicleComponentTypeName.


Functions:
pawn Код:
native IsValidVehicle(vehicleid);
native IsValidModel(modelid);
native IsUpgrade(modelid);
native GetVehicleType(modelid);
native GetMaxPassengers(modelid);
native IsUpgradeCompatible(_Model, _Upgrade);
native IsLicensePlate(vehicleid);
native GetVehicleComponentTypeName(component);
native GetVehicleInterior(vehicleid);
native GetVehicleColor(vehicleid, color1, color2);
native GetVehiclePaintjob(vehicleid);
native GetVehicleName(vehicleid);
native GetVehicleModelIDFromName(const vname[]);
Download:

Click
Hungarian Version
GVar Plugin You need this plugin, without this not work.

Note:

You must put this in your code.
pawn Код:
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
    SetGVarInt("CarColor_1", color1, vehicleid);
    SetGVarInt("CarColor_2", color2, vehicleid);
    return 1;
}

public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
    SetGVarInt("Veh_Paintjob", paintjobid, vehicleid);
    return 1;
}

public OnVehicleSpawn(vehicleid)
{
    SetGVarInt("Bonnet_Ex", VEHICLE_PARAMS_UNSET, vehicleid);
    SetGVarInt("Boot_Ex", VEHICLE_PARAMS_UNSET, vehicleid);
    return 1;
}
Reply
#2

Sorry,but what can do with this include,can it be useful for rp?Sorry for my questions,i just start scripting
Reply
#3

Looks useful, nice.
Reply
#4

I'm use this like default functions. But good for RP, and everywhere.

You can get what the vehicle color, paintjob, interior.
You can check, if the component is works with vehicle. etc...
Reply
#5

It looks useful,Thanks
Reply
#6

Nice functions.. could have been usefull for pVehicle if you released it earlyer hehe.
Reply
#7

Awesome
Reply
#8

can u give an eximple?
Reply
#9

Example:

pawn Код:
// Set vehicle license plate, when this have.
if(IsLicensePlate(vehicleid))
{
    SetVehicleNumberPlate(vehicleid, "MyPlate");
}
pawn Код:
new // Get vehicle color.
    color[2];

    GetVehicleColor(vehicleid, color[0], color[1])
    printf("The vehicle color ( vID: %d ) is: %d & %d, and the paintjob is: %d", vehicleid, color[0], color[1], GetVehiclePaintjob(vehicleid));
pawn Код:
// Get the vehicle type.
if(GetVehicleType(modelid) == VEHICLE_BIKE)
{
    printf("The vehicle is bike");
}
else
{
    printf("The vehicle isn't bike");
}
pawn Код:
// Check the component compatible with vehicle.
if(IsUpgradeCompatible(modelid, componentid))
{
    print("The component works for this vehicle");
}
else
{
    print("Invalid component id");

}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)