Jump to content

Ped Sound Attack


S7waj

Recommended Posts

Hi Guys I Want To Make Ped Start sound when the ped attack the player but the sound don't start can i know where is the wrong?

function tankAttack ( attacker, weapon, bodypart, randnum )
local number = tonumber(randum)
if not number then return end
	if (attacker) then
		if getElementType ( attacker ) == "ped" then
			if (getElementData (attacker, "Tank") == true) then
				local playerHealth = getElementHealth ( getLocalPlayer() )
				if playerHealth > 15 then
						setElementHealth ( source, playerHealth - 20 )
		local Zx1, Zy1, Zz1 = getElementPosition( attacker )
		local sound = playSound3D("sounds/tgroan"..math.ceil(number)..".wav", Zx1, Zy1, Zz1, false)
		setSoundMaxDistance(sound, 20)
				else
						triggerServerEvent ("killed", source, source, attacker, weapon, bodypart )
				end
			end
		end
	end
end
addEventHandler ( "onClientPlayerDamage", getLocalPlayer(), tankAttack )

 

Link to comment

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...