Hey, im trying to do a script, that lets you roll down/up all windows individually.
With RollDownWindow/RollUpWindows you can address each window by the window index (0-3).
If i roll down a specific window, its rolls every windows down. If i roll one up, nothing happens.
Can someone help?
There are no errors in the debug and server console.
AddEventHandler("bf_carWindowDown", function(window)
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) then
local playerCar = GetVehiclePedIsIn(playerPed, false)
if window == "rfront" then
RollDownWindow(playerCar, 0)
elseif window == "lfront" then
RollDownWindow(playerCar, 1)
elseif window == "rback" then
RollDownWindow(playerCar, 2)
elseif window == "lback" then
RollDownWindow(playerCar, 3)
else
RollDownWindow(playerCar, 0)
RollDownWindow(playerCar, 1)
end
else
TriggerEvent('chatMessage', "Error", {255, 255, 255}, "You are not inside a vehicle!")
end
end)
RegisterNetEvent('bf_carWindowUp')
AddEventHandler("bf_carWindowUp", function(window)
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) then
local playerCar = GetVehiclePedIsIn(playerPed, false)
if window == "rfront" then
RollUpWindow(playerCar, 0)
elseif window == "lfront" then
RollUpWindow(playerCar, 1)
elseif window == "rback" then
RollUpWindow(playerCar, 2)
elseif window == "lback" then
RollUpWindow(playerCar, 3)
else
RollUpWindow(playerCar, 0)
RollUpWindow(playerCar, 1)
end
else
TriggerEvent('chatMessage', "Error", {255, 255, 255}, "You are not inside a vehicle!")
end
end)