Jump to content

getBoundControls Function


_Evo_

Recommended Posts

try to add below code into the existing script ,

Client Side :-

local controlTable = { "fire", "next_weapon", "previous_weapon", "forwards", "backwards", "left", "right", "zoom_in", "zoom_out",
 "change_camera", "jump", "sprint", "look_behind", "crouch", "action", "walk", "aim_weapon", "conversation_yes", "conversation_no",
 "group_control_forwards", "group_control_back", "enter_exit", "vehicle_fire", "vehicle_secondary_fire", "vehicle_left", "vehicle_right",
 "steer_forward", "steer_back", "accelerate", "brake_reverse", "radio_next", "radio_previous", "radio_user_track_skip", "horn", "sub_mission",
 "handbrake", "vehicle_look_left", "vehicle_look_right", "vehicle_look_behind", "vehicle_mouse_look", "special_control_left", "special_control_right",
 "special_control_down", "special_control_up" }

function getBoundControls (key)
    local controls = {}
    for _,control in ipairs(controlTable) do
        for k in pairs(getBoundKeys(control)) do
            if (k == key) then
                controls[control] = true
            end
        end
    end
    return controls
end

 

Link to comment
On 6/6/2018 at 20:19, NeXuS™ said:

It exists, and works perfectly. Maybe there is an error in your code. Maybe try to post it in here so we can help you further.

yeah thank you, i've just only checked that function and in wiki example isnt works well. actually Example 2

23 hours ago, DeadthStrock said:

try to add below code into the existing script ,

Client Side :-


local controlTable = { "fire", "next_weapon", "previous_weapon", "forwards", "backwards", "left", "right", "zoom_in", "zoom_out",
 "change_camera", "jump", "sprint", "look_behind", "crouch", "action", "walk", "aim_weapon", "conversation_yes", "conversation_no",
 "group_control_forwards", "group_control_back", "enter_exit", "vehicle_fire", "vehicle_secondary_fire", "vehicle_left", "vehicle_right",
 "steer_forward", "steer_back", "accelerate", "brake_reverse", "radio_next", "radio_previous", "radio_user_track_skip", "horn", "sub_mission",
 "handbrake", "vehicle_look_left", "vehicle_look_right", "vehicle_look_behind", "vehicle_mouse_look", "special_control_left", "special_control_right",
 "special_control_down", "special_control_up" }

function getBoundControls (key)
    local controls = {}
    for _,control in ipairs(controlTable) do
        for k in pairs(getBoundKeys(control)) do
            if (k == key) then
                controls[control] = true
            end
        end
    end
    return controls
end

 

try 2nd example on wiki :D

Edited by _Evo_
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...