Jump to content

Weapon and fire question


Turbesz

Recommended Posts

Posted

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

What if the only way not to feel bad, is to stop feeling, anything at all, forever?
- Hannah Baker

I cost a girl her life because I was afraid to love her...
- Clay Jensen

 ~ 13 Reasons Why

Posted
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)

 

What if the only way not to feel bad, is to stop feeling, anything at all, forever?
- Hannah Baker

I cost a girl her life because I was afraid to love her...
- Clay Jensen

 ~ 13 Reasons Why

Posted (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 by SpecT
Posted
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"

What if the only way not to feel bad, is to stop feeling, anything at all, forever?
- Hannah Baker

I cost a girl her life because I was afraid to love her...
- Clay Jensen

 ~ 13 Reasons Why

Posted (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 by SpecT
  • Thanks 1
Posted
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!! :D

  • Like 1

What if the only way not to feel bad, is to stop feeling, anything at all, forever?
- Hannah Baker

I cost a girl her life because I was afraid to love her...
- Clay Jensen

 ~ 13 Reasons Why

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...