Adde Posted December 30, 2013 Share Posted December 30, 2013 Hello, I have a script that will warn/kick the attacker when someone is killed. But one thing wont work, it should only work if the attacker and the player that is being killed is in the same team. I tried add that to the 3:d line but that don´t work. Anyone knows why? But it works with warning and then kick, but between everyone... Here is the script function theLastPiece( _, attacker) if ( getElementType ( attacker ) == "player" ) then if getPlayerTeam(attacker) == getPlayerTeam(source) then if getElementData(attacker, "Reported") then if ( getElementData(attacker, "Reported") == "1" ) then kickPlayer(attacker, "You have been kicked for deathmatching") outputChatBox(getPlayerName(attacker).." have been kicked for deathmatching, this is not acceptable. If you continue you will be kicked", root, 255, 0, 0) else setElementData(attacker, "Reported", getElementData(attacker, "Reported")+1) outputChatBox("You have been reported for deathmatching, this is not acceptable. If you continue you will be kicked", attacker, 255, 0, 0) end else setElementData(attacker, "Reported", "1") outputChatBox("You have been reported for deathmatching, this is not acceptable. If you continue you will be kicked", attacker, 255, 0, 0) end else return end end end addEventHandler("onPlayerWasted", getRootElement(), theLastPiece) Link to comment
Castillo Posted December 30, 2013 Share Posted December 30, 2013 function theLastPiece ( _, attacker ) if ( getElementType ( attacker ) == "player" ) then if ( getPlayerTeam ( attacker) == getPlayerTeam ( source ) ) then if getElementData ( attacker, "Reported" ) then if ( getElementData ( attacker, "Reported" ) == 1 ) then kickPlayer ( attacker, "You have been kicked for deathmatching" ) outputChatBox ( getPlayerName ( attacker ) .." have been kicked for deathmatching, this is not acceptable. If you continue you will be kicked", root, 255, 0, 0 ) else setElementData ( attacker, "Reported", getElementData ( attacker, "Reported" ) + 1 ) outputChatBox ( "You have been reported for deathmatching, this is not acceptable. If you continue you will be kicked", attacker, 255, 0, 0 ) end else setElementData ( attacker, "Reported", 1 ) outputChatBox ( "You have been reported for deathmatching, this is not acceptable. If you continue you will be kicked", attacker, 255, 0, 0 ) end end end end addEventHandler ( "onPlayerWasted", getRootElement(), theLastPiece ) Link to comment
Adde Posted December 30, 2013 Author Share Posted December 30, 2013 Thank you. Only that I forgot, lol. Anyway it works now. 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