Jump to content

help


Apo

Recommended Posts

hi guys my code az not work please help me

 


function PlayerHeadShot ( ammo, attacker, weapon, bodypart ) 
if ( attacker ) then
if ( getElementType ( attacker ) == "player" ) then
	if ( bodypart == 9 ) then 
			outputChatBox("test wasted",attacker,155,100,100)
        	end
		end	
	end
end
addEventHandler ( "onPlayerWasted", getRootElement (), PlayerHeadShot)

 

Link to comment

as @Gourmet. said, are there errors? I can't test since i'm alone now but the code seems correct... when a player dies due headshot the attacker will see in the chat "test wasted"

 

PS not sure about this: getElementType returns false if the given value is false, so lines 3 and 9 can be omitted. That's not true if passing false generate a warning, in which case your code is ok

Edited by LoPollo
Link to comment
19 hours ago, LoPollo said:

as @Gourmet. said, are there errors? I can't test since i'm alone now but the code seems correct... when a player dies due headshot the attacker will see in the chat "test wasted"

 

PS not sure about this: getElementType returns false if the given value is false, so lines 3 and 9 can be omitted. That's not true if passing false generate a warning, in which case your code is ok

Why are you actually using getElementType()? Usually there are no other elements that call "onPlayerWasted".

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