My anti team kill works when I attack my enemy
#2

Hope this helps
Код:
public OnPlayerDeath( playerid, killerid, reason ) // This is called when a player deaths.
{
    if ( killerid != INVALID_PLAYER_ID ) // If the killerid are NOT an invalid player
    { // Then
        if ( GetPlayerTeam( killerid ) == GetPlayerTeam( playerid ) ) // If killerid's team == playerid's team ( who has been killed )
        { // Then
            SetPlayerHealth( killerid, -1 ); // Kills the killer ( Setting the health to -1 ).

            SendClientMessage( killerid, -1, "No teamkilling." ); // Sends a message to the killer with a white colour ( -1 ), with the message " No teamkilling. ".

            GivePlayerMoney( killerid, - 5000 ); // Take $5000 from the killerid, because teamkilling,
        }

        else // Another team killed the player
        {
            SendClientMessage( killerid, -1, "Nice shot!" ); // Sends a message to the killer with a white colour ( -1 ) with the message "Nice Shot! ".

            GivePlayerMoney( killerid, 5000 ); // Gives the killerid $5000.
        }
    }

    SendDeathMessage(  killerid, playerid, reason ); // Sends a death message about the killerid is killing the player, with the reason ( At the middle right of your game, can be toggled by pressing F9 ).

    return 1; // This means the callback is executed succesfully.
}
REP ME IF I HELPED
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)