Jump to content

Toggle fire control


TheCapn

Recommended Posts

Posted

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,

Posted

Try this ,

addEventHandler( "onClientPlayerWeaponFire", root, 
    function () 
if ( isElement( localPlayer) ) and ( getElementType( localPlayer ) == "player" ) and getPedTotalAmmo ( localPlayer ) <= 1 then 
     toggleControl ( "fire", false ) 
     end 
   end 
  ) 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...