View Single Post
KALASH NICOLE
Member
Join Date: Feb 2016
Old 05-09-2017 , 05:10   Re: [INC] Colors (1.0.5)
Reply With Quote #412

hi, i want to add red color to the chat message of this code (printtochatall and kickclient):

could you repost it with the correct code ?

PHP Code:
ConVar sm_teamkill_limit;

public 
void OnPluginStart()
{
    
sm_teamkill_limit CreateConVar("sm_teamkill_limit""3""The limit before of team kill before kicking the player"FCVAR_NONEtrue0.0);
    
HookEventEx("round_start"event);
    
HookEventEx("player_death"event);
    
HookEventEx("player_disconnect"event);
}

public 
void event(Event event, const char[] namebool dontBroadcast)
{
    static 
int teamkill_counts[MAXPLAYERS+1];

    if(
sm_teamkill_limit.IntValue <= 0) return;

    if(
StrEqual(name"round_start"))
    {
        for(
int x 1<= MaxClientsx++)
        {
            
teamkill_counts[x] = 0;
        }
        return;
    }

    if(
StrEqual(name"player_disconnect"))
    {
        
teamkill_counts[GetClientOfUserId(event.GetInt("userid"))] = 0;
        return;
    }

    
int victim GetClientOfUserId(event.GetInt("userid"));
    
int attacker GetClientOfUserId(event.GetInt("attacker"));

    if(!
attacker || attacker == victim || GetClientTeam(attacker) != GetClientTeam(victim)) return;

    
teamkill_counts[attacker]++;
    
PrintToChatAll("%N TEAMKILLED %N (%i/%i)."attackervictimteamkill_counts[attacker], sm_teamkill_limit.IntValue);

    if(
teamkill_counts[attacker] >= sm_teamkill_limit.IntValue && !IsClientInKickQueue(attacker))
    {
        
KickClient(attacker"Kicked for reaching the TeamKill limit.");
       
    }
    


Last edited by KALASH NICOLE; 05-09-2017 at 06:06.
KALASH NICOLE is offline