willian~ Posted July 4, 2019 Share Posted July 4, 2019 This is the code, but when i add the script to FTP it dont work local wepSlotsToBinds = { [1] = {0, 1, 10}, [2] = {2, 4}, [3] = {3}, [4] = {5}, [5] = {6, 7}, [6] = {8, 12}, [7] = {9, 10, 11}, } function selectWeapon(cmd) local key = string.gsub(cmd, "[a-z]", "") or "" local key = tonumber(key) local binds = wepSlotsToBinds[key] if (not binds or #binds == 0) then return false end local curSlot = getPedWeaponSlot(localPlayer) for i, slot in ipairs(binds) do if (slot >= curSlot and binds[i + 1] and setPedWeaponSlot(localPlayer, binds[i + 1])) then return true end end for i, slot in ipairs(binds) do local setSlot = setPedWeaponSlot(localPlayer, slot) if (setSlot or slot == 0) then return true end end end addCommandHandler("vselwep1", selectWeapon) addCommandHandler("vselwep2", selectWeapon) addCommandHandler("vselwep3", selectWeapon) addCommandHandler("vselwep4", selectWeapon) addCommandHandler("vselwep5", selectWeapon) addCommandHandler("vselwep6", selectWeapon) addCommandHandler("vselwep7", selectWeapon) addCommandHandler("vselwep8", selectWeapon) addCommandHandler("vselwep9", selectWeapon) bindKey("1", "down", "vselwep1") bindKey("2", "down", "vselwep2") bindKey("3", "down", "vselwep3") bindKey("4", "down", "vselwep4") bindKey("5", "down", "vselwep5") bindKey("6", "down", "vselwep6") bindKey("7", "down", "vselwep7") bindKey("8", "down", "vselwep8") bindKey("9", "down", "vselwep9") Link to comment
DNL291 Posted July 6, 2019 Share Posted July 6, 2019 Type /debugscript 3 and see if it shows errors with this code. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now