[Include] Vehicle Control | 0.0.1
#1

This is an outdated version. Go here for the newest version http://forum.sa-mp.com/showthread.ph...32#post2672032

Vehicle Control

Greetings SAMP Community.
I have made an include which allows to the scripter to control vehicle parts much easier & faster.

How to import the include to my filterscript/gamemode?
Add this line at the top of your gamemode
pawn Код:
#include <vehiclecontrol>
Current Functions
pawn Код:
TurnVehicleEngineOn(vehicleid); // Turns on the vehicle engine
TurnVehicleEngineOff(vehicleid); // Turns off the vehicle engine
OpenBonnet(vehicleid); // Opens your vehicle bonnet.
CloseBonnet(vehicleid); // Closes your vehicle bonnet.
OpenBoot(vehicleid); // Opens your vehicle boot.
CloseBoot(vehicleid); // Closes your vehicle boot.
LockVehicle(vehicleid); // Locks your current vehicle.
UnlockVehicle(vehicleid); // Unlocks your current vehicle
TurnOnVehicleLights(vehicleid); // Turns on your vehicle Lights
TurnOffVehicleLights(vehicleid); // Turns off your vehicle Lights
TurnOnAlarm(vehicleid); // Turns on the Alarm of the vehicle
TurnOffAlarm(vehicleid); // Turns off the Alarm of the vehicle
VehicleID(playerid); // Gets the ID of the vehicle you are currently inside
IsVehicleEngineOn // Will Check if the engine is on
IsVehicleLightsOn // Will Check if the lights is on
IsBonnetOpen // Will Check if the bonnet is open
IsBootOpen // Will Check if the boot is open
IsAlarmOn // Will check if the alarm is on
DeleteVehicle(vehicleid); // Will delete your current vehicle
SpawnVehicle(vehicleid); // Will spawn the vehicleid in your current position
Upcoming Functions on Update 0.0.3
pawn Код:
AddNitroEx(vehicleid); // Will install nitro to the car
AddHydraulicsEx(vehicleid); // Will install hydraulics to the car
RemoveNitroEx(vehicleid); // Will remove nitro from the car
RemoveHydraulicsEx(vehicleid); // Will remove hydraulics from the car
TeleportVehicleTo(playerid); // Will teleport the vehicle to the given player id
DeleteAllVehicles(); // Will delete all the vehicles from the game
EjectPlayersFromVehicle(); // Will eject other players out of your vehicle
IsPlayerNearVehicle(playerid, vehicleid) // Will check if the player is range of a vehicle
Usage Example
pawn Код:
// Version 0.0.1
CMD:engine(playerid, params[])
{
TurnOnVehicleEngine(VehicleID(playerid));
return 1;
}

// Version 0.0.2
public OnFilterScriptInit()
{
RepairAllVehicles(); // Once the Filterscript is loaded all the vehicles will get fixed
return 1;
}

CMD:engine(playerid, params[])
{
if(IsVehicleEngineOn(VehicleID(playerid)) return SendClientMessage(playerid, -1, "Your engine is already on");
else return SendClientMessage(playerid, -1, "Engine turned on!");
return 1;
}

CMD:deletemyvehicle(playerid, params[])
{
DeleteVehicle(playerid); // Deletes your current vehicle
return 1;
}

CMD:spawnturismo(playerid, params[])
{
SpawnVehicle(playerid, 451); // Spawns vehicle ID 451( Turismo ) at your position
return 1;
}
Possible Bugs
TurnOnVehicleLights might be a bit bugged.

Download
Currently I will upload it in pastebin

Version 0.0.2
Pastebin

Version 0.0.1
Pastebin

Feel free to leave a feedback & suggestions.
Reply
#2

Very Unique and Great Peace of WOrk
Thumbps up for it ^^
Reply
#3

Fucking great.
Reply
#4

Thanks guys. I already started improving it :P
Reply
#5

pawn Код:
public VehicleID(playerid)
{
    new veh = GetPlayerVehicleID(playerid);
    #pragma unused veh
    return veh;
}
Can be simply

pawn Код:
stock VehicleID(playerid) return GetPlayerVehicleID(playerid);
Nice job though
Reply
#6

Vehicle Control | 0.0.2 is out!

New Functions
pawn Код:
IsVehicleEngineOn // Will Check if the engine is on
IsVehicleLightsOn // Will Check if the lights is on
IsBonnetOpen // Will Check if the bonnet is open
IsBootOpen // Will Check if the boot is open
IsAlarmOn // Will check if the alarm is on
DeleteVehicle(vehicleid); // Will delete your current vehicle
SpawnVehicle(vehicleid); // Will spawn the vehicleid in your current position
Usage
pawn Код:
// Version 0.0.2
public OnFilterScriptInit()
{
RepairAllVehicles(); // Once the Filterscript is loaded all the vehicles will get fixed
return 1;
}

CMD:engine(playerid, params[])
{
if(IsVehicleEngineOn(VehicleID(playerid)) return SendClientMessage(playerid, -1, "Your engine is already on");
else return SendClientMessage(playerid, -1, "Engine turned on!");
return 1;
}

CMD:deletemyvehicle(playerid, params[])
{
DeleteVehicle(playerid); // Deletes your current vehicle
return 1;
}

CMD:spawnturismo(playerid, params[])
{
SpawnVehicle(playerid, 451); // Spawns vehicle ID 451( Turismo ) at your position
return 1;
}
For more informations check the first post
Reply
#7

Would be great if you added something like 'IsPlayerNearVehicle', however, again, this is great.
Reply
#8

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
pawn Код:
stock VehicleID(playerid) return GetPlayerVehicleID(playerid);
pawn Код:
#define VehicleID GetPlayerVehicleID
Reply
#9

Quote:
Originally Posted by TheArcher
Посмотреть сообщение
pawn Код:
public VehicleID(playerid)
{
    new veh = GetPlayerVehicleID(playerid);
    #pragma unused veh
    return veh;
}
Can be simply

pawn Код:
stock VehicleID(playerid) return GetPlayerVehicleID(playerid);
Nice job though
pawn Код:
#define VehicleID(%0) GetPlayerVehicleID(%0)
Reply
#10

Quote:
Originally Posted by FireCat
Посмотреть сообщение
pawn Код:
#define VehicleID(%0) GetPlayerVehicleID(%0)
In that case the speed is not noticeble.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)