GamerDeMTA Posted July 31, 2013 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
Wei Posted July 31, 2013 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 Diet with russian vodka, lose 3 days in one week !
GamerDeMTA Posted August 2, 2013 Author 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
iMr.3a[Z]eF Posted August 2, 2013 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 To Visit Us Press Here: mtasa://5.9.206.180:22002
GamerDeMTA Posted August 2, 2013 Author Posted August 2, 2013 i tried but that is if a player has that weapon not if he shoots with it,
iMr.3a[Z]eF Posted August 2, 2013 Posted August 2, 2013 What do you mean? To Visit Us Press Here: mtasa://5.9.206.180:22002
Moderators IIYAMA Posted August 2, 2013 Moderators 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 Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
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