[Include] Vehicle Control | Completely rewritten
#1

If you would like to use my old version here https://sampforum.blast.hk/showthread.php?tid=364004

Vehicle Control

After some great response from the previous version I decided to rewrite the include making it even more functional & easier to use then before.

How to import the include to my filterscript/gamemode?
Add this line at the top of your gamemode
pawn Код:
#include <vehiclecontrol>
How to use vehicle control?
The new vehicle control comes with some new functions easy & tidy to use.

Код:
VehicleControl
VCBool
VCCreate
VCCreateEx
Usage
Now you may be wondering, how the heck do I use those functions? Well I'm here to explain .

VehicleControl

Vehicle Control comes with some command actions which you must give. The command actions are not case sensitive meaning either you use CAPS either not it will still work the same.

Now before learning all the available commands you might want to know the syntax of the whole line and that would be.

pawn Код:
VehicleControl(playerid, COMMAND[]);
And a more in depth example

pawn Код:
VehicleControl(playerid, "ActivateEngine");

Current Available Commands ( VehicleControl )

Since the names of the actions are pretty much obvious I dont need to sit explaining one by one and instead I will make a list.

Код:
ActivateEngine, 
DeactivateEngine, 
ActivateLights, 
DeactivateLights, 
EnableAlarm, 
DisableAlarm, 
UnlockVehicle, 
LockVehicle, 
OpenBonnet, 
CloseBonnet, 
OpenBoot, 
CloseBoot
DeleteVehicle
The Function includes a syntax scan method meaning if you type incorrect a command to your script it will return an error message letting you know that the command you wrote does not exist.

VCBool
With VCBool we can get vehicle parts status as for example if the engine is turned on or off. Pretty easy to use aswell.

Correct Usage Example:
pawn Код:
if(VCBool(playerid, "IsVehicleEngineOn")) {
SendClientMessage(playerid, -1, "Your vehicle engine is ON!");
} else {
SendClientMessage(playerid, -1, "Your vehicle engine is OFF!");
}
Available Statements for VCBool
Код:
IsVehicleEngineOn,
IsVehicleLightsOn,
IsVehicleBonnetOpen,
IsVehicleBootOpen,
IsVehicleAlarmOn,
VCCreate
This function creates vehicles to target playerid given either by name or by vehicle ID.

Syntax:
pawn Код:
VCCreate(playerid, VehicleName[], ColorA, ColorB);
Example Usage:
pawn Код:
VCCreate(playerid, "Infernus", 0, 0);
VCCreateEx
This is a more advanced version of VCCreate which allows you to specify the input vehicleid.

Syntax:
pawn Код:
VCCreateEx(playerid, Format[], Vehicle[], ColorA, ColorB);
Example:

Using ZCMD
pawn Код:
CMD:v(playerid, params) {
VCCreateEx(playerid, "%s", params, 0, 0);
}
or if you would like it to work only with numbers

pawn Код:
CMD:v(playerid, params) {
VCCreateEx(playerid, "%i", params, 0, 0);
}
And that should be a very simple vehicle spawner with almost no effort at all!

Hope you like this. Cheers!

Download
http://pastebin.com/DHPxRmd5

Feel free to leave any suggestions you would like to see on future version.
Reply
#2

Nice, it's quite interesting. I'll have a look through it after and test it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)