Jump to content

Spoiler script is not working


Recommended Posts

Hi guys! I want to make a script that moves the car rear spoiler when i type the command . But it not working :/

Here is the script :

addCommandHandler("spoiler",
    function()
        local theVeh = getPedOccupiedVehicle(localPlayer)
 local getComponent = getVehicleComponents(theVeh) 
  if getComponent == "movspoiler_23.5_1800" then
   if (theVeh) then
    for k in pairs (getComponent) do
   local x, y, z = getVehicleComponentPosition(theVeh, k)
     setVehicleComponentPosition(theVeh, k, x+1, y+1, z+1)
     --outputChatBox(k)
    end
   end
  end
 end

Link to comment
addCommandHandler('spoiler',
  function()
    local theVeh = getPedOccupiedVehicle(localPlayer)
    if (theVeh) then -- if theVeh exists
      local components = getVehicleComponents(theVeh) 
      if components['movspoiler_23.5_1800'] then -- if this component exists in theVeh
        local x, y, z = getVehicleComponentPosition(theVeh, 'movspoiler_23.5_1800')
        setVehicleComponentPosition(theVeh, 'movspoiler_23.5_1800', x+1, y+1, z+1)
        --outputChatBox(k)
      end
    end
  end
)

 

Link to comment

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...