Gad_boy Posted January 3, 2012 Posted January 3, 2012 How to check if player has weapon in hand, and amount of ammo. give simple example please.
Kenix Posted January 3, 2012 Posted January 3, 2012 Client side: addCommandHandler( "weapon", function( ) local weapon = getPedWeapon( localPlayer ) outputChatBox( "You have weapon"..tostring( weapon ).." id, ammo "..tostring( getPedTotalAmmo( localPlayer,getPedWeaponSlot( localPlayer ) ) ) ) end ) Code updated
Gad_boy Posted January 3, 2012 Author Posted January 3, 2012 i need something like this addEventHandler("onClientPlayerSpawn", root, function () local ammo local wtype ammo = getPedTotalAmmo (root) wtype = getPedWeapon ( root) end )
Kenix Posted January 3, 2012 Posted January 3, 2012 addEventHandler("onClientPlayerSpawn", root, function ( ) local ammo = getPedTotalAmmo ( source ) local wtype = getPedWeapon ( source ) outputChatBox( "Weapon "..tostring( wtype ).." id, ammo "..tostring( ammo ) ) end ) Why you need check root?
Gad_boy Posted January 3, 2012 Author Posted January 3, 2012 i don't know)) i am a noob in lua)) i wont to make my own hud, so i need to check amount of ammo to make progressbar with it and the dxtext with total ammo))
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