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

onWeaponFire

if getElementType(source) == "player" then

if getPedTotalAmmo(source) <= 1 then

cancelEvent()

that's all u need i guess.

 

●●●

Rage Gaming Society

Coming Soon

●●●

Posted

Try this ,

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

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

Posted
It's working, thank you.

No Problem ,

- New , Kill System

- New, GameMode Intro

- Leve / Exp System

- New nametag showing style

- New , Hud For Players

- Skin Selection from SA-MP

- Money System / Buy Weapons

- Drop Weapons

- New, Flood System

- New , Group Assign

- Gun license For Weapons

- Random Rule System For Money

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...