Turbesz Posted February 1, 2021 Share Posted February 1, 2021 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 comment
Spakye Posted February 1, 2021 Share Posted February 1, 2021 Hello, i guess use onClientPlayerWeaponFire and check if the player is on fire with isPedOnFire. Cancel event if he is Link to comment
Moderators Patrick Posted February 1, 2021 Moderators Share Posted February 1, 2021 You can disable shooting with toggleControl. toggleControl("fire", false) Link to comment
Turbesz Posted February 1, 2021 Author Share Posted February 1, 2021 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 comment
SpecT Posted February 1, 2021 Share Posted February 1, 2021 (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, 2021 by SpecT Link to comment
Turbesz Posted February 1, 2021 Author Share Posted February 1, 2021 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 comment
SpecT Posted February 1, 2021 Share Posted February 1, 2021 (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, 2021 by SpecT 1 Link to comment
Turbesz Posted February 1, 2021 Author Share Posted February 1, 2021 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 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