Jump to content

[HELP] Zombie Headshot


Doffy

Recommended Posts

Hello, 

i wanna make zombie head shot with selected weapons

Deagle , Sniper, Shotgun

and when i set a weapon check

code not working and no debug

Code:

--client
function zombiedamaged ( attacker, weapon, bodypart )
	if getElementType ( source ) == "ped" then
		if (getElementData (source, "zombie") == true) then
			if ( bodypart == 9 ) then
					triggerServerEvent ("headboom", source, source, attacker, weapon, bodypart )
				end
			end
		end
end
addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged )

--server
addEvent( "headboom", true )
function Zheadhit ( ped,attacker, weapon, bodypart)
	if (getElementData (ped, "zombie") == true) then
			local w = getPlayerWeapon(attacker)
if ( w == 34 ) and ( w == 24 ) and ( w == 25 ) then
		killPed ( ped, attacker, weapon, bodypart )
		setPedHeadless  ( ped, true )
	end
end
end
addEventHandler( "headboom", getRootElement(), Zheadhit )

 

Link to comment

function zombiedamaged ( attacker, weapon, bodypart )
	if getElementType ( source ) == "ped" and getElementType ( attacker ) == "player" then
		if (getElementData (source, "zombie") == true) then
			if ( bodypart == 9 and weapon == 24 or weapon == 25 or weapon == 34 ) then
				triggerServerEvent ("headboom", localPlayer, source, attacker, weapon, bodypart )
			end
		end
	end
end
addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged )

 


addEvent( "headboom", true )
function Zheadhit ( ped,attacker, weapon, bodypart)
	killPed ( ped, attacker, weapon, bodypart )
	setPedHeadless  ( ped, true )
end
addEventHandler( "headboom", getRootElement(), Zheadhit )

 

Link to comment
17 minutes ago, !#NssoR_) said:

function zombiedamaged ( attacker, weapon, bodypart )
	if getElementType ( source ) == "ped" and getElementType ( attacker ) == "player" then
		if (getElementData (source, "zombie") == true) then
			if ( bodypart == 9 and weapon == 24 or weapon == 25 or weapon == 34 ) then
				triggerServerEvent ("headboom", localPlayer, source, attacker, weapon, bodypart )
			end
		end
	end
end
addEventHandler ( "onClientPedDamage", getRootElement(), zombiedamaged )

 


addEvent( "headboom", true )
function Zheadhit ( ped,attacker, weapon, bodypart)
	killPed ( ped, attacker, weapon, bodypart )
	setPedHeadless  ( ped, true )
end
addEventHandler( "headboom", getRootElement(), Zheadhit )

 

not working actully

this make zombie die with one shot in any body part in his body !

Link to comment
  • Moderators
41 minutes ago, !#DesTroyeR_,) said:

not working actully

this make zombie die with one shot in any body part in his body !

if ( bodypart == 9 and weapon == 24 or weapon == 25 or weapon == 34 ) then

replace to:

if ( bodypart == 9 and ( weapon == 24 or weapon == 25 or weapon == 34 ) ) then

 

  • Like 1
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...