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

Colors don't work.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Adomaz1
Senior Member
Join Date: Feb 2014
Old 07-10-2016 , 15:56   Colors don't work.
Reply With Quote #1

Code:
#include <amxmodx> 
#include <chatcolor>

#define PLUGIN "Vip Connect MSG And sound" 
#define VERSION "1.0" 
#define AUTHOR "alliedmods" 

public plugin_init() { 
    register_plugin(PLUGIN, VERSION, AUTHOR) 

    register_dictionary_colored("VIP.txt")
} 
 
public client_putinserver(id) { 
    if(get_user_flags(id) & ADMIN_LEVEL_B){ 
    new name[32] 
    get_user_name(id, name, 31)
    client_print_color(0, print_chat, "%L", LANG_PLAYER, "MSG", name)
    } 
}
Code:
MSG= "!g[VIP] !t%s !nconnected to the server. Welcome him!"
shows only !g[VIP]...

The client_print_color gives a loose indentation warning.

Tried to add ^1 to %L, colors didn't work.
Tried to do print_chat > Red, didn't work.

The same is with this plugin:

Code:
#include <amxmodx> 
#include <amxmisc>
#include <chatcolor>

new const PLUGIN[]  = "High Ping Kicker"
new const VERSION[] = "1.0"
new const AUTHOR[]  = "Shadow/Bo0m!"

// Feel free to change this flag
#define HPK_IMMUNE ADMIN_IMMUNITY

// PCvars
new hpk_ping, hpk_check, hpk_tests, hpk_delay, hpk_immunity

new g_Ping[33]
new g_Samples[33]

public plugin_init() {

	register_plugin(PLUGIN, VERSION, AUTHOR)

	register_concmd("amx_hpk","cmdHpk",ADMIN_CVAR,"- configures high ping kicker")
	register_dictionary_colored("hpk.txt")

	hpk_ping = register_cvar("amx_hpk_ping","150")
	hpk_check = register_cvar("amx_hpk_check","12")
	hpk_tests = register_cvar("amx_hpk_tests","5")
	hpk_delay = register_cvar("amx_hpk_delay","60")
	hpk_immunity = register_cvar("amx_hpk_immunity","1")

	if (get_pcvar_num(hpk_check) < 5) set_pcvar_num(hpk_check,5)
	if (get_pcvar_num(hpk_tests) < 3) set_pcvar_num(hpk_tests,3)
}

public client_disconnect(id) 
	remove_task(id)

public client_putinserver(id) {    
	g_Ping[id] = 0 
	g_Samples[id] = 0

	if ( !is_user_bot(id) ) 
	{
		new param[1]
		param[0] = id 
		set_task( 15.0 , "showWarn" , id , param , 1 )
    
		if (get_pcvar_num(hpk_delay) != 0) {
			set_task( float(get_pcvar_num(hpk_delay)), "taskSetting", id, param , 1)
		}
		else {	    
			set_task( float(get_pcvar_num(hpk_check)) , "checkPing" , id , param , 1 , "b" )
		}
	}
}

public showWarn(param[]) {
	client_print_color( param[0], 0, "%L", LANG_PLAYER, "MSG_TEST", get_cvar_num( "amx_hpk_ping" ) )
}

public taskSetting(param[]) {
	new name[32]
	get_user_name(param[0],name,31)
	set_task( float(get_pcvar_num(hpk_check)) , "checkPing" , param[0] , param , 1 , "b" )
}

kickPlayer(id) { 
	new name[32],authid[36]
	get_user_name(id,name,31)
	get_user_authid(id,authid,35)
	client_print_color(0,0,"%L",LANG_PLAYER,"MSG2",name)
	server_cmd("kick #%d ^"%L", LANG_PLAYER, "MSG4", get_user_userid(id))
	log_amx("HPK: ^"%s<%d><%s>^" was kicked due high ping (Average Ping ^"%d^")", name,get_user_userid(id),authid,(g_Ping[id] / g_Samples[id]))
}

public checkPing(param[]) { 

	if (get_pcvar_num(hpk_tests) < 3)
		set_pcvar_num(hpk_tests,3)

	new id = param[ 0 ] 

	if ( get_user_flags(id) & HPK_IMMUNE && get_pcvar_num(hpk_immunity) == 1 ) {
		remove_task(id)
		client_print_color(id, id, "%L", LANG_PLAYER, "MSG3")
		return PLUGIN_CONTINUE
	}

	new ping, loss

	get_user_ping(id,ping,loss) 

	g_Ping[ id ] += ping
	++g_Samples[ id ]

	if ( (g_Samples[ id ] > get_pcvar_num(hpk_tests)) && (g_Ping[id] / g_Samples[id] > get_pcvar_num(hpk_ping))  )    
		kickPlayer(id)

	return PLUGIN_CONTINUE
}

  
public cmdHpk(id,level,cid) {
	if (!cmd_access(id,level,cid,1))
		return PLUGIN_HANDLED

	if (read_argc() < 6) {
		console_print(id,"Usage: amx_hpk <max ping> <total ping checks> <time between checks> <delay before starting checks> <1 to allow immunity|0 to disallow")
		console_print(id,"Current High Ping Kicker Settings:")
		console_print(id,"Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d",get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))
		return PLUGIN_HANDLED
	}

	new name[32], authid[36]
	get_user_name(id,name,31)
	get_user_authid(id,authid,35)

	new ping_arg[5], check_arg[5], tests_arg[5], delay_arg[5], immune_arg[5]
	read_argv(1,ping_arg,4)
	read_argv(2,tests_arg,4)
	read_argv(3,check_arg,4)
	read_argv(4,delay_arg,4)
	read_argv(5,immune_arg,4)
  
	new ping = str_to_num(ping_arg)
	new tests = str_to_num(tests_arg)
	new check = str_to_num(check_arg)
	new delay = str_to_num(delay_arg)
	new immune = str_to_num(immune_arg)

	if ( check < 5 ) check = 5
	if ( tests < 3 ) tests = 3

	set_pcvar_num(hpk_ping,ping)
	set_pcvar_num(hpk_tests,tests)
	set_pcvar_num(hpk_check,check)
	set_pcvar_num(hpk_delay,delay)
	set_pcvar_num(hpk_immunity,immune)

	console_print(id,"The following HPK Settings have been set:")
	console_print(id,"Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d",get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))
	log_amx("HPK: ^"%s<%d><%s>^" has configured the HPK - Max Ping: %d | Ping Checks: %d | Check Frequency: %d | Start Delay: %d | Immunity: %d", name,get_user_userid(id),authid,get_pcvar_num(hpk_ping),get_pcvar_num(hpk_tests),get_pcvar_num(hpk_check),get_pcvar_num(hpk_delay),get_pcvar_num(hpk_immunity))

	return PLUGIN_HANDLED    
}
Code:
[en]
MSG_TEST= !gPlayers with a ping higher than %d ms will be kicked from the server.
MSG2= !gPlayer %s was kicked because of high ping.
MSG3= !gPlayers with immunity won't be checked of their ping.
MSG4= !gYou were kicked from the server due to high ping.
The colors work in other plugins, but in these they don't. What am I doing wrong?

Last edited by Adomaz1; 07-11-2016 at 07:58.
Adomaz1 is offline
Adomaz1
Senior Member
Join Date: Feb 2014
Old 07-11-2016 , 07:58   Re: Colors don't work.
Reply With Quote #2

please help, I still couldn't fix it :c

EDIT:

I've been waiting all night for help,
I've been fixing this stuff all day yesterday and today,
I've lost my mind and I didn't know what is wrong with it,
and the colors didn't work because it had to be not !g !n !t, but ^1, ^3, ^4.

I so want to kill myself now.

Last edited by Adomaz1; 07-11-2016 at 08:03.
Adomaz1 is offline
abdobiskra
Veteran Member
Join Date: Jul 2014
Location: Algeria
Old 07-11-2016 , 08:36   Re: Colors don't work.
Reply With Quote #3

The first possibility
Quote:
MSG= "!g[VIP] !t%s !nconnected to the server. Welcome him!"
!r = red color
!g = green color
!b = blue color

what do u want by using (!t + !n ) ? wich color ?!
so try replace other color like this

PHP Code:
MSG"!g[VIP] !r%s !bconnected to the server. Welcome him!" 
check it im not sure (if operated so your problem is here

-------------------------------------------------------------
The second possibility

Quote:
Tried to add ^1 to %L, colors didn't work.
try it like this !

^^1 , ^^2 , ^^3 ....
and
PHP Code:
 client_print(0print_chat"%L"LANG_PLAYER"MSG"name
------------------------------------------------------

The third possibility

check your game !

"""""""""""""""""""""""""""""""""""
All this just doubts i dunno
__________________

Last edited by abdobiskra; 07-11-2016 at 08:40.
abdobiskra is offline
Send a message via Skype™ to abdobiskra
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 07-11-2016 , 09:25   Re: Colors don't work.
Reply With Quote #4

Is the game Counter-Strike?
__________________
gabuch2 is offline
Old 07-11-2016, 09:58
OciXCrom
This message has been deleted by OciXCrom.
Zynda
Member
Join Date: Jul 2011
Old 07-11-2016 , 18:53   Re: Colors don't work.
Reply With Quote #5

Quote:
Originally Posted by Shattered Heart Lynx View Post
Is the game Counter-Strike?
From the API on client_print_color:

This only works in Counter-Strike 1.6 and Condition Zero.

So it must be either one of those i assume.
Zynda is offline
gabuch2
AlliedModders Donor
Join Date: Mar 2011
Location: Chile
Old 07-11-2016 , 20:30   Re: Colors don't work.
Reply With Quote #6

Quote:
Originally Posted by Zynda View Post
From the API on client_print_color:

This only works in Counter-Strike 1.6 and Condition Zero.

So it must be either one of those i assume.
Yeah I was asking because he might be trying to make it work in a non-CS game, where color chat is not implemented.
__________________
gabuch2 is offline
siriusmd99
Veteran Member
Join Date: Oct 2013
Location: Republic of Moldova
Old 07-12-2016 , 02:31   Re: Colors don't work.
Reply With Quote #7

Adomaz, if you try to show message directly, without using dictionary file then it works or not?

And show your chatcolor.inc file.
And why dont you use default colorchat.inc ,where you use ^4 as green, ^3 as team color and ^1 as normal.Why?

Last edited by siriusmd99; 07-12-2016 at 02:35.
siriusmd99 is offline
Adomaz1
Senior Member
Join Date: Feb 2014
Old 07-12-2016 , 04:38   Re: Colors don't work.
Reply With Quote #8

Everything is working now.

Without dictionary it works as a charm. I usually use !g, !t and !n, but now it wanted that I would use ^4 ^1

The game is cs1.6
Adomaz1 is offline
Napoleon_be
Veteran Member
Join Date: Jul 2011
Location: Belgium
Old 07-12-2016 , 06:04   Re: Colors don't work.
Reply With Quote #9

Quote:
Originally Posted by Adomaz1 View Post
Everything is working now.

Without dictionary it works as a charm. I usually use !g, !t and !n, but now it wanted that I would use ^4 ^1

The game is cs1.6
Depends on which colorchat include you're using. There are also stocks which convert ^4 into !g and stuff like that.
__________________
Napoleon_be is offline
Send a message via Skype™ to Napoleon_be
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 01:47.


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