AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved GetClientIP not return client ip on local server l4d2 (https://forums.alliedmods.net/showthread.php?t=328003)

greed35 10-20-2020 16:42

GetClientIP not return client ip on local server l4d2
 
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);
}



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

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