Gravestone Posted July 20, 2016 Posted July 20, 2016 Is there anyway I can allow players to scroll weapons on jetpack? I enabled all the weapons on jetpack but now I want to enable scrolling too. Clan war system http://sh.st/7r4nI
Tox Posted July 21, 2016 Posted July 21, 2016 you'll use; bindKey https://wiki.multitheftauto.com/wiki/SetPedWeaponSlot
Gravestone Posted July 21, 2016 Author Posted July 21, 2016 How should I use it? Clan war system http://sh.st/7r4nI
Captain Cody Posted July 21, 2016 Posted July 21, 2016 Here -- E to slot forward, Q to slot backwards. function NextWeapon (player) if doesPedHaveJetPack (player) then local slot = getPedWeaponSlot(player) if slot == 12 then setPedWeaponSlot (player,0) else setPedWeaponSlot (player,slot+1) end end end function PreWeapon (player) if doesPedHaveJetPack (player) then local slot = getPedWeaponSlot(player) if slot == 0 then setPedWeaponSlot (player,12) else setPedWeaponSlot (player,slot-1) end end end function BindKeys () for i,v in pairs(getElementsByType("player")) do bindKey ( v, "e", "down", NextWeapon ) bindKey ( v, "q", "down", PreWeapon ) end end addEventHandler ( "onResourceStart", resourceRoot, BindKeys ) function BindKeys2 () bindKey ( source, "e", "down", NextWeapon ) bindKey ( source, "q", "down", PreWeapon ) end addEventHandler ( "onPlayerJoin", getRootElement(),BindKeys2)
Captain Cody Posted July 21, 2016 Posted July 21, 2016 But if you want to scroll, replace E and Q with mouse_wheel_up and mouse_wheel_down
Walid Posted July 21, 2016 Posted July 21, 2016 function switch (player,key) if doesPedHaveJetPack (player) then local slot = getPedWeaponSlot(player) if key == "mouse_wheel_up" then if slot == 12 then setPedWeaponSlot (player,0) else setPedWeaponSlot (player,slot+1) end elseif key == "mouse_wheel_down" then if slot == 0 then setPedWeaponSlot (player,12) else setPedWeaponSlot (player,slot-1) end end end end function bindOnStart () for i,v in pairs(getElementsByType("player")) do bindKeys(v) end end addEventHandler ( "onResourceStart", resourceRoot, bindOnStart) function bindKeyOnjoin () bindKeys(source) end addEventHandler ( "onPlayerJoin", getRootElement(),bindKeyOnjoin) function bindKeys(player) if player and isElement(player) then bindKey ( player, "mouse_wheel_up", "down", switch ) bindKey ( player, "mouse_wheel_down", "down", switch ) end end 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
Gravestone Posted July 22, 2016 Author Posted July 22, 2016 Both the codes are not working good. I can't figure out what's wrong. Clan war system http://sh.st/7r4nI
Captain Cody Posted July 22, 2016 Posted July 22, 2016 I tested mine, it works just fine, unless you were holding a gun that cannot be shot in jetPack when getting the jet pack
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