Jump to content

Invisible Wheels


ksTakor

Recommended Posts

Today I used the

setVehicleWheelStates 

and If I set my wheels to fallen off, then set then to inflated again, after that if I fix my vehicle the wheels will be invisible, anyone knows a workaround for this?

It only happens in my script (tested with the wiki script and don't happen)

my script is this:

  
--server--  
local tireOff = getElementData(getElementData(veh,"parent"),"Tire_inVehicle") -- check if there is tires in the vehicle (gamemode element) 
    if tireOff == 0 then 
    setVehicleWheelStates(veh, 2, 2, 2, 2) 
    elseif tireOff == 3 then 
    local wheel = math.random(1, 4) 
        if wheel == 1 then 
        setVehicleWheelStates(veh, 0, 0, 2, 0) 
        elseif wheel == 2 then 
        setVehicleWheelStates(veh, 2, 0, 0, 0) 
        elseif wheel == 3 then 
        setVehicleWheelStates(veh, 0, 0, 0, 2) 
        elseif wheel == 4 then 
        setVehicleWheelStates(veh, 0, 2, 0, 0) 
        end 
    elseif tireOff == 2 then 
    local wheel = math.random(1, 4) 
        if wheel == 1 then 
        setVehicleWheelStates(veh, 2, 0, 2, 0) 
        elseif wheel == 2 then 
        setVehicleWheelStates(veh, 2, 0, 0, 2) 
        elseif wheel == 3 then 
        setVehicleWheelStates(veh, 0, 2, 0, 2) 
        elseif wheel == 4 then 
        setVehicleWheelStates(veh, 0, 2, 2, 0) 
        end 
    elseif tireOff == 1 then 
    local wheel = math.random(1, 4) 
        if wheel == 1 then 
        setVehicleWheelStates(veh, 2, 2, 2, 0) 
        elseif wheel == 2 then 
        setVehicleWheelStates(veh, 2, 0, 2, 2) 
        elseif wheel == 3 then 
        setVehicleWheelStates(veh, 2, 2, 0, 2) 
        elseif wheel == 4 then 
        setVehicleWheelStates(veh, 0, 2, 2, 2) 
        end 
    end 
  

Then when the player add the tires I call an trigger event in the server to put back the wheels:

  
--client-- 
triggerServerEvent("putwheels", resourceRoot, veh) 
  

This is the function that put back the wheels

  
--server-- 
function putwheels (veh) 
    local frontLeft, rearLeft, frontRight, rearRight = getVehicleWheelStates ( veh ) -- testing the wheels which are missing 
    if frontLeft == 2 then 
        setVehicleWheelStates (veh, 0) 
    elseif rearLeft == 2 then 
        setVehicleWheelStates (veh, 0, 0) 
    elseif frontRight == 2 then 
        setVehicleWheelStates (veh, 0, 0, 0) 
    elseif rearRight == 2 then 
        setVehicleWheelStates (veh, 0, 0, 0, 0) 
    end 
end 
addEvent("putwheels", true) 
addEventHandler("putwheels", resourceRoot, putwheels) 
  

if I fix the vehicle after it put back the wheels, makes the wheels invisible:

Gabthft.png

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