Raised This Month: $62 Target: $400
 15% 

[ANY] Whois


Post New Thread Reply   
 
Thread Tools Display Modes
Author
JiSH
Junior Member
Join Date: Oct 2018
Location: India-West Bengal
Plugin ID:
6593
Plugin Version:
1.2.5
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Gives a detailed description about a client.
    Old 06-04-2019 , 11:24   [ANY] Whois
    Reply With Quote #1

    [ANY] WHOIS

    Requested by LnG : https://forums.alliedmods.net/showthread.php?p=2654270
    So, Plugin is here!

    Commands:
    sm_whois <playername> or !whois <playername> in chat.

    Output:
    Output is like, Playername Now, Playername when entered server first, Steamid, IP, Client has Adminship or not.
    Old names are stored in sourcemod/data/whoisdb.txt

    Note : Colors will not work on CS:GO(Tested).

    Screenshot:


    To Do:
    1. Colors on CS:GO

    Changelogs:
    1.2.5 - Fixes of semicolons, and closed KeyValues Handles...
    1.2.0 - First Release.
    Attached Files
    File Type: sp Get Plugin or Get Source (whois.sp - 31 views - 4.3 KB)

    Last edited by JiSH; 06-09-2019 at 10:44.
    JiSH is offline
    Bara
    AlliedModders Donor
    Join Date: Apr 2012
    Location: Germany
    Old 06-04-2019 , 11:36   Re: [ANY] Whois
    Reply With Quote #2

    You should close the keyvalues handle after usage (delete <handle>) and you don't need to attach the smx files, since you don't use any includes from 3rd.
    __________________
    Bara is offline
    JiSH
    Junior Member
    Join Date: Oct 2018
    Location: India-West Bengal
    Old 06-04-2019 , 11:39   Re: [ANY] Whois
    Reply With Quote #3

    Quote:
    Originally Posted by Bara View Post
    You should close the keyvalues handle after usage (delete <handle>) and you don't need to attach the smx files, since you don't use any includes from 3rd.
    Got it
    JiSH is offline
    Cruze
    Senior Member
    Join Date: May 2017
    Old 06-04-2019 , 14:39   Re: [ANY] Whois
    Reply With Quote #4

    Quote:
    Originally Posted by Bara View Post
    You should close the keyvalues handle after usage (delete <handle>) and you don't need to attach the smx files, since you don't use any includes from 3rd.
    Quote:
    Originally Posted by JiSH View Post
    Got it
    PHP Code:
    #include <sourcemod>

    #pragma semicolon 1
    #pragma newdecls required

    char clienthasadmin[1024];
    char enteringoldname[1024];
    char oldname[1024];

    public 
    Plugin myinfo 
    {
        
    name        "WhoIS",
        
    author      "JiSH",
        
    description "Full Detail About a Client.",
        
    version     "1.2.1",
        
    url         ""
    };

    public 
    void OnPluginStart()
    {
        
    RegConsoleCmd("sm_whois"cmd_whois);
    }

    public 
    void OnClientAuthorized(int client)
    {
        
    char clientnameconnected[512];
        
    char clientid[512];
        
    char tempoldname[512];
        
    GetClientName(clientclientnameconnectedsizeof(clientnameconnected));
        
    GetClientAuthId(clientAuthId_Engineclientidsizeof(clientid));
        
        
    //Get Oldest Name
        
    KeyValues kv = new KeyValues("WhoisDB"); 
        
    char sPath[PLATFORM_MAX_PATH]; 

        
    BuildPath(Path_SMsPathsizeof(sPath), "data/whoisdb.txt"); 
        
    kv.ImportFromFile(sPath); 
        
    kv.GoBack();
        
    kv.JumpToKey(clientidtrue);
        
    kv.GetString(clientidtempoldnamesizeof(oldname), "no");
        
    kv.GoBack();
        
    delete kv;
        
    Format(oldnamesizeof(oldname), tempoldname);
        if (
    strlen(oldname) == 2)
        {
            
    // If not found Make Database and Load OldName
            
    Handle KV_Save CreateKeyValues("WhoisDB");
            
    FileToKeyValues(KV_Save"addons/sourcemod/data/whoisdb.txt");
            
    KvJumpToKey(KV_Saveclientidtrue);
            
    KvSetString(KV_Saveclientidclientnameconnected);
            
    KvRewind(KV_Save);
            
    KeyValuesToFile(KV_Save"addons/sourcemod/data/whoisdb.txt"); 
            
    KvGoBack(KV_Save);
            
    KvJumpToKey(KV_Saveclientidtrue);
            
    KvGetString(KV_Saveclientidtempoldnamesizeof(oldname));
            
    CloseHandle(KV_Save); 
            
    Format(oldnamesizeof(oldname), tempoldname);
        }
        
    //Get Oldest Name
        
    KeyValues kvjoin = new KeyValues("WhoisDB"); 
        
    BuildPath(Path_SMsPathsizeof(sPath), "data/whoisdb.txt"); 
        
    kvjoin.ImportFromFile(sPath); 
        
    kvjoin.GoBack();
        
    kvjoin.JumpToKey(clientidtrue);
        
    kvjoin.GetString(clientidtempoldnamesizeof(oldname), "no");
        
    kvjoin.GoBack();
        
    delete kvjoin;
        
    Format(enteringoldnamesizeof(enteringoldname), tempoldname);
        
    PrintToChatAll(" \x04[\x03Whois\x04] \x01Client \x03%s \x01entered the server. Old Name : \x03%s"clientnameconnectedenteringoldname);
        
    PrintToServer("[Whois] Client %s entered the server. Old Name: %s"clientnameconnectedenteringoldname);
    }

    public 
    Action cmd_whois(int clientint args)
    {
        if (
    args 1)
        {
            
    PrintToChat(client" \x04[\x03Whois\x04] \x01Usage: !whois \x03<player name>");
        }
        if (
    args == 1)
        {
            
    //Initial Action
            
    char TargetString[100]; 
            
    GetCmdArg(1TargetString100); 
            
    int[] Clients = new int[MaxClients]; 
            
    char TargetName[100];
            
    bool tn_is_ml
            
    int ValidClients ProcessTargetString(TargetStringclientClientsMaxClientsCOMMAND_FILTER_NO_IMMUNITYTargetNamesizeof(TargetName), tn_is_ml);
            
    int PlayerClient
            
    char ClientName[100]; 
            for (
    int i 0ValidClientsi++) 
            { 
                
    PlayerClient Clients[i];
                
    GetClientName(PlayerClientClientNamesizeof(ClientName));
            }
            
    char steamid[256];
            
    char ip[256];
            
    Format(clienthasadminsizeof(clienthasadmin), "No.");
            if (
    GetUserFlagBits(PlayerClient) != 0)
            {
                
    Format(clienthasadminsizeof(clienthasadmin), "Yes.");
            }
            
    char clientidtarget[512];
            
    char tempoldname[512];
            
    GetClientAuthId(PlayerClientAuthId_Engineclientidtargetsizeof(clientidtarget));

            
    //Get Oldest Name
            
    KeyValues kv = new KeyValues("WhoisDB"); 
            
    char sPath[PLATFORM_MAX_PATH]; 
            
    BuildPath(Path_SMsPathsizeof(sPath), "data/whoisdb.txt"); 

            
    kv.ImportFromFile(sPath); 
            
    kv.GoBack();
            
    kv.JumpToKey(clientidtargettrue);
            
    kv.GetString(clientidtargettempoldnamesizeof(oldname), "no");
            
    kv.GoBack();
            
    delete kv;
            
    Format(oldnamesizeof(oldname), tempoldname);

            
    GetClientAuthId(PlayerClientAuthId_Enginesteamidsizeof(steamid));
            
    GetClientIP(PlayerClientipsizeof(ip));
            
    PrintToChat(client" \x04[\x03Whois\x04] \x03Player Name: %s"ClientName);
            
    PrintToChat(client" \x03              Oldest Name: %s"oldname);
            
    PrintToChat(client" \x03              SteamID: %s"steamid);
            
    PrintToChat(client" \x03              IP: %s\n\x03               Adminship: %s"ipclienthasadmin);
        }
        if (
    args 1)
        {
            
    PrintToChat(client" \x04[\x03Whois\x04] \x01Invalid Usage.");
        }

    __________________
    Taking paid private requests! Add me on steam!

    Discord: Cruze#4947 | AlliedModders Releases | Github | Steam | PayPal

    Last edited by Cruze; 06-04-2019 at 15:35. Reason: Should fix the "colors not working in CSGO" bug
    Cruze is offline
    JiSH
    Junior Member
    Join Date: Oct 2018
    Location: India-West Bengal
    Old 06-04-2019 , 18:06   Re: [ANY] Whois
    Reply With Quote #5

    Quote:
    Originally Posted by Cruze View Post
    PHP Code:
    #include <sourcemod>

    #pragma semicolon 1
    #pragma newdecls required

    char clienthasadmin[1024];
    char enteringoldname[1024];
    char oldname[1024];

    public 
    Plugin myinfo 
    {
        
    name        "WhoIS",
        
    author      "JiSH",
        
    description "Full Detail About a Client.",
        
    version     "1.2.1",
        
    url         ""
    };

    public 
    void OnPluginStart()
    {
        
    RegConsoleCmd("sm_whois"cmd_whois);
    }

    public 
    void OnClientAuthorized(int client)
    {
        
    char clientnameconnected[512];
        
    char clientid[512];
        
    char tempoldname[512];
        
    GetClientName(clientclientnameconnectedsizeof(clientnameconnected));
        
    GetClientAuthId(clientAuthId_Engineclientidsizeof(clientid));
        
        
    //Get Oldest Name
        
    KeyValues kv = new KeyValues("WhoisDB"); 
        
    char sPath[PLATFORM_MAX_PATH]; 

        
    BuildPath(Path_SMsPathsizeof(sPath), "data/whoisdb.txt"); 
        
    kv.ImportFromFile(sPath); 
        
    kv.GoBack();
        
    kv.JumpToKey(clientidtrue);
        
    kv.GetString(clientidtempoldnamesizeof(oldname), "no");
        
    kv.GoBack();
        
    delete kv;
        
    Format(oldnamesizeof(oldname), tempoldname);
        if (
    strlen(oldname) == 2)
        {
            
    // If not found Make Database and Load OldName
            
    Handle KV_Save CreateKeyValues("WhoisDB");
            
    FileToKeyValues(KV_Save"addons/sourcemod/data/whoisdb.txt");
            
    KvJumpToKey(KV_Saveclientidtrue);
            
    KvSetString(KV_Saveclientidclientnameconnected);
            
    KvRewind(KV_Save);
            
    KeyValuesToFile(KV_Save"addons/sourcemod/data/whoisdb.txt"); 
            
    KvGoBack(KV_Save);
            
    KvJumpToKey(KV_Saveclientidtrue);
            
    KvGetString(KV_Saveclientidtempoldnamesizeof(oldname));
            
    CloseHandle(KV_Save); 
            
    Format(oldnamesizeof(oldname), tempoldname);
        }
        
    //Get Oldest Name
        
    KeyValues kvjoin = new KeyValues("WhoisDB"); 
        
    BuildPath(Path_SMsPathsizeof(sPath), "data/whoisdb.txt"); 
        
    kvjoin.ImportFromFile(sPath); 
        
    kvjoin.GoBack();
        
    kvjoin.JumpToKey(clientidtrue);
        
    kvjoin.GetString(clientidtempoldnamesizeof(oldname), "no");
        
    kvjoin.GoBack();
        
    delete kvjoin;
        
    Format(enteringoldnamesizeof(enteringoldname), tempoldname);
        
    PrintToChatAll(" \x04[\x03Whois\x04] \x01Client \x03%s \x01entered the server. Old Name : \x03%s"clientnameconnectedenteringoldname);
        
    PrintToServer("[Whois] Client %s entered the server. Old Name: %s"clientnameconnectedenteringoldname);
    }

    public 
    Action cmd_whois(int clientint args)
    {
        if (
    args 1)
        {
            
    PrintToChat(client" \x04[\x03Whois\x04] \x01Usage: !whois \x03<player name>");
        }
        if (
    args == 1)
        {
            
    //Initial Action
            
    char TargetString[100]; 
            
    GetCmdArg(1TargetString100); 
            
    int[] Clients = new int[MaxClients]; 
            
    char TargetName[100];
            
    bool tn_is_ml
            
    int ValidClients ProcessTargetString(TargetStringclientClientsMaxClientsCOMMAND_FILTER_NO_IMMUNITYTargetNamesizeof(TargetName), tn_is_ml);
            
    int PlayerClient
            
    char ClientName[100]; 
            for (
    int i 0ValidClientsi++) 
            { 
                
    PlayerClient Clients[i];
                
    GetClientName(PlayerClientClientNamesizeof(ClientName));
            }
            
    char steamid[256];
            
    char ip[256];
            
    Format(clienthasadminsizeof(clienthasadmin), "No.");
            if (
    GetUserFlagBits(PlayerClient) != 0)
            {
                
    Format(clienthasadminsizeof(clienthasadmin), "Yes.");
            }
            
    char clientidtarget[512];
            
    char tempoldname[512];
            
    GetClientAuthId(PlayerClientAuthId_Engineclientidtargetsizeof(clientidtarget));

            
    //Get Oldest Name
            
    KeyValues kv = new KeyValues("WhoisDB"); 
            
    char sPath[PLATFORM_MAX_PATH]; 
            
    BuildPath(Path_SMsPathsizeof(sPath), "data/whoisdb.txt"); 

            
    kv.ImportFromFile(sPath); 
            
    kv.GoBack();
            
    kv.JumpToKey(clientidtargettrue);
            
    kv.GetString(clientidtargettempoldnamesizeof(oldname), "no");
            
    kv.GoBack();
            
    delete kv;
            
    Format(oldnamesizeof(oldname), tempoldname);

            
    GetClientAuthId(PlayerClientAuthId_Enginesteamidsizeof(steamid));
            
    GetClientIP(PlayerClientipsizeof(ip));
            
    PrintToChat(client" \x04[\x03Whois\x04] \x03Player Name: %s"ClientName);
            
    PrintToChat(client" \x03              Oldest Name: %s"oldname);
            
    PrintToChat(client" \x03              SteamID: %s"steamid);
            
    PrintToChat(client" \x03              IP: %s\n\x03               Adminship: %s"ipclienthasadmin);
        }
        if (
    args 1)
        {
            
    PrintToChat(client" \x04[\x03Whois\x04] \x01Invalid Usage.");
        }

    I will test it in a week , but i dont think \x01 \x02 \x03 \x04 works on CSGO?
    JiSH is offline
    Cruze
    Senior Member
    Join Date: May 2017
    Old 06-05-2019 , 00:55   Re: [ANY] Whois
    Reply With Quote #6

    Quote:
    Originally Posted by JiSH View Post
    I will test it in a week , but i dont think \x01 \x02 \x03 \x04 works on CSGO?
    It works.
    __________________
    Taking paid private requests! Add me on steam!

    Discord: Cruze#4947 | AlliedModders Releases | Github | Steam | PayPal
    Cruze 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 07:13.


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