Cocodrilo Posted May 22, 2013 Posted May 22, 2013 What is wrong? function kickPlayerHandler ( killer, kickedname, reason ) -- Get player element from the name local kicked = getPlayerFromName ( killer ) if ( killer ) and ( killer ~= source ) then kickPlayer ( kicked, killer, reason ) outputChatBox("No kill people!", 0,0,255) end end addEventHandler ( "onPlayerWasted", getRootElement(), kickPlayerHandler )
Tete omar Posted May 22, 2013 Posted May 22, 2013 function kickPlayerHandler(totalAmmo, killer) if ( killer ) and ( killer ~= source ) then kickPlayer(killer, "No kill people!") end end addEventHandler("onPlayerWasted", root, kickPlayerHandler) The wrong is: 1- You forgot totalAmmo parameter in onPlayerWasted event and you expect that this is the killer 2- There is no need to getPlayerFromName function 3- There is no reason parameter in onPlayerWasted event 4- The killer gets kicked before the chat message appears 5- You're defining killerWeapon as kickedname, this should be int though I'm not sure about the chat message, but i think you want to output this chat message to the killer not to all players. P.S. I recommend you to reread onPlayerWasted parameters int totalAmmo, element killer, int killerWeapon, int bodypart [, bool stealth ]
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