Apo Posted November 27, 2016 Share Posted November 27, 2016 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
iPrestege Posted November 27, 2016 Share Posted November 27, 2016 Your code should work just fine. Link to comment
Apo Posted November 27, 2016 Author Share Posted November 27, 2016 attacker can not see outputChatBox("test wasted",attacker,155,100,100) Link to comment
keymetaphore Posted November 27, 2016 Share Posted November 27, 2016 Is your code clientside or serverside? Also - /debugscript 3? Link to comment
LoPollo Posted November 27, 2016 Share Posted November 27, 2016 (edited) 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 November 27, 2016 by LoPollo Link to comment
keymetaphore Posted November 28, 2016 Share Posted November 28, 2016 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
ViRuZGamiing Posted November 28, 2016 Share Posted November 28, 2016 34 minutes ago, Gourmet. said: Why are you actually using getElementType()? Usually there are no other elements that call "onPlayerWasted". killer: Quote an element representing the player or vehicle who was the killer. If there was no killer this is false. 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