Страница 1 от 1

Connect Info Problem

Публикувано на: 04 Ное 2019, 10:16
от lantimilan
Hello i have one plugin to show witch connect in server but i want to change something, plugin have very much code i dont like
I like to tell when connect , player,vip,owner with flag normaly player default,vip with kick acess and owner with rcon acces
P.S [Connect Info] Player nick connect in server from [country][city]
P.S [Connect Info] V.I.P nick connect in server from [country][city]
P.S [Connect Info] Owner nick connect in server from [country][city]

Код за потвърждение: Избери целия код

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <geoip>


//YOUR SERVER PREFIX HERE
#define PREFIX "DeathMatch Konektimi"

#define DP_AUTH_NONE 		0
#define DP_AUTH_DPROTO		1
#define DP_AUTH_STEAM		2
#define DP_AUTH_STEAMEMU	3
#define DP_AUTH_REVEMU		4
#define DP_AUTH_OLDREVEMU	5
#define DP_AUTH_HLTV		6
#define DP_AUTH_SC2009		7
#define DP_AUTH_AVSMP		8
#define DP_AUTH_SXEI		9
#define DP_AUTH_REVEMU2013	10
#define DP_AUTH_SSE3		11



new g_iMsgSayText;
new connect;

new pcv_dp_r_protocol
new pcv_dp_r_id_provider


public plugin_init() {
	register_plugin("Connect, "1.0", "aNoool");
	
	// ColorChat
	g_iMsgSayText = get_user_msgid("SayText");
	
	// Enable and disable cvars
	connect = register_cvar("amx_connect_message", "1");
	
	pcv_dp_r_protocol = get_cvar_pointer ("dp_r_protocol")
	pcv_dp_r_id_provider = get_cvar_pointer ("dp_r_id_provider")
	
}

public client_putinserver(id){
	if(get_pcvar_num(connect) == 0)
		return PLUGIN_HANDLED
	
	set_task(2.0,"ShowMsg",id);
	
	return PLUGIN_HANDLED
}
public client_disconnect(id)
{
	if(task_exists(id))
		remove_task(id);
}
public ShowMsg(id)
{
	if(!is_user_connected(id))
		return PLUGIN_HANDLED
	static name[32];
	static ip[16];
	static country[45];
	static city[45];
	static region[45]
	
	// DPROTO
	server_cmd("dp_clientinfo %d", id)
	server_exec()
	new proto = get_pcvar_num(pcv_dp_r_protocol)
	new authprov = get_pcvar_num(pcv_dp_r_id_provider)
	new auth_prov_str[32]
	switch (authprov)
	{
		case DP_AUTH_NONE: copy(auth_prov_str, 32, "N/A") //slot is free
		
			case DP_AUTH_DPROTO: copy(auth_prov_str, 32, "Non-Steam")
			
			case DP_AUTH_STEAM: copy(auth_prov_str, 32, "Steam")
			
			case DP_AUTH_STEAMEMU: copy(auth_prov_str, 32, "Non-Steam")
			
			case DP_AUTH_REVEMU: copy(auth_prov_str, 32, "Non-Steam")
			
			case DP_AUTH_OLDREVEMU: copy(auth_prov_str, 32, "Non-Steam")
			
			case DP_AUTH_HLTV: copy(auth_prov_str, 32, "HLTV")	
			
			case DP_AUTH_SC2009: copy(auth_prov_str, 32, "Non-Steam")
			
			case DP_AUTH_AVSMP: copy(auth_prov_str, 32, "Non-Steam")
			
			case DP_AUTH_SXEI: copy(auth_prov_str, 32, "Non-Steam")
			
			case DP_AUTH_REVEMU2013: copy(auth_prov_str, 32, "Non-Steam")
			
			case DP_AUTH_SSE3: copy(auth_prov_str, 32, "Non-Steam")
			
			default: copy(auth_prov_str, 32, "Erroneous") //-1 if slot id is invalid
	}
	
	
	get_user_name(id, name, charsmax(name));
	get_user_ip(id, ip, charsmax(ip), 1);
	geoip_country(ip, country, charsmax(country));
	geoip_city(ip, city, charsmax(city));
	geoip_region_name(ip,region,sizeof region,id)
	if(equal(city,"") || equali(city,"error") )
	{
		ChatColor(0, "!n[!g%s!n] Lojtari !g%s!n hyri nga !g%s!g",PREFIX , name, country); 
	}
	else if(equal(region,""))
	{
		ChatColor(0, "!n[!g%s!n] Lojtari !g%s!n hyri nga !g%s!g, !t%s",PREFIX , name, country, city); 
	}
	else
	{
		ChatColor(0, "!n[!g%s!n] Lojtari !g%s!n hyri nga [!g%s!n]!g, !n[!g%s!n]!g, !n[!g%s!n]",PREFIX, name, country, region, city);
	}
	return PLUGIN_HANDLED
}
// ColorChat
stock ChatColor(const id, const input[], any:...)
{
	new count = 1, players[32]
	static msg[191]
	vformat(msg, 190, input, 3)
	
	replace_all(msg, 190, "!g", "^4") // Green Color
	replace_all(msg, 190, "!n", "^1") // Default Color
	replace_all(msg, 190, "!t", "^3") // Team Color
	
	
	if (id) players[0] = id; else get_players(players, count, "ch")
{
	for (new i = 0; i < count; i++)
	{
		if (is_user_connected(players[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText, _, players[i])  
			write_byte(players[i]);
			write_string(msg);
			message_end();
		}
	}
}
}  

Connect Info Problem

Публикувано на: 04 Ное 2019, 21:07
от User12
I didn't understand what do you want ! But try this code , if it doesn't work for you , tell me what must be changed .

Код за потвърждение: Избери целия код

#include <amxmodx>
#include <cromchat>
#include <geoip>

#define Owner	ADMIN_RCON 			// Here is the Owner Flag
#define VIP	ADMIN_KICK  			// Here is the VIP Flag
#define Player	ADMIN_USER			// Here is the Player Flag

public plugin_unit()
{
	register_plugin("Connect Players , Admin & Vip", "1.0", "Logitechz")
	
}

public client_connect(id)
{
	new szName[32]
	static country[45]
	static city[45]
	static ip[16]
	geoip_country(ip, country, charsmax(country))
	geoip_city(ip, city, charsmax(city))
	get_user_name(id, szName, charsmax(szName))
	
	if (get_user_flags(id) & Owner)
	{
		CC_SendMessage(0, "[Connect Info] Owner %s connect in server from [%s][%s]", szName, country, city)
	}
	else if (get_user_flags(id) & VIP) 
	{
		CC_SendMessage(0, "[Connect Info] V.I.P %s connect in server from [%s][%s]", szName, country, city)
	}
	else if (get_user_flags(id) & Player) 
	{
		CC_SendMessage(0, "[Connect Info] Player %s connect in server from [%s][%s]", szName, country, city)
	}
}

Connect Info Problem

Публикувано на: 04 Ное 2019, 21:12
от lantimilan
Yes this is what i ask, i have GeoLite2-Country.mmdb he support and city ?

Connect Info Problem

Публикувано на: 04 Ное 2019, 21:16
от User12
lantimilan написа: 04 Ное 2019, 21:12 Yes this is what i ask, i have GeoLite2-Country.mmdb he support and city ?
It should support it , try it and if it's not working try to update it to the newest version .

Connect Info Problem

Публикувано на: 05 Ное 2019, 00:28
от OciXCrom
@User12:

Код за потвърждение: Избери целия код

if (!get_user_flags(id))
This means that the player doesn't have any flags. This will likely never happen. A normal player has only the "z" flag, so do:

Код за потвърждение: Избери целия код

if (get_user_flags(id) & ADMIN_USER)
Also, you should first check the higher ranks, and then the lower ones.

Connect Info Problem

Публикувано на: 05 Ное 2019, 02:32
от User12
I did change my code , so the author of the topic can see it , and i see where i was mistake . Иначе благодаря за забележката Кроме , просто съм го забравил това .

Connect Info Problem

Публикувано на: 05 Ное 2019, 02:40
от mi0
Също, тези статични променливи не са нужни.

Connect Info Problem

Публикувано на: 05 Ное 2019, 04:28
от User12
Имаш предвид , че ще е по добре да използвам new вместо static ?

Connect Info Problem

Публикувано на: 05 Ное 2019, 04:55
от mi0
Точно така. Тук е обяснено защо https://forums.alliedmods.net/showthrea ... 40&page=30