Dzsozi (h03) Posted October 13, 2016 Share Posted October 13, 2016 Hello, I would like to make a custom weapon switching screen with dx functions and I would like to display the current weapon, the previous weapon and the next weapon after the current. My question is how I can make that possible and how can I draw these 3 weapons with dx? I would like to make the script work like if you hold a button a panel appears and if you scroll you scroll to the next weapon, but you can see the weapon you had before on the previous slot. It's kinda hard to explain in words, but take a look at the gif I made: Hope you know now what I mean. So how can I do that? Is this possible? Link to comment
Dzsozi (h03) Posted October 13, 2016 Author Share Posted October 13, 2016 Oh and one more thing I forgot: How can I get the ammo of the next and the previous weapons? Link to comment
Walid Posted October 13, 2016 Share Posted October 13, 2016 (edited) Try this Previous weapon function getPreviousWeapon() local tempSlot = {} local curSlot = getPedWeaponSlot(localPlayer) if (curSlot == 0) and (getPedWeapon(localPlayer) == 0 or getPedWeapon(localPlayer) == 1) then curSlot = 13 end tempSlot["ID"] = 13 repeat tempSlot["ID"] = tempSlot["ID"]-1 until (tempSlot["ID"] < curSlot) and not (tempSlot["ID"] ~= 0 and getPedWeapon(localPlayer, tempSlot["ID"]) == 0) return getPedWeapon(localPlayer, tempSlot["ID"]) end Next Weapon function getNextWeapon() local tempSlot = {} local curSlot = getPedWeaponSlot(localPlayer) if (curSlot == 12) then curSlot = - 1 end tempSlot["ID"] = - 1 repeat tempSlot["ID"] = tempSlot["ID"] + 1 if tempSlot["ID"] == 13 then tempSlot["ID"] = -1 curSlot = -1 end until (tempSlot["ID"] > curSlot) and not (tempSlot["ID"] ~= 0 and getPedWeapon(localPlayer, tempSlot["ID"]) == 0) return getPedWeapon(localPlayer, tempSlot["ID"]) end 7 minutes ago, Dzsozi said: Oh and one more thing I forgot: How can I get the ammo of the next and the previous weapons? getPedTotalAmmo , getPedAmmoInClip, getSlotFromWeapon Edited October 13, 2016 by Walid 1 1 Link to comment
Dzsozi (h03) Posted October 13, 2016 Author Share Posted October 13, 2016 I think it works, I will try to do finish what I wanted to do, thank you very much!! 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