Adde Posted March 19, 2013 Share Posted March 19, 2013 (edited) Hello I have tried to create a function that kicks the player who kills another player (no dm) and then output a message in chatbox. I have tried to figure out how to make it work. I read on wiki, looked at other scripts and searched on forum. The thing is that I don´t really know how to do so it get the killer, or if I´m close being right I´m stuck and I have added and removed things all the time. This is what I have atm: Function KickDM(killer) if ( attacker ) then if ( getElementType ( attacker ) == "player" ) then kickPlayer(attacker,"You have been kicked for killing another player") outputChatBox(getPlayerName(attacker).."have been kicked for DM!", getRootElement, 250, 60, 60, true) end end addEventHandler("onPlayerWasted",getRootElement,kickDM) I don´t have any ideas left -.- I would be glad for help Edited March 19, 2013 by Guest Link to comment
TheIceman1 Posted March 19, 2013 Share Posted March 19, 2013 I dont really know what you want,but try this: function KickDM(attacker) if ( attacker ) then if ( getElementType ( attacker ) == "player" ) then kickPlayer(attacker,"You have been kicked for killing another player") outputChatBox(getPlayerName(attacker).."have been kicked for DM!", getRootElement, 250, 60, 60, true) end end addEventHandler("onPlayerWasted",getRootElement,KickDM) Link to comment
Adde Posted March 19, 2013 Author Share Posted March 19, 2013 That little change didn´t work I mean like, if I kill another player I will get kicked and a message will be output for other players in chatbox with my playername and then "have been kicked for DM". Link to comment
Vision Posted March 19, 2013 Share Posted March 19, 2013 Try this one function KickDM ( _, attacker ) if ( attacker ) then if ( getElementType ( attacker ) == "player" ) then kickPlayer ( attacker, "You have been kicked for killing another player" ) outputChatBox ( getPlayerName ( attacker ) .. " have been kicked for DM!", root, 250, 60, 60, true ) end end end addEventHandler ( "onPlayerWasted", root, KickDM ) Link to comment
Castillo Posted March 19, 2013 Share Posted March 19, 2013 function KickDM ( _, attacker ) if ( attacker ) then if ( getElementType ( attacker ) == "player" ) then outputChatBox ( getPlayerName ( attacker ) .. " have been kicked for DM!", root, 250, 60, 60, true ) kickPlayer ( attacker, "You have been kicked for killing another player" ) end end end addEventHandler ( "onPlayerWasted", root, KickDM ) outputChatBox has to go first, if you do it after kickPlayer, it'll say that expected a player element, but got nil at getPlayerName. Link to comment
Adde Posted March 19, 2013 Author Share Posted March 19, 2013 Ah okay, now I know that. thx But I got a bug in it, I get kicked if I kill myself Is that easy to fix? 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