So I made a simple script which is pretty self explanatory,
if you type /rollw
the driver and passenger windows roll down, type it again, and they go up!
_resource.lua
-- RollWindows written by JAF
-- Made for www.lacountyrp.com
-- Version 1.0.0
resource_manifest_version '77731fab-63ca-442c-a67b-abc70f28dfa5' --(Thank you @Vespura)
-- Add a client script
client_script 'client.lua'
client.lua
local windowup = true
RegisterNetEvent("RollWindow")
AddEventHandler('RollWindow', function()
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) then
local playerCar = GetVehiclePedIsIn(playerPed, false)
if ( GetPedInVehicleSeat( playerCar, -1 ) == playerPed ) then
SetEntityAsMissionEntity( playerCar, true, true )
if ( windowup ) then
RollDownWindow(playerCar, 0)
RollDownWindow(playerCar, 1)
TriggerEvent('chatMessage', '', {255,0,0}, 'Windows down')
windowup = false
else
RollUpWindow(playerCar, 0)
RollUpWindow(playerCar, 1)
TriggerEvent('chatMessage', '', {255,0,0}, 'Windows up')
windowup = true
end
end
end
end )
RegisterCommand("rollw", function(source, args, raw)
TriggerEvent("RollWindow")
end, false) --False, allow everyone to run it(thnx @Havoc)
You know you can make this thing entirely client-side right? Just remove the “chatMessage” handler on the server and use the RegisterCommandnative on the client.
Also, it’s bad practice to have no manifest version for the resource. You should at least use 77731fab-63ca-442c-a67b-abc70f28dfa5.
This is the editied version of this script. All i did is removing the print in chat as it’s annoying and i added a toggle for arrow down. So press once windows are down then press again and they are upclient.lua (808 Bytes) replace client.lua with the one i provided