View Single Post
Author Message
greed35
New Member
Join Date: Aug 2018
Old 10-20-2020 , 16:42   GetClientIP not return client ip on local server l4d2
Reply With Quote #1

Hello that is my first time here my doubt is why my code not return name of country people connected on my local server in l4d2

my code is

Code:
#include <sourcemod>
#include <sdktools>
#include <geoip>


int  randomnum = 0;
float  count = 0;


public Action pingmask(Handle timer, any client)
{	
	count += 0.5;
	SetEntProp(GetPlayerResourceEntity(), Prop_Send, "m_iPing", randomnum,_,client);
	
	if(count > 300.0)
	{
		PrintToChatAll( "\x04Escreva \x03!sm \x04no chat para mutar ou desmutar um jogador escolhido");
		count = 0;
	}
	
	return Plugin_Continue;
}



public void OnClientPostAdminCheck(int client)
{
	
	char clientip[32],country[46],name[32],authid[35];
	
	if (!IsClientInGame(client)) 	return;
	
	GetClientAuthString(client,authid,34);
	GetClientName(client, name,31);
	PrintToChat(client, "\x04Escreva \x03!sm \x04no chat para mutar ou desmutar um jogador escolhido");
	
	
	if(CheckCommandAccess(client, "sm_ban", ADMFLAG_BAN))
		{
			randomnum = GetRandomInt(143, 175);
			CreateTimer(0.5, pingmask, client, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
			Format(clientip, sizeof(clientip), Steam_GetPublicIP());
			//PrintToChatAll("\x04%s",clientip);
			GeoipCountry(clientip, country, sizeof(country));
			
		}
	else
		{
			GetClientIP(client, clientip, sizeof(clientip));
			PrintToChatAll("\x03%s",clientip);
			GeoipCountry(clientip, country, sizeof(country));
		}
		
	if(!StrEqual(authid,"BOT"))
	PrintToChatAll("\x01\x04%s (\x01%s\x04) connected from \x03%s",name,authid,country);
}

Last edited by greed35; 10-20-2020 at 16:49.
greed35 is offline