Jump to content

setPedWeaponSlot


Annas

Recommended Posts

function testBinds() 
    setPedWeaponSlot ( localPlayer, 2 ) 
    setPedWeaponSlot ( localPlayer, 3 ) 
end 
bindKey("1", "down", testBinds) 

I need it when i click bind 1, the first time it will switch to slot:2 and when i click again on bind 1, it will switch to slot: 3

Please help me

Link to comment

Try this :)

local current = 1 
  
function testBinds() 
    if current == 1 then 
    setPedWeaponSlot ( localPlayer, 2 ) 
    current = 2 
    elseif current == 2 then 
    setPedWeaponSlot ( localPlayer, 3 ) 
    current = 1 
    end 
end 
bindKey("1", "down", testBinds) 

Link to comment
  
i = false 
function testBinds() 
    if not i then 
          setPedWeaponSlot ( localPlayer, 2 ) 
    else 
           setPedWeaponSlot ( localPlayer, 3 ) 
      end 
      i = not i 
end 
bindKey("1", "down", testBinds) 

Link to comment
Try this :)
local current = 1 
  
function testBinds() 
    if current == 1 then 
    setPedWeaponSlot ( localPlayer, 2 ) 
    current = 2 
    elseif current == 2 then 
    setPedWeaponSlot ( localPlayer, 3 ) 
    current = 1 
    end 
end 
bindKey("1", "down", testBinds) 

HAHA, tooo simple xD and working ^^ , thanks ;)

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