TheCapn Posted June 20, 2014 Share Posted June 20, 2014 Hello guys, I would like to make a system that prevent a player to fire if there is only one bullet left in his current weapon. According to you, should I use "onClientRender" or "onWeaponFire" to handle this system ? Regards, Link to comment
_DrXenon Posted June 20, 2014 Share Posted June 20, 2014 onWeaponFire if getElementType(source) == "player" then if getPedTotalAmmo(source) <= 1 then cancelEvent() that's all u need i guess. Link to comment
TheCapn Posted June 20, 2014 Author Share Posted June 20, 2014 Nothing works, either on client side and server side. I think the "onWeaponFire" event is buggy .. Link to comment
Max+ Posted June 20, 2014 Share Posted June 20, 2014 Try this , addEventHandler( "onClientPlayerWeaponFire", root, function () if ( isElement( localPlayer) ) and ( getElementType( localPlayer ) == "player" ) and getPedTotalAmmo ( localPlayer ) <= 1 then toggleControl ( "fire", false ) end end ) Link to comment
TheCapn Posted June 20, 2014 Author Share Posted June 20, 2014 It's working, thank you. Link to comment
Max+ Posted June 20, 2014 Share Posted June 20, 2014 It's working, thank you. No Problem , 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