SA-MP Forums Archive
[Include] Vehicle Control | 0.0.1 - 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] Vehicle Control | 0.0.1 (/showthread.php?tid=364004)



Vehicle Control | 0.0.2 - Alexis1999 - 29.07.2012

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.



Re: Vehicle Control | 0.0.1 - Niko_boy - 29.07.2012

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


Re: Vehicle Control | 0.0.1 - Blunt - 29.07.2012

Fucking great.


Re: Vehicle Control | 0.0.1 - Alexis1999 - 29.07.2012

Thanks guys. I already started improving it :P


Re: Vehicle Control | 0.0.1 - TheArcher - 29.07.2012

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


Re: Vehicle Control | 0.0.2 - Alexis1999 - 29.07.2012

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


Re: Vehicle Control | 0.0.1 - Blunt - 29.07.2012

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


Re: Vehicle Control | 0.0.1 - s0up - 29.07.2012

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



Re: Vehicle Control | 0.0.1 - FireCat - 29.07.2012

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)



Re: Vehicle Control | 0.0.1 - TheArcher - 29.07.2012

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