Jump to content

This wont work only for team :/


Adde

Recommended Posts

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 post
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 post

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...