Jump to content

[Help] Vehicle window


Dimos7

Recommended Posts

Hello guys i have a probelm with my script i make a script roll down vehicle windows up and down and have  a message apear for that the problem is i make it so in some type of vehicle and names not work but still apear that message it will be a lot of help if you tell me what is wrong still apear it no errors or warning in debugscript

function toggleWindows()
    for _, v in ipairs(getElementsByType("player")) do
       local car = getPedOccupiedVehicle(v)
	   local seat = getPedOccupiedVehicleSeat(v)
	   if isPedInVehicle(v) then
	       if getVehicleType(car) ~= "Plane" or getVehicleType(car) ~= "Train" or getVehicleType(car) ~= "Bike" or getVehicleType(car) ~= "Boat"  or getVehicleType(car) ~= "BMX" or getVehicleType(car) ~= "Quad Quadbikes"  or getVehicleType(car) ~= "Trailer"  or getVehicleName(car) ~="Caddy" or getVehicleName(car) ~="Bandito"  then
	           if getPedOccupiedVehicleSeat(localPlayer) == 0 then
	               if not isVehicleWindowOpen(car, 4) and not isVehicleWindowOpen(car, 2) and not isVehicleWindowOpen(car, 5) and not isVehicleWindowOpen(car, 3) then
	                   setVehicleWindowOpen(car, 4, true)
	                   setVehicleWindowOpen(car, 2, true)
	                   setVehicleWindowOpen(car, 5, true)
	                   setVehicleWindowOpen(car, 3, true)
				       triggerServerEvent("updateChat", localPlayer, "rolls down the windows of the ".. getVehicleName(car)..".")
	               else
	                  setVehicleWindowOpen(car, 4, false)
	                  setVehicleWindowOpen(car, 2, false)
	                  setVehicleWindowOpen(car, 5, false)
	                  setVehicleWindowOpen(car, 3, false)
				      triggerServerEvent("updateChat", localPlayer, "rolls up the windows of the "..getVehicleName(car)..".")
                   end
				else
				   outputChatBox("You are not the driver", 255, 0, 0)
				end
			else
	         outputChatBox("This vehicle is not have windows.", 255, 0, 0)
	      end
		else
		  outputChatBox("You are not inside a vehicle.", 255, 0, 0)
	   end
    end
end
addCommandHandler("wdall", toggleWindows)

local seatWindows = {
  [0] = 4,
  [1] = 2,
  [2] = 5,
  [3] = 3
}

function toggleWindow()
    for _, v in ipairs(getElementsByType("player")) do
	   local car = getPedOccupiedVehicle(v)
       local seat = getPedOccupiedVehicleSeat(v)
	   if isPedInVehicle(v) then
	      if getVehicleType(car) ~= "Plane" or getVehicleType(car) ~= "Train" or getVehicleType(car) ~= "Bike" or getVehicleType(car) ~= "Boat"  or getVehicleType(car) ~= "BMX" or getVehicleType(car) ~= "Quad Quadbikes"  or getVehicleType(car) ~= "Trailer"  or getVehicleName(car) ~="Caddy" or getVehicleName(car) ~="Bandito"  then
	         if  not isVehicleWindowOpen(car, seatWindows[seat]) then
		         setVehicleWindowOpen(car, seatWindows[seat], true)
				 triggerServerEvent("updateChat", localPlayer, "rolls down their window.")
		     else
		        setVehicleWindowOpen(car, seatWindows[seat], false)
				triggerServerEvent("updateChat", localPlayer, "rolls up their window.")
		     end
	      else
	         outputChatBox("This vehicle is not have windows.", 255, 0, 0)
	      end
		else
		  outputChatBox("You are not inside a vehicle.", 255, 0, 0)
	   end
    end
end
addCommandHandler("wd", toggleWindow)

 

Link to comment
  • 4 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...