Fist Posted March 26, 2017 Share Posted March 26, 2017 as title says, is it possible to cancel event onClientPlayerWeaponFire or onPlayerWeaponFire ? Tried both of them to cancel with cancelEvent but didn't work. p.s: toggleControl is not solution for me, i want to play tick sound when player has 1 ammo. ( that 1 ammo would be fake bullet that ) and if i just toggle off fire control then i can't play that sound 'cause there would be no way to know when player wants to fire. Atleast i think that way. here is code what i tried with. addEventHandler("onClientPlayerWeaponFire",localPlayer,function() if (getPedTotalAmmo(localPlayer) <= 1) then cancelEvent(); end end); Link to comment
kewizzle Posted March 27, 2017 Share Posted March 27, 2017 2 hours ago, Fist said: as title says, is it possible to cancel event onClientPlayerWeaponFire or onPlayerWeaponFire ? Tried both of them to cancel with cancelEvent but didn't work. p.s: toggleControl is not solution for me, i want to play tick sound when player has 1 ammo. ( that 1 ammo would be fake bullet that ) and if i just toggle off fire control then i can't play that sound 'cause there would be no way to know when player wants to fire. Atleast i think that way. here is code what i tried with. addEventHandler("onClientPlayerWeaponFire",localPlayer,function() if (getPedTotalAmmo(localPlayer) <= 1) then cancelEvent(); end end); addEventHandler("onClientPlayerWeaponFire",localPlayer,function() if (getPedTotalAmmo(localPlayer) <= 1) then cancelEvent() end end) Link to comment
Fist Posted March 27, 2017 Author Share Posted March 27, 2017 Just now, kewizzle said: addEventHandler("onClientPlayerWeaponFire",localPlayer,function() if (getPedTotalAmmo(localPlayer) <= 1) then cancelEvent() end end) Why you give me same code that i wrote only differently sorted? Link to comment
kewizzle Posted March 27, 2017 Share Posted March 27, 2017 1 hour ago, Fist said: Why you give me same code that i wrote only differently sorted? yes. one second im making a working one for you, also you had some incorrect symbols. Link to comment
Fist Posted March 27, 2017 Author Share Posted March 27, 2017 Just now, kewizzle said: yes. one second im making a working one for you, also you had some incorrect symbols. nothing there is incorrect. Link to comment
kewizzle Posted March 27, 2017 Share Posted March 27, 2017 the use of ";" isnt needed Link to comment
Fist Posted March 27, 2017 Author Share Posted March 27, 2017 1 minute ago, kewizzle said: the use of ";" isnt needed i know that, it's just preference. I like code better how it looks with ";" and neither way it's not incorrect. Please, don't spam this topic if you don't know how solve this issue. You're not making any point here. Link to comment
kewizzle Posted March 27, 2017 Share Posted March 27, 2017 1 hour ago, Fist said: i know that, it's just preference. I like code better how it looks with ";" and neither way it's not incorrect. Please, don't spam this topic if you don't know how solve this issue. You're not making any point here. im working on a code for you... Link to comment
kewizzle Posted March 27, 2017 Share Posted March 27, 2017 refer to this topic. toggle control still allows you to play a tick sound. Link to comment
Fist Posted March 27, 2017 Author Share Posted March 27, 2017 20 minutes ago, kewizzle said: refer to this topic. toggle control still allows you to play a tick sound. Please, close this topic and never open it again. p.s i found different solution without using toggleControl and canceling event on fire. Link to comment
Anubhav Posted March 27, 2017 Share Posted March 27, 2017 when the player fires and bullets become one, just toggleControl and play your song. Link to comment
_DrXenon Posted March 27, 2017 Share Posted March 27, 2017 (edited) nvm. Edited March 27, 2017 by SuperCroz nvm Link to comment
Recommended Posts