Results 1 to 8 of 8

Thread: Modified Lastx sourcemod plugin by HomicidalApe

  1. #1
    g0d! Contributing Member siosios's Avatar
    Join Date
    Oct 2006
    Location
    In a cardboard box
    Age
    51
    HlStats

    HLStatsX Ranking for STEAM_0:1:13488560
    Posts
    13.570
    Blog Entries
    12
    Rep Power
    10

    Default Modified Lastx sourcemod plugin by HomicidalApe

    I have modified lastx to show the ip addresses of people that have left the servers before getting banned to help the ZM admins here in N/U.

    below is the sp code

    Code:
    /**
    * Modified by siosios @ www.n00bunlimited.net
    * lastx.sp by HomicidalApe
    * Gives admins a list of the last players to disconnect, with their steam IDs.
    *
    * Credits go to whoever made a very similar plugin for SourceForts. This is based off that.
    *
    * Thanks to teame06, since he tore apart so much of this code showing me how to do things.
    *
    */
     
    #include <sourcemod>
    public Plugin:myinfo = {
     name = "LastX - modded by siosios",
     author = "HomicidalApe",
     description = "Shows the last x users that disconnected, their steam IDs, and IP's.",
     version = "1.2",
     url = "http://www.homicidalape.mybigspoon.com/mapsite/"
    };
    new Handle:PlayerName;
    new Handle:PlayerAuthid;
    new Handle:PlayerIp;
    new count;
    new lastxhistory = 10; // default history length
    new bool:logbots = false;
    public OnPluginStart()
    {
     PlayerName = CreateArray(64, lastxhistory);
     PlayerAuthid = CreateArray(64, lastxhistory);
     PlayerIp = CreateArray(64, lastxhistory)
     RegAdminCmd("lastx", List, ADMFLAG_GENERIC, "Lists the last x players to disconnect.");
     RegAdminCmd("sm_lastxhistory", SetHistory, ADMFLAG_GENERIC, "sm_lastxhistory <#> : Sets how many player names+IDs to remember for lastx command.");
     RegAdminCmd("sm_lastxbots", SetBots, ADMFLAG_GENERIC, "sm_lastxhistory <#> : Determines if lastx will log bots.");
    }
    public OnClientDisconnect(client)
    {
     decl String:playername[64], String:playerid[64], String:playerIP[64]
     GetClientName(client, playername, sizeof(playername));
     GetClientAuthString(client, playerid, sizeof(playerid));
     GetClientIP(client, playerIP, sizeof(playerIP))
     if (!strcmp(playerid, "BOT"))
     {
      if (!logbots)
      {
       return;
      }
     }
     if (++count >= lastxhistory)
     {
      count = lastxhistory;
      RemoveFromArray(PlayerName, lastxhistory - 1);
      RemoveFromArray(PlayerAuthid, lastxhistory - 1);
      RemoveFromArray(PlayerIp, lastxhistory - 1);
     }
     if (count)
     {
      ShiftArrayUp(PlayerAuthid, 0);
      ShiftArrayUp(PlayerName, 0);
      ShiftArrayUp(PlayerIp, 0);
     }
     SetArrayString(PlayerName, 0, playername);
     SetArrayString(PlayerAuthid, 0, playerid);
     SetArrayString(PlayerIp, 0, playerIP);
     return;
    }
    public Action:List(client, args)
    {
     PrintToConsole(client, "Last %i players to disconnect:", count);
     decl String:clientIP[64], String:Auth[64], String:Name[64];
     for (new i = 0; i < count; i++)
     {
      GetArrayString(PlayerName, i, Name, sizeof(Name));
      GetArrayString(PlayerAuthid, i, Auth, sizeof(Auth));
      GetArrayString(PlayerIp, i, clientIP, sizeof(clientIP))
     
      PrintToConsole(client, "%d. %s - %s - %s", i+1, Name, Auth, clientIP);
     }
     return Plugin_Handled;
    }
    public Action:SetHistory(client, args)
    {
     if (args < 1)
     {
      ReplyToCommand(client, "Current Value: %i \n[SM] Usage: sm_lastxhistory <#> : min 1.0 max 64.0", lastxhistory);
      return Plugin_Handled;
     }
     decl String:history[64];
     GetCmdArg(1, history, sizeof(history));
     new value = StringToInt(history)
     if (0 < value < 65)
     {
      if(value < count)
      {
       count = value;
      }
      lastxhistory = value;
      ResizeArray(PlayerName, lastxhistory);
      ResizeArray(PlayerAuthid, lastxhistory);
      ResizeArray(PlayerIp, lastxhistory);
      return Plugin_Handled;
     }
     else
     {
      ReplyToCommand(client, "Current Value: %i \n[SM] Usage: sm_lastxhistory <#> : min 1 max 64", lastxhistory);
      return Plugin_Handled;
     }
    }
    public Action:SetBots(client, args)
    {
     if (args < 1)
     {
      ReplyToCommand(client, "Current Value: %i \n[SM] Usage: sm_lastxbots <0 or 1>", logbots);
      return Plugin_Handled;
     }
     decl String:bots[64];
     GetCmdArg(1, bots, sizeof(bots));
     new value = StringToInt(bots)
     if (value == 1)
     {
      logbots = true;
      return Plugin_Handled;
     }
     if (value == 0)
     {
      logbots = false;
      return Plugin_Handled;
     }
     else
     {
      ReplyToCommand(client, "Current Value: %i \n[SM] Usage: sm_lastxhistory <#> : min 1.0 max 64.0", lastxhistory);
      return Plugin_Handled;
     }
    }
    See Nats post below for the compiled plugin

    thanks
    siosios
    Last edited by siosios; 09-11-2011 at 03:18 PM.
    ------------------------------------------------

    |W0rd|SexualTurtletara420ת/ύ: Hey there daddy..

    ------------------------------------------------
    \\\ ///
    ( @ @ )
    .....o00o.(_).o00o.....


    ------------------------------------------

  2. #2
    JinkoNeko
    Guest

    Default

    Awesome sio, this will be very helpful. +1

  3. #3
    g0d! Contributing Member siosios's Avatar
    Join Date
    Oct 2006
    Location
    In a cardboard box
    Age
    51
    HlStats

    HLStatsX Ranking for STEAM_0:1:13488560
    Posts
    13.570
    Blog Entries
    12
    Rep Power
    10

    Default

    there seems to be a problem with it so me and nat are looking over the code. will update the first post with any changes.

    siosios
    ------------------------------------------------

    |W0rd|SexualTurtletara420ת/ύ: Hey there daddy..

    ------------------------------------------------
    \\\ ///
    ( @ @ )
    .....o00o.(_).o00o.....


    ------------------------------------------

  4. #4
    Queen of the Internet Kung Fu Master
    Join Date
    Oct 2006
    Location
    Atlanta
    Posts
    1.879
    Rep Power
    20

    Default

    Okay, here's the final updated version:


    Code:
    /**
    * Modified by siosios @ www.n00bunlimited.net
    * lastx.sp by HomicidalApe
    * Gives admins a list of the last players to disconnect, with their steam IDs.
    *
    * Credits go to whoever made a very similar plugin for SourceForts. This is based off that.
    *
    * Thanks to teame06, since he tore apart so much of this code showing me how to do things.
    *
    */
    
    #include <sourcemod>
    public Plugin:myinfo = {
     name = "LastX - modded by siosios",
     author = "HomicidalApe",
     description = "Shows the last x users that disconnected, their steam IDs, and IP's.",
     version = "1.2",
     url = "http://www.homicidalape.mybigspoon.com/mapsite/"
    };
    new Handle:PlayerName;
    new Handle:PlayerAuthid;
    new Handle:PlayerIp;
    new count;
    new lastxhistory = 10; // default history length
    new bool:logbots = false;
    public OnPluginStart()
    {
     PlayerName = CreateArray(64, lastxhistory);
     PlayerAuthid = CreateArray(64, lastxhistory);
     PlayerIp = CreateArray(64, lastxhistory)
     RegAdminCmd("lastx", List, ADMFLAG_GENERIC, "Lists the last x players to disconnect.");
     RegAdminCmd("sm_lastxhistory", SetHistory, ADMFLAG_GENERIC, "sm_lastxhistory <#> : Sets how many player names+IDs to remember for lastx command.");
     RegAdminCmd("sm_lastxbots", SetBots, ADMFLAG_GENERIC, "sm_lastxhistory <#> : Determines if lastx will log bots.");
    }
    public OnClientDisconnect(client)
    {
     decl String:playername[64], String:playerid[64], String:playerIP[64]
     GetClientName(client, playername, sizeof(playername));
     GetClientAuthString(client, playerid, sizeof(playerid));
     GetClientIP(client, playerIP, sizeof(playerIP))
     if (!strcmp(playerid, "BOT"))
     {
      if (!logbots)
      {
       return;
      }
     }
     if (++count >= lastxhistory)
     {
      count = lastxhistory;
      RemoveFromArray(PlayerName, lastxhistory - 1);
      RemoveFromArray(PlayerAuthid, lastxhistory - 1);
      RemoveFromArray(PlayerIp, lastxhistory - 1);
     }
     if (count)
     {
      ShiftArrayUp(PlayerAuthid, 0);
      ShiftArrayUp(PlayerName, 0);
      ShiftArrayUp(PlayerIp, 0);
     }
     SetArrayString(PlayerName, 0, playername);
     SetArrayString(PlayerAuthid, 0, playerid);
     SetArrayString(PlayerIp, 0, playerIP);
     return;
    }
    public Action:List(client, args)
    {
     PrintToConsole(client, "Last %i players to disconnect:", count);
     decl String:clientIP[64], String:Auth[64], String:Name[64];
     for (new i = 0; i < count; i++)
     {
      GetArrayString(PlayerName, i, Name, sizeof(Name));
      GetArrayString(PlayerAuthid, i, Auth, sizeof(Auth));
      GetArrayString(PlayerIp, i, clientIP, sizeof(clientIP))
    
      PrintToConsole(client, "%d. %s - %s - %s", i+1, Name, Auth, clientIP);
     }
     return Plugin_Handled;
    }
    public Action:SetHistory(client, args)
    {
     if (args < 1)
     {
      ReplyToCommand(client, "Current Value: %i \n[SM] Usage: sm_lastxhistory <#> : min 1.0 max 64.0", lastxhistory);
      return Plugin_Handled;
     }
     decl String:history[64];
     GetCmdArg(1, history, sizeof(history));
     new value = StringToInt(history)
     if (0 < value < 65)
     {
      if(value < count)
      {
       count = value;
      }
      lastxhistory = value;
      ResizeArray(PlayerName, lastxhistory);
      ResizeArray(PlayerAuthid, lastxhistory);
      ResizeArray(PlayerIp, lastxhistory);
      return Plugin_Handled;
     }
     else
     {
      ReplyToCommand(client, "Current Value: %i \n[SM] Usage: sm_lastxhistory <#> : min 1 max 64", lastxhistory);
      return Plugin_Handled;
     }
    }
    public Action:SetBots(client, args)
    {
     if (args < 1)
     {
      ReplyToCommand(client, "Current Value: %i \n[SM] Usage: sm_lastxbots <0 or 1>", logbots);
      return Plugin_Handled;
     }
     decl String:bots[64];
     GetCmdArg(1, bots, sizeof(bots));
     new value = StringToInt(bots)
     if (value == 1)
     {
      logbots = true;
      return Plugin_Handled;
     }
     if (value == 0)
     {
      logbots = false;
      return Plugin_Handled;
     }
     else
     {
      ReplyToCommand(client, "Current Value: %i \n[SM] Usage: sm_lastxhistory <#> : min 1.0 max 64.0", lastxhistory);
      return Plugin_Handled;
     }
    }
    Attached Files Attached Files
    [img]http://unix.org.au/~brett/gif/waldioaw1.gif[/img]
    [color=royalblue][b]Forum and Server Administrator[/b][/color]
    PasTieZ: I am scared now thanks nat
    natalyaaf: D:
    PasTieZ: sio is going to ass rape me

    NatalyaAF ウラヌス: i am the baninator :D
    word jackd ת/ύ: ha the baninator and the pwninator

  5. #5
    g0d! Contributing Member siosios's Avatar
    Join Date
    Oct 2006
    Location
    In a cardboard box
    Age
    51
    HlStats

    HLStatsX Ranking for STEAM_0:1:13488560
    Posts
    13.570
    Blog Entries
    12
    Rep Power
    10

    Default

    ALL ZM ADMINS:

    You can now type lastx in console to find the ip of players that had left before you could serve justice on them.
    ------------------------------------------------

    |W0rd|SexualTurtletara420ת/ύ: Hey there daddy..

    ------------------------------------------------
    \\\ ///
    ( @ @ )
    .....o00o.(_).o00o.....


    ------------------------------------------

  6. #6
    JinkoNeko
    Guest

    Default

    W00t!!!

  7. #7
    fRANK
    Guest

    Default

    Very nice!!! I'm sure this will help out admins very good.

  8. #8
    Kung Fu Master
    Join Date
    Mar 2008
    Location
    Fuckin Ohio!
    HlStats

    HLStatsX Ranking for STEAM_0:0:28811228
    Posts
    2.438
    Rep Power
    19

    Default

    Thank you sio. This im glad i could help =D
    [COLOR="RoyalBlue"][B]N/U Retiree[/B]

    8:45 PM - V A N E S S A: give me a sex
    2:53 PM - Tara Ann ت: just wanted to say you're adorable[/COLOR]

Thread Information

Users Browsing this Thread

There are currently 3 users browsing this thread. (0 members and 3 guests)

Similar Threads

  1. Weapon Restrict Plugin?
    By Abstract in forum Server Tech Talk
    Replies: 1
    Last Post: 08-09-2008, 11:24 AM
  2. Question about sourcemod radio?
    By BioHaZarD69 in forum N00B Unlimited General Chat
    Replies: 4
    Last Post: 05-26-2008, 01:37 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •