MultiNo Posted August 17, 2014 Share Posted August 17, 2014 I do not know if this is possible, but how can I get my previous weapon and the next weapon? an example? Link to comment
Max+ Posted August 17, 2014 Share Posted August 17, 2014 I do not know if this is possible, but how can I get my previous weapon and the next weapon? an example? 'press E and Q ' Link to comment
MultiNo Posted August 17, 2014 Author Share Posted August 17, 2014 I wanted a function for this to create a HUD, just like this picture http://4.bp.blogspot.com/_zNnMHNDuLso/S ... 0/HUD1.jpg Link to comment
Max+ Posted August 17, 2014 Share Posted August 17, 2014 I wanted a function for this to create a HUD, just like this picture http://4.bp.blogspot.com/_zNnMHNDuLso/S ... 0/HUD1.jpg getPedWeapon Link to comment
Anubhav Posted August 17, 2014 Share Posted August 17, 2014 Use the event onPlayerWeaponSwitch @ Max: It will only get the current weapon! Not previous . Link to comment
Max+ Posted August 17, 2014 Share Posted August 17, 2014 Use the event onPlayerWeaponSwitch @ Max: It will only get the current weapon! Not previous . Yeah , You'r Right , that event should do the job , Link to comment
DNL291 Posted August 18, 2014 Share Posted August 18, 2014 "onPlayerWeaponSwitch" will not return the next weapon. You can use these functions: Client 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"] = 12 + 1 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 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 I don't know if it's the best way to do that, but it should work without problems. Link to comment
MultiNo Posted August 18, 2014 Author Share Posted August 18, 2014 Can anyone tell me how i can use dxDrawImage with this function (DNL291) for my hud please. Link to comment
MultiNo Posted August 21, 2014 Author Share Posted August 21, 2014 I tried this but not working if ( 'getPreviousWeapon' == 1 ) then dxDrawImage ( x, y, x, y, "img/1.png" ) end Link to comment
Castillo Posted August 21, 2014 Share Posted August 21, 2014 You aren't using it as a function. Replace: if ( 'getPreviousWeapon' == 1 ) then with: if ( getPreviousWeapon ( ) == 1 ) then Link to comment
MultiNo Posted August 21, 2014 Author Share Posted August 21, 2014 (edited) Many thanks DNL291 and Solidsnake14 can close the topic. Edited September 10, 2014 by Guest Link to comment
[UCG]Mike Posted August 22, 2014 Share Posted August 22, 2014 you can try with this too https://community.multitheftauto.com/ind ... ls&id=7275 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