Jump to content

[HELP] Script Errors


BolonZX

Recommended Posts

Posted

So I'm making this script which consists of a moving steering wheel, however I'm having a few issues

D2BgIX6.png

this is the code:

client

local theWheel = steer_dummy 
  
  
function SteerLeftDown(theVeh, player) 
    local targetPlayer = getLocalPlayer (player) 
    if isPedInVehicle(targetPlayer) then 
        local rx, ry, rz = getVehicleComponentRotation(theVeh, "theWheel") 
        setVehicleComponentRotation(theVeh, "theWheel", rx+1, ry, rz) 
    end 
end 
  
function SteerLeftUp(theVeh, player) 
    local targetPlayer = getLocalPlayer (player) 
    if isPedInVehicle(targetPlayer) then 
        local rx, ry, rz = getVehicleComponentRotation(theVeh, "theWheel") 
        setVehicleComponentRotation(theVeh, "theWheel", rx+1, ry, rz) 
    end 
end 
     
--# Right    
function SteerRightDown(theVeh, player) 
    local targetPlayer = getLocalPlayer (player) 
    if isPedInVehicle(targetPlayer) then 
        local rx, ry, rz = getVehicleComponentRotation(theVeh, "theWheel") 
        setVehicleComponentRotation(theVeh, "theWheel", rx-1, ry, rz) 
    end 
end 
         
function SteerRightUp(theVeh, player) 
    local targetPlayer = getLocalPlayer (player) 
    if isPedInVehicle(targetPlayer) then 
        local rx, ry, rz = getVehicleComponentRotation(theVeh, "theWheel") 
        setVehicleComponentRotation(theVeh, "theWheel", rx-1, ry, rz) 
    end 
end  
  
bindKey("vehicle_left", "down", SteerLeftDown) 
bindKey("vehicle_left", "up", SteerLeftUp) 
bindKey("vehicle_right", "down", SteerRightDown) 
bindKey("vehicle_right", "up", SteerRightUp) 
  

In-game name: |-FMJ-|

Posted

I recommend you to read the wiki page.

Many things wrong:

- Key names

- getLocalPlayer you don't know how to use it

- there is no vehicle in your code you need to check it using getPedOccupiedVehicle.

- Wrong Arguments

Example

function FunctionName(key, keyState) 
    if isPedInVehicle(localPlayer) then 
        local vehicle = getPedOccupiedVehicle (localPlayer) 
            if vehicle then  
            local rx, ry, rz = getVehicleComponentRotation(vehicle, "......") 
                if key == "arrow_l" then  
                    -- Your code here 
                elseif key == "arrow_r" then  
                    -- same thing here 
            end 
        end 
    end  
end  
bindKey("arrow_l", "both", FunctionName) 
bindKey("arrow_r", "both", FunctionName) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

Thank you, the code is much more cleaner now, however it doesn't work I will have try using other functions but at least the dummy works :D

n5ERMgO.png?1

4Txy1Qj.png?1

DoJSxfP.png?1

In-game name: |-FMJ-|

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