Trilon Posted September 15, 2015 Share Posted September 15, 2015 Hello i tried but i failed. I want to write a script witch wrote to global chat who killed him. like : You killed by XY. Link to comment
Chaos Posted September 15, 2015 Share Posted September 15, 2015 onPlayerWasted Check Wiki for more information. Link to comment
Fist Posted September 15, 2015 Share Posted September 15, 2015 not tested function outPutKillerName(source, killer) outputChatBox( source.." died from hands of "..killer ) end addEventHandler( "onPlayerWasted", getRootElement(), outPutKillerName ) Link to comment
KariiiM Posted September 15, 2015 Share Posted September 15, 2015 (edited) Fist, what you did is gonna send erros plus will not output the message to the player who dead and who killed function outPutKillerName(source, killer) outputChatBox( source.." died from hands of "..killer ) end addEventHandler( "onPlayerWasted", getRootElement(), outPutKillerName ) Here is the right way to do this killed by script function outPutKillerName( _, killer) if ( killer and getElementType ( killer ) == "player" and killer ~= source ) then outputChatBox( getPlayerName(source).." died from hands of "..getPlayerName(killer) ) else outputChatBox ( getPlayerName(source).." died." ) end end addEventHandler( "onPlayerWasted", root, outPutKillerName ) Edited September 15, 2015 by Guest Link to comment
Fist Posted September 15, 2015 Share Posted September 15, 2015 Fist, what you did is gonna send erros plus will not output the message Here is the right way to do this killed by script function outPutKillerName( _, killer) if ( killer and getElementType ( killer ) == "player" and killer ~= source ) then outputChatBox( getPlayerName(source).." died from hands of "..getPlayerName(killer) ) else outputChatBox ( getPlayerName(source).." died." ) end end addEventHandler( "onPlayerWasted", root, outPutKillerName ) yes myb, but havent tested it cause i was making script only wanted to help. Link to comment
KariiiM Posted September 15, 2015 Share Posted September 15, 2015 yes myb, but havent tested it cause i was making script only wanted to help. Be sure next time before post the code it will be great Link to comment
Trilon Posted September 18, 2015 Author Share Posted September 18, 2015 I tried it but it didn't work it always write just : XY died Link to comment
JR10 Posted September 18, 2015 Share Posted September 18, 2015 It looks fine, are you sure that a player killed you? Try debugging with outputDebugString to output the killer variable. Link to comment
KariiiM Posted September 18, 2015 Share Posted September 18, 2015 I tried it but it didn't workit always write just : XY died It should works, it will tell you that you dead if you killed yourself by yourself, or be sure some one is killed you as JR10 said Link to comment
Trilon Posted September 18, 2015 Author Share Posted September 18, 2015 I have a DayZ server and it didn't writo to the peoples Link to comment
KariiiM Posted September 19, 2015 Share Posted September 19, 2015 I have a DayZ server and it didn't writo to the peoples It's server sided ,be sure you added it as server side in the meta 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