Raised This Month: $51 Target: $400
 12% 

need help to colorize my plugin.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KALASH NICOLE
Member
Join Date: Feb 2016
Old 05-09-2018 , 13:36   need help to colorize my plugin.
Reply With Quote #1

Hello, i would like to add colors to this following plugin :

i added colors.inc and morecolors.inc in the correct folder

i added
#include <colors>
#include <morecolors> in the plugin.sp


here is the plugin code iwant to modify :

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <colors>
#include <morecolors>
#define BANTIME 1


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"changemap"))
    {
        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]++;
    
CPrintToChatAll("%N TEAMKILLED %N (%i/%i)."attackervictimteamkill_counts[attacker], sm_teamkill_limit.IntValue);

    if(
teamkill_counts[attacker] >= sm_teamkill_limit.IntValue && !IsClientInKickQueue(attacker))
    {
        
BanClient(attackerBANTIMEBANFLAG_AUTO"1 minute ban for reaching the TK limit""1 minute ban for reaching the TK limit");

    }


I need to colorize the CPrinttoChatAll message (in DarkOrange color) and the BanClient message (in FullRed color).

Last edited by KALASH NICOLE; 05-09-2018 at 13:48.
KALASH NICOLE is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 05-09-2018 , 15:30   Re: need help to colorize my plugin.
Reply With Quote #2

Moved to the proper section, please be aware of which subforum you post in.
__________________
sneaK is offline
Facksy
Senior Member
Join Date: Apr 2017
Location: +2+2
Old 05-09-2018 , 16:59   Re: need help to colorize my plugin.
Reply With Quote #3

Code:
CPrintToChatAll("{darkorange}%N TEAMKILLED %N (%i/%i).", attacker, victim, teamkill_counts[attacker], sm_teamkill_limit.IntValue);
i think it should works
__________________
My Steam I take private requests if related with TF2
My Plugins
Facksy is offline
KALASH NICOLE
Member
Join Date: Feb 2016
Old 05-09-2018 , 19:21   Re: need help to colorize my plugin.
Reply With Quote #4

i already tried this. it didn't work
KALASH NICOLE is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 05-09-2018 , 23:55   Re: need help to colorize my plugin.
Reply With Quote #5

Quote:
Originally Posted by KALASH NICOLE View Post
i already tried this. it didn't work
just by saying it didn't work is not going to help us to help you
__________________
8guawong is offline
Lubricant Jam
AlliedModders Donor
Join Date: Oct 2016
Location: United Kingdom
Old 05-10-2018 , 07:36   Re: need help to colorize my plugin.
Reply With Quote #6

Quote:
Originally Posted by KALASH NICOLE View Post
i already tried this. it didn't work
I prefer to use colorvariables over those two.

Use the attached .inc & do the same above.
Attached Files
File Type: inc colorvariables.inc (33.8 KB, 90 views)

Last edited by Lubricant Jam; 05-10-2018 at 07:39.
Lubricant Jam is offline
KALASH NICOLE
Member
Join Date: Feb 2016
Old 05-11-2018 , 17:38   Re: need help to colorize my plugin.
Reply With Quote #7

i added morecolors.inc in the addons\sourcemod\scripting\include folder. in both VPS server and local game directory

i added #include <morecolors> into the plugin.sp

and this is the current plugin text :

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <colors>
#include <morecolors>
#define BANTIME 1


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"changemap"))
    {
        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]++;
    
CPrintToChatAll("{darkorange}%N TEAMKILLED %N (%i/%i)."attackervictimteamkill_counts[attacker], sm_teamkill_limit.IntValue);

    if(
teamkill_counts[attacker] >= sm_teamkill_limit.IntValue && !IsClientInKickQueue(attacker))
    {
        
BanClient(attackerBANTIMEBANFLAG_AUTO"1 minute ban for reaching the TK limit""{fullred}1 minute ban for reaching the TK limit");

    }


the chat text is still not colored.

Last edited by KALASH NICOLE; 05-11-2018 at 17:50.
KALASH NICOLE is offline
ThatKidWhoGames
Veteran Member
Join Date: Jun 2013
Location: IsValidClient()
Old 05-11-2018 , 22:25   Re: need help to colorize my plugin.
Reply With Quote #8

Quote:
Originally Posted by KALASH NICOLE View Post
i added morecolors.inc in the addons\sourcemod\scripting\include folder. in both VPS server and local game directory

i added #include <morecolors> into the plugin.sp

and this is the current plugin text :

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <colors>
#include <morecolors>
#define BANTIME 1


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"changemap"))
    {
        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]++;
    
CPrintToChatAll("{darkorange}%N TEAMKILLED %N (%i/%i)."attackervictimteamkill_counts[attacker], sm_teamkill_limit.IntValue);

    if(
teamkill_counts[attacker] >= sm_teamkill_limit.IntValue && !IsClientInKickQueue(attacker))
    {
        
BanClient(attackerBANTIMEBANFLAG_AUTO"1 minute ban for reaching the TK limit""{fullred}1 minute ban for reaching the TK limit");

    }


the chat text is still not colored.
You can't colorize the text for BanClient.
ThatKidWhoGames is offline
LenHard
Senior Member
Join Date: Jan 2016
Old 05-15-2018 , 21:21   Re: need help to colorize my plugin.
Reply With Quote #9

Or you could use the color codes inside the strings

for CS:GO
Code:
\x01 = Default
\x02 = Dark Red
\x03 = Purple
\x04 = Green
\x05 = Gray
\x06 = Olive
\x07 = Light Redish
\x08 = 
\x09 = Yellowish
\x10 = Orange
\x0A = Gray?
\x0B = Blue
\x0C = Dark Blue
\x0D = 
\x0E = Pink
\x0F =
Some of them i'm not too sure, test it out.

Example:
PHP Code:
PrintToChatAll(" \x02Hi, this is dark red."); 
__________________

Last edited by LenHard; 05-15-2018 at 21:23.
LenHard is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 07:05.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode