diff --git a/README.md b/README.md index f897334..11b89b7 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,18 @@ # Simple-Vehicle-Control-Script + A simple script which allows you to control certain aspects of your vehicle, such as doors, engine and more... **v0.3.2 Features:** -* **/trunk:** Opens and closes the trunk. -* **/hood:** Opens and closes the hood. -* **/rdoors:** Opens and closes the two rear doors. (Mostly for use in vans) -* **/engine (on/off):** Switches the vehicle engine on and off. -* **/lock:** Locks and unlocks vehicle doors. -* **/save:** (doesn't actually save the vehicle) Selects as the active vehicle. -* **/sveh:** Toggles "control saved vehicle only" mode. (Read changelog for more info) -[Join our discord server!](https://discord.gg/K7P8d2h) --------- +- **/roof:** Raises and lowers convertible roof. +- **/trunk:** Opens and closes the trunk. +- **/hood:** Opens and closes the hood. +- **/rdoors:** Opens and closes the two rear doors. (Mostly for use in vans) +- **/engine (on/off):** Switches the vehicle engine on and off. +- **/lock:** Locks and unlocks vehicle doors. +- **/save:** (doesn't actually save the vehicle) Selects as the active vehicle. +- **/sveh:** Toggles "control saved vehicle only" mode. (Read changelog for more info) + +## [Join our discord server!](https://discord.gg/K7P8d2h) https://forum.fivem.net/t/release-simple-vehicle-control-script/63438 diff --git a/vehicle-control/client.lua b/vehicle-control/client.lua index 36d929a..6391f61 100644 --- a/vehicle-control/client.lua +++ b/vehicle-control/client.lua @@ -7,6 +7,23 @@ engineoff = false saved = false controlsave_bool = false +-- R O O F -- +RegisterNetEvent('roof') +AddEventHandler('roof',function() + local player = GetPlayerPed(-1) + if (IsPedSittingInAnyVehicle(player)) then + local vehicle = GetVehiclePedIsIn(player,false) + local roofstate = GetConvertibleRoofState(vehicle) + if (roofState == 0) then + LowerConvertibleRoof(vehicle, false) + else if (roofState == 2) + RaiseConvertibleRoof(vehicle, false) + else + ShowNotification("~r~Wait for your roof to be fully extended/retracted") + end + end +end) + -- E N G I N E -- IsEngineOn = true RegisterNetEvent('engine') diff --git a/vehicle-control/server.lua b/vehicle-control/server.lua index 7c9dee9..f8c767e 100644 --- a/vehicle-control/server.lua +++ b/vehicle-control/server.lua @@ -1,3 +1,12 @@ +-- R O O F -- +AddEventHandler('chatMessage', function(s, n, m) + local message = string.lower(m) + if message == "/roof" then + CancelEvent() + -------------- + TriggerClientEvent('roof', s) + end +end) -- E N G I N E -- AddEventHandler('chatMessage', function(s, n, m) local message = string.lower(m) @@ -68,4 +77,4 @@ AddEventHandler('chatMessage', function(s, n, m) -------------- TriggerClientEvent('controlsave', s) end -end) \ No newline at end of file +end)