Raised This Month: $32 Target: $400
 8% 

[Any] Get IP


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Firewolf24
Junior Member
Join Date: Apr 2017
Location: IKEA
Plugin ID:
5620
Plugin Version:
0.3
Plugin Category:
Admin Commands
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Simple Plugin for viewing IP's of players
    Old 05-07-2017 , 07:15   [Any] Get IP
    Reply With Quote #1

    [Any] Get IP

    Description:
    This is my first plugin that i'm uploading here on Alliedmods.
    A very simple plugin that can get IP's from players.
    I couldn't find a get ip plugin here yet, so i decided to upload it, plus its compatible with all multiplayer games.

    Commands:
    • sm_getip <#userid|name> - gets ip.

    Again, very simple plugin, i'm still learning, but it works!

    Changes:

    May 7th 2017 - 0.2
    • Changed PrintToChat to ReplyToCommand (Thanks fakuivan!)

    May 8th 2017 - 0.3
    • Updated syntaxes and added a [GET-IP] tag before the command outputs
    • Changed flag for sm_getip to CHEATS (you can always change it by adding it to admin_overrides.cfg)

    March 25th 2018 - 0.4
    • Changed plugin prefix to [IP]
    • Now also prints locations!
    Attached Files
    File Type: sp Get Plugin or Get Source (GetIP.sp - 2178 views - 1.2 KB)

    Last edited by Firewolf24; 03-25-2018 at 14:08. Reason: updated to 0.4
    Firewolf24 is offline
    fakuivan
    Senior Member
    Join Date: Nov 2015
    Old 05-07-2017 , 08:28   Re: [Any] Get IP
    Reply With Quote #2

    You can type "status" from the server console or "sm_rcon status" to get IP addresses. Just a side note.
    __________________
    fakuivan is offline
    fakuivan
    Senior Member
    Join Date: Nov 2015
    Old 05-07-2017 , 08:33   Re: [Any] Get IP
    Reply With Quote #3

    Use ReplyToCommand instead of PrintToChat/Console so you reply to the source, otherwise your user will write the command from console and get the reply from chat (or the other way around).
    __________________

    Last edited by fakuivan; 05-07-2017 at 08:34.
    fakuivan is offline
    Firewolf24
    Junior Member
    Join Date: Apr 2017
    Location: IKEA
    Old 05-07-2017 , 09:38   Re: [Any] Get IP
    Reply With Quote #4

    I was also going to do something with geoip to and/or print the location of the player, might take a look into that soon.

    but thanks fakuivan!
    Firewolf24 is offline
    xfusionlockx
    AlliedModders Donor
    Join Date: Aug 2014
    Old 05-08-2017 , 02:14   Re: [Any] Get IP
    Reply With Quote #5

    Simple, lightweight. I like it.
    xfusionlockx is offline
    B3none
    AlliedModders Donor
    Join Date: Oct 2016
    Location: United Kingdom
    Old 05-08-2017 , 04:50   Re: [Any] Get IP
    Reply With Quote #6

    Updated to newest syntax and added a Tag before each command, don't have to use it just a thought

    PHP Code:
    #include <sourcemod>

    #pragma semicolon 1
    #pragma newdecls required

    #define TAG_MESSAGE "[\x04IPQuery\x01]"

    public Plugin myinfo 
    {
        
    name "IP Query",
        
    author "Firewolf",
        
    description "Simple Plugin for viewing IP's of players.",
        
    version "0.3",
        
    url ""
    };

    public 
    void OnPluginStart()
    {
        
    RegAdminCmd("sm_getip"Command_GetIpADMFLAG_GENERIC"sm_getip <#userid|name> (Gets the IP of the selected target)"); // ADMFLAG_GENERIC? Don't want to be giving up too much information to everyone :P
    }

    public 
    Action Command_GetIp(int clientint args)
    {
        if(
    args 1)
        {
            
    ReplyToCommand(client"%s Missing Parameters. Usage: sm_getip <target>"TAG_MESSAGE);
        }

        
    char arg1[32];     
        
    GetCmdArg(1arg1sizeof(arg1));
        
    int target FindTarget(clientarg1);
        
    char ClientIP[32];
        
    char TargetName[32];
        
        
    GetClientName(targetTargetNamesizeof(TargetName));
        
    GetClientIP(targetClientIPsizeof(ClientIP));
        
        
    ReplyToCommand(client"%s IP of client %s: %s"TAG_MESSAGETargetNameClientIP);
        return 
    Plugin_Handled;

    __________________
    B3none is offline
    Firewolf24
    Junior Member
    Join Date: Apr 2017
    Location: IKEA
    Old 05-08-2017 , 08:23   Re: [Any] Get IP
    Reply With Quote #7

    I learned some stuff from that, thanks!
    And in the original code i had ADMFLAG_ROOT, but i was still unsure what flag to choose from. i might put it to cheats or root, but you can of course always change it in the overrides config file ;)

    Last edited by Firewolf24; 05-08-2017 at 08:28.
    Firewolf24 is offline
    KissLick
    Veteran Member
    Join Date: Nov 2012
    Location: void
    Old 05-08-2017 , 09:08   Re: [Any] Get IP
    Reply With Quote #8

    Guys, %N is also a thing ;-)
    __________________
    Plugins: TeamGames
    Includes: Menu stocks, ColorVariables, DownloadTableConfig

    > No help through PM, make a topic.
    KissLick is offline
    Firewolf24
    Junior Member
    Join Date: Apr 2017
    Location: IKEA
    Old 05-08-2017 , 13:23   Re: [Any] Get IP
    Reply With Quote #9

    Wiki: "N: Requires a client index; expands to a string containing the player's name."

    so when i put that in place of the S where the targets name is supposed to be i dont need to convert it to a string?

    Last edited by Firewolf24; 05-08-2017 at 13:24.
    Firewolf24 is offline
    Papero
    Veteran Member
    Join Date: Aug 2016
    Location: Italy
    Old 05-08-2017 , 13:49   Re: [Any] Get IP
    Reply With Quote #10

    Quote:
    Originally Posted by Firewolf24 View Post
    Wiki: "N: Requires a client index; expands to a string containing the player's name."

    so when i put that in place of the S where the targets name is supposed to be i dont need to convert it to a string?
    Yes, doing
    PHP Code:
    int client;
    PrintToChat(client"%N"client); 
    or
    PHP Code:
    int client;
    char sName[32];
    GetClientName(client sNamesizeof(sName));
    PrintToChat(client,"%s"sName); 
    will result in the same output

    (client is supposed to be a Valid Client.)
    __________________
    My Plugins
    SPCode


    Steam: hexer504
    Telegram: Hexah
    Discord: Hexah#6903

    If you like my work you can donate here!

    Last edited by Papero; 11-02-2018 at 08:22.
    Papero is offline
    Reply



    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 06:38.


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