GamerDeMTA Posted July 31, 2013 Share Posted July 31, 2013 Heyy! I wanna use this event for ONLY when a player throws a cocktail molotov.. "onClientPlayerWeaponFire" how to?? what to add to the function Link to comment
Wei Posted July 31, 2013 Share Posted July 31, 2013 From wiki: --First, we create a function for the event handler to use. function onClientPlayerWeaponFireFunc(weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if weapon == 38 then -- If the player shoots with a minigun, and hits another player... outputChatBox ( "Don't kill people with minigun, it's lame!", 255, 0, 0 ) -- We output a warning to him. end end -- Add this as a handler so that the function will be triggered every time the local player fires. addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), onClientPlayerWeaponFireFunc ) Just modyfy the weapon id Link to comment
GamerDeMTA Posted August 2, 2013 Author Share Posted August 2, 2013 like this? function onClientPlayerWeaponFireFunc( 38 ) --the function end or this? function onClientPlayerWeaponFireFunc ( 38, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) --the function end Link to comment
iMr.3a[Z]eF Posted August 2, 2013 Share Posted August 2, 2013 (edited) No, like this: addEventHandler( "onClientPlayerWeaponFire", localPlayer, function ( ) local weapon = getPedWeapon(localPlayer) if weapon == 38 then cancelEvent() outputChatBox("* No't allowed to kill people by minigun", localPlayer, 255, 0, 0) end end ) Edited August 2, 2013 by Guest Link to comment
GamerDeMTA Posted August 2, 2013 Author Share Posted August 2, 2013 i tried but that is if a player has that weapon not if he shoots with it, Link to comment
Moderators IIYAMA Posted August 2, 2013 Moderators Share Posted August 2, 2013 This event is called when player shoots a weapon. This does not trigger for projectiles based, or melee weapons. Also note that this event is only triggered for players nearby the local player's camera. This is due to elements far away being streamed out. People can't read? The only event that supports Molotov thingy is: https://wiki.multitheftauto.com/wiki/On ... leCreation 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