Turbesz 4 Posted February 1 Share Posted February 1 How can i disable weapon use (shooting) while player is on fire (for example because players threw her molotov)? Because GTA SA have a worrying bug with which you can shoot indefinitely with desert eagle while you burn, so i want to fix that somehow Link to post
Spakye 7 Posted February 1 Share Posted February 1 Hello, i guess use onClientPlayerWeaponFire and check if the player is on fire with isPedOnFire. Cancel event if he is Link to post
Moderators Patrick 337 Posted February 1 Moderators Share Posted February 1 You can disable shooting with toggleControl. toggleControl("fire", false) Link to post
Turbesz 4 Posted February 1 Author Share Posted February 1 1 hour ago, Patrick said: You can disable shooting with toggleControl. toggleControl("fire", false) umm i tried this way, but if player does not on fire still cannot shoot with weapon function teszt() local wep = getPedWeapon(source) if isPedOnFire (source) and wep == 24 then toggleControl(source,"fire", false) else toggleControl(source,"fire", true) end end addEventHandler("onPlayerWeaponFire",root,teszt) Link to post
SpecT 55 Posted February 1 Share Posted February 1 (edited) You can set a timer after some time to enable the fire control. For example: function teszt() local wep = getPedWeapon(source) if isPedOnFire(source) and wep == 24 then toggleControl(source, "fire", false) setTimer(function() toggleControl(source, "fire", true) end, 5000, 1) end end addEventHandler("onPlayerWeaponFire",root,teszt) Edited February 1 by SpecT Link to post
Turbesz 4 Posted February 1 Author Share Posted February 1 7 minutes ago, SpecT said: You can set a timer after some time to enable the fire control. For example: function teszt() local wep = getPedWeapon(source) if isPedOnFire(source) and wep == 24 then toggleControl(source, "fire", false) setTimer(function() toggleControl(source, "fire", true) end, 5000, 1) end end addEventHandler("onPlayerWeaponFire",root,teszt) i tried this way too, but does not working the timer "Expected player at argument 1, got nil" Link to post
SpecT 55 Posted February 1 Share Posted February 1 (edited) Well you need to store the player in a variable. function teszt() local wep = getPedWeapon(source) local targetPlayer = source if isPedOnFire(source) and wep == 24 then toggleControl(source, "fire", false) setTimer(function() toggleControl(targetPlayer, "fire", true) end, 5000, 1) end end addEventHandler("onPlayerWeaponFire",root,teszt) Now it should work fine. Edited February 1 by SpecT 1 Link to post
Turbesz 4 Posted February 1 Author Share Posted February 1 6 minutes ago, SpecT said: Well you need to store the player in a variable. function teszt() local wep = getPedWeapon(source) local targetPlayer = source if isPedOnFire(source) and wep == 24 then toggleControl(source, "fire", false) setTimer(function() toggleControl(targetPlayer, "fire", true) end, 5000, 1) end end addEventHandler("onPlayerWeaponFire",root,teszt) Now it should work fine. Thank you so much!! 1 Link to post
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