SA-MP Forums Archive
[Include] [INC] Vehicle functions v0.2.1 R2 - 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] [INC] Vehicle functions v0.2.1 R2 (/showthread.php?tid=243814)



[INC] Vehicle functions v0.2.1 R2 - kurta999 - 24.03.2011

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;
}



Re: [INC] Vehicle functions v0.2.1 R2 - Lukas5852 - 24.03.2011

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


Re: [INC] Vehicle functions v0.2.1 R2 - s1k - 24.03.2011

Looks useful, nice.


Re: [INC] Vehicle functions v0.2.1 R2 - kurta999 - 24.03.2011

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


Re: [INC] Vehicle functions v0.2.1 R2 - Lukas5852 - 24.03.2011

It looks useful,Thanks


Re: [INC] Vehicle functions v0.2.1 R2 - gamer931215 - 25.03.2011

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


Re: [INC] Vehicle functions v0.2.1 R2 - Ironboy - 25.03.2011

Awesome


Re: [INC] Vehicle functions v0.2.1 R2 - [ProX]BlueFire - 25.03.2011

can u give an eximple?


Re: [INC] Vehicle functions v0.2.1 R2 - kurta999 - 25.03.2011

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");

}