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

GHW Connect Messages


Post New Thread Reply   
 
Thread Tools Display Modes
MrGarfield
Senior Member
Join Date: Feb 2013
Old 09-02-2020 , 14:53   Re: GHW Connect Messages
Reply With Quote #121

great it works no more error thank you
MrGarfield is offline
jcalbamonte
New Member
Join Date: Oct 2020
Old 10-27-2020 , 06:43   Re: GHW Connect Messages
Reply With Quote #122

Quote:
Originally Posted by GHW_Chronic View Post
  • This plugin shows connection messages when a player connects/disconnects.

Features:
  • Colored Text
  • Customizable
  • Connect/Disconnect Sounds

CVARs:
  • cm_connect_string - String that is displayed when a player connects
    • Default: "[AMXX] %name (%steamid) has connected (%country)."
  • cm_disconnect_string - String that is displayed when a player disconnects
    • Default: "[AMXX] %name (%steamid) has disconnected (%country)."
  • cm_flags - Flags for Customizing (Add the numbers up)
    • 1 - SHOW_COLOR (green)
    • 2 - SHOW_CONNECT
    • 4 - SHOW_DISCONNECT
    • 8 - PLAY_SOUND_CONNECT
    • 16 - PLAY_SOUND_DISCONNECT
    • Default: 31 (All)
  • cm_connect_sound - Sound file that is played on connect
    • Default: "buttons/bell1.wav" (Half-Life Sound)
  • cm_disconnect_sound - Sound file that is played on disconnect
    • Default: "fvox/blip.wav" (Half-Life Sound)

String Replace Characters:
  • %name - replaced with (dis)connecting player's name
  • %country - replaced with (dis)connecting player's country
  • %steamid - replaced with (dis)connecting player's steamid
  • %ip - replaced with (dis)connecting player's ip

Default Connect Message Appears As:
  • [AMXX] Name (STEAMID) has connected (country).


sorry for my bad English:

currently this plugin works? or did they make any changes to the following pages?

sorry for my english, I'm still learning. Greetings.
jcalbamonte is offline
romeo72
Member
Join Date: Oct 2021
Old 12-22-2021 , 07:33   Re: GHW Connect Messages
Reply With Quote #123

Hi, everyone,

I have a question and I want only the color to be displayed and the connect function to be used.
if I understood that correctly, then I would have to set the flag to 3 right?

Quote:
cm_flags - Flags for Customizing (Add the numbers up)
1 - SHOW_COLOR (green)
2 - SHOW_CONNECT
if that is correct, then it still shows me the disconnect. the sound is also played when connecting and disconnecting.

my changed code:
Code:
/*
*   _______     _      _  __          __
*  | _____/    | |    | | \ \   __   / /
*  | |         | |    | |  | | /  \ | |
*  | |         | |____| |  | |/ __ \| |
*  | |   ___   | ______ |  |   /  \   |
*  | |  |_  |  | |    | |  |  /    \  |
*  | |    | |  | |    | |  | |      | |
*  | |____| |  | |    | |  | |      | |
*  |_______/   |_|    |_|  \_/      \_/
*
*
*
*  Last Edited: 12-06-09
*
*  ============
*   Changelog:
*  ============
*
*  v1.1
*    -Bug Fixes
*
*  v1.0
*    -Initial Release
*
*/

#define VERSION	"1.1"

#include <amxmodx>
#include <amxmisc>
#include <geoip>

#define SHOW_COLOR		1
#define SHOW_CONNECT		2
#define SHOW_DISCONNECT		4
#define PLAY_SOUND_CONNECT	8
#define PLAY_SOUND_DISCONNECT	16

new display_type_pcvar

new name[33][32]
new authid[33][32]
new country[33][46]
new ip[33][32]

new connect_soundfile[64]
new disconnect_soundfile[64]

new saytext_msgid

public plugin_init()
{
	register_plugin("GHW Connect Messages",VERSION,"GHW_Chronic")
	display_type_pcvar = register_cvar("cm_flags","3")
	register_cvar("cm_connect_string","[AMXX] %name (%steamid) has connected (%country).")
	register_cvar("cm_disconnect_string","[AMXX] %name (%steamid) has disconnected (%country).")

	saytext_msgid = get_user_msgid("SayText")
}

public plugin_precache()
{
	register_cvar("cm_connect_sound","buttons/bell1.wav")
	register_cvar("cm_disconnect_sound","fvox/blip.wav")

	get_cvar_string("cm_connect_sound",connect_soundfile,63)
	get_cvar_string("cm_disconnect_sound",disconnect_soundfile,63)

	precache_sound(connect_soundfile)
	precache_sound(disconnect_soundfile)
}

public client_putinserver(id)
{
	if(!is_user_bot(id))
	{
		get_client_info(id)

		new display_type = get_pcvar_num(display_type_pcvar)
		if(display_type & SHOW_CONNECT)
		{
			new string[200]
			get_cvar_string("cm_connect_string",string,199)
			format(string,199,"^x01%s",string)

			if(display_type & SHOW_COLOR)
			{
				new holder[46]

				format(holder,45,"^x04%s^x01",name[id])
				replace(string,199,"%name",holder)

				format(holder,45,"^x04%s^x01",authid[id])
				replace(string,199,"%steamid",holder)

				format(holder,45,"^x04%s^x01",country[id])
				replace(string,199,"%country",holder)

				format(holder,45,"^x04%s^x01",ip[id])
				replace(string,199,"%ip",holder)
			}
			else
			{
				replace(string,199,"%name",name[id])
				replace(string,199,"%steamid",authid[id])
				replace(string,199,"%country",country[id])
				replace(string,199,"%ip",ip[id])
			}

			new num, players[32], player
			get_players(players,num,"ch")
			for(new i=0;i<num;i++)
			{
				player = players[i]

				message_begin(MSG_ONE,saytext_msgid,{0,0,0},player)
				write_byte(player)
				write_string(string)
				message_end()

				if(display_type & PLAY_SOUND_CONNECT)
				{
					new stringlen = strlen(connect_soundfile)
					if(connect_soundfile[stringlen - 1]=='v' && connect_soundfile[stringlen - 2]=='a' && connect_soundfile[stringlen - 3]=='w') //wav
					{
						client_cmd(player,"spk ^"sound/%s^"",connect_soundfile)
					}
					if(connect_soundfile[stringlen - 1]=='3' && connect_soundfile[stringlen - 2]=='p' && connect_soundfile[stringlen - 3]=='m') //wav
					{
						client_cmd(player,"mp3 play ^"sound/%s^"",connect_soundfile)
					}
				}
			}
		}
	}
}

public get_client_info(id)
{
	get_user_name(id,name[id],31)
	get_user_authid(id,authid[id],31)

	get_user_ip(id,ip[id],31)
	geoip_country(ip[id],country[id])
	if(equal(country[id],"error"))
	{
		if(contain(ip[id],"192.168.")==0 || equal(ip[id],"127.0.0.1") || contain(ip[id],"10.")==0 ||  contain(ip[id],"172.")==0)
		{
			country[id] = "LAN"
		}
		if(equal(ip[id],"loopback"))
		{
			country[id] = "ListenServer User"
		}
		else
		{
			country[id] = "Unknown Country"
		}
	}
}

public client_infochanged(id)
{
	if(!is_user_bot(id))
	{
		get_user_info(id,"name",name[id],31)
	}
}

public client_disconnect(id)
{
	if(!is_user_bot(id))
	{
		new display_type = get_pcvar_num(display_type_pcvar)
		if(display_type & SHOW_DISCONNECT)
		{
			new string[200]
			get_cvar_string("cm_disconnect_string",string,199)
			format(string,199,"^x01%s",string)

			if(display_type & SHOW_COLOR)
			{
				new holder[46]

				format(holder,45,"^x04%s^x01",name[id])
				replace(string,199,"%name",holder)

				format(holder,45,"^x04%s^x01",authid[id])
				replace(string,199,"%steamid",holder)

				format(holder,45,"^x04%s^x01",country[id])
				replace(string,199,"%country",holder)

				format(holder,45,"^x04%s^x01",ip[id])
				replace(string,199,"%ip",holder)
			}
			else
			{
				replace(string,199,"%name",name[id])
				replace(string,199,"%steamid",authid[id])
				replace(string,199,"%country",country[id])
				replace(string,199,"%ip",ip[id])
			}

			new num, players[32], player
			get_players(players,num,"ch")
			for(new i=0;i<num;i++)
			{
				player = players[i]

				message_begin(MSG_ONE,saytext_msgid,{0,0,0},player)
				write_byte(player)
				write_string(string)
				message_end()

				new stringlen = strlen(disconnect_soundfile)
				if(disconnect_soundfile[stringlen - 1]=='v' && disconnect_soundfile[stringlen - 2]=='a' && disconnect_soundfile[stringlen - 3]=='w') //wav
				{
					client_cmd(player,"spk ^"sound/%s^"",disconnect_soundfile)
				}
				if(disconnect_soundfile[stringlen - 1]=='3' && disconnect_soundfile[stringlen - 2]=='p' && disconnect_soundfile[stringlen - 3]=='m') //wav
				{
					client_cmd(player,"mp3 play ^"sound/%s^"",disconnect_soundfile)
				}
			}
		}
	}
}

can someone tell me where I'm making the mistake?

best regards
__________________
romeo72 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 12-24-2021 , 14:48   Re: GHW Connect Messages
Reply With Quote #124

Changing cvar values in the code itself has no effect if the plugin was already installed in your server.
You need to add the cvar in configs/amxx.cfg with the new value in order for it to take effect.

There would be no point in cvars existing if you could change them via the code.
__________________

Last edited by OciXCrom; 12-24-2021 at 14:49.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
scandi
New Member
Join Date: Dec 2022
Old 12-26-2022 , 14:46   Re: GHW Connect Messages
Reply With Quote #125

Hi. I'm using this amxx plugin and it works great !
Now i just want to disable the default's line "Player has joined the game/left the game" because i see 2 messages when somebody joins or leaves the server. Can anyone help me ?
scandi is offline
Reply


Thread Tools
Display Modes

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 08:39.


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