Raised This Month: $51 Target: $400
 12% 

[ANY] Information [3.6]


Post New Thread Reply   
 
Thread Tools Display Modes
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-23-2012 , 21:21   Re: [ANY] Information [2.5 24/August/2012]
Reply With Quote #11

Quote:
Originally Posted by MasterMind420 View Post
Does this plugin support /n for starting a new line, if so then awesome, if not then please add this and it will be perfect info plugin thanks...
It's "\n" and not "/n" and what do you mean if the plugin support it?
__________________
retired
shavit is offline
SooStoked
Junior Member
Join Date: May 2009
Old 08-23-2012 , 21:35   Re: Information
Reply With Quote #12

Wasn't working for me, menu wouldn't come up and info wasn't being displayed right. I made some small edits now it works fine, except I still can't get info from target players, only myself(also added connect time). I'm running a dev version of SM btw.

Code:
#include <sourcemod>
#include <basecomm>

#define PLUGIN_VERSION "2.5"
#define PREFIX "\x04[SM]\x01"

#pragma semicolon 1

new Handle:gH_Enabled = INVALID_HANDLE;
new Handle:gH_Menu = INVALID_HANDLE;
new Handle:gH_Targets = INVALID_HANDLE;
new bool:gB_Enabled;
new bool:gB_Menu;
new bool:gB_Targets;

public Plugin:myinfo = 
{
    name = "Information",
    author = "TimeBomb",
    description = "Showing your own information via the command \"sm_info\", \"sm_myinfo\", \"sm_information\".",
    version = PLUGIN_VERSION
}

public OnPluginStart()
{
    new Handle:Version = CreateConVar("sm_information_name", PLUGIN_VERSION, "Information version", FCVAR_NOTIFY|FCVAR_DONTRECORD|FCVAR_PLUGIN);
    SetConVarString(Version, PLUGIN_VERSION, _, true);
    
    gH_Enabled = CreateConVar("sm_information_enabled", "1", "Plugin's enabled?", FCVAR_PLUGIN, true, 0.0, true, 1.0);
    gH_Menu = CreateConVar("sm_information_menu", "1", "Information printing will be on menu or chat? [0 - Chat] [1 - Menu]", FCVAR_PLUGIN, true, 0.0, true, 1.0);
    gH_Targets = CreateConVar("sm_information_targets", "1", "Allow admins to see another players information?", FCVAR_PLUGIN, true, 0.0, true, 1.0);
    
    gB_Enabled = true;
    gB_Menu = true;
    gB_Targets = true;
    
    RegConsoleCmd("sm_myinfo", Command_Info);
    RegConsoleCmd("sm_info", Command_Info);
    RegConsoleCmd("sm_information", Command_Info);
    
    HookConVarChange(gH_Enabled, ConVarChanged);
    HookConVarChange(gH_Menu, ConVarChanged);
    HookConVarChange(gH_Targets, ConVarChanged);
    
    LoadTranslations("common.phrases");
    
    AutoExecConfig();
}

public ConVarChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    if(cvar == gH_Enabled)
    {
        gB_Enabled = StringToInt(newVal)? true:false;
    }
    else if(cvar == gH_Menu)
    {
        gB_Menu = StringToInt(newVal)? true:false;
    }
    else if(cvar == gH_Targets)
    {
        gB_Targets = StringToInt(newVal)? true:false;
    }
}

public Action:Command_Info(client, args)
{
    if(!gB_Enabled)
    {
        ReplyToCommand(client, "[SM] This plugin is disabled.");
        return Plugin_Handled;
    }
    
    decl String:arg1[MAX_TARGET_LENGTH];
    
    new target = client;
    
    if(args == 1 && gB_Targets && GetUserFlagBits(client) & ADMFLAG_GENERIC)
    {
        target = FindTarget(client, arg1);
    }
    
    decl String:Name[MAX_NAME_LENGTH+6];
    decl String:IP[32];
    decl String:SteamID[32];
    decl String:Muted[16];
    decl String:Gagged[16];
    decl String:UserID[16];
    decl String:Connected[32];
    
    GetClientIP(target, IP, 32);
    Format(IP, 32, "IP Address: %s.", IP);
    GetClientAuthString(target, SteamID, 32);
    Format(SteamID, 32, "SteamID: %s.", SteamID);
    Format(Muted, 16, "Muted: %s.", BaseComm_IsClientMuted(target)? "Yes":"No");
    Format(Gagged, 16, "Gagged: %s.", BaseComm_IsClientGagged(target)? "Yes":"No");
    Format(UserID, 16, "UserID: #%d.", GetClientUserId(target));
    Format(Name, MAX_NAME_LENGTH+6, "Name: %N", target);
    Format(Connected, 32, "Connected: %d minuets.", (RoundToFloor(GetClientTime(target))));
    
    switch(gB_Menu)
    {
        case true:
        {
            new Handle:menu = CreateMenu(MenuHandler_menu);
            SetMenuTitle(menu, "%N's information", target);
            AddMenuItem(menu, "Name", Name);
            AddMenuItem(menu, "SteamID", SteamID);
            AddMenuItem(menu, "IP", IP);
            AddMenuItem(menu, "Muted", Muted);
            AddMenuItem(menu, "Gagged", Gagged);
            AddMenuItem(menu, "UserID", UserID);
            AddMenuItem(menu, "Connected", Connected);
            SetMenuExitButton(menu, true);
            DisplayMenu(menu, client, 20);
        }
        
        case false:
        {
            ReplyToCommand(client, "%s %N's information", PREFIX, target);
            ReplyToCommand(client, "Name", PREFIX, Name);
            ReplyToCommand(client, "SteamID", PREFIX, SteamID);
            ReplyToCommand(client, "IP", PREFIX, IP);
            ReplyToCommand(client, "Muted", PREFIX, Muted);
            ReplyToCommand(client, "Gagged", PREFIX, Gagged);
            ReplyToCommand(client, "UserID", PREFIX, UserID);
            ReplyToCommand(client, "Connected", PREFIX, Connected);
        }
    }
    
    return Plugin_Handled;
}

public MenuHandler_menu(Handle:menu, MenuAction:action, param1, param2)
{
    if(action == MenuAction_End)
    {
        CloseHandle(menu);
    }
}

Last edited by SooStoked; 08-23-2012 at 21:36.
SooStoked is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-23-2012 , 22:30   Re: Information
Reply With Quote #13

Quote:
Originally Posted by SooStoked View Post
Wasn't working for me, menu wouldn't come up and info wasn't being displayed right. I made some small edits now it works fine, except I still can't get info from target players, only myself(also added connect time). I'm running a dev version of SM btw.

Code:
#include <sourcemod>
#include <basecomm>

#define PLUGIN_VERSION "2.5"
#define PREFIX "\x04[SM]\x01"

#pragma semicolon 1

new Handle:gH_Enabled = INVALID_HANDLE;
new Handle:gH_Menu = INVALID_HANDLE;
new Handle:gH_Targets = INVALID_HANDLE;
new bool:gB_Enabled;
new bool:gB_Menu;
new bool:gB_Targets;

public Plugin:myinfo = 
{
    name = "Information",
    author = "TimeBomb",
    description = "Showing your own information via the command \"sm_info\", \"sm_myinfo\", \"sm_information\".",
    version = PLUGIN_VERSION
}

public OnPluginStart()
{
    new Handle:Version = CreateConVar("sm_information_name", PLUGIN_VERSION, "Information version", FCVAR_NOTIFY|FCVAR_DONTRECORD|FCVAR_PLUGIN);
    SetConVarString(Version, PLUGIN_VERSION, _, true);
    
    gH_Enabled = CreateConVar("sm_information_enabled", "1", "Plugin's enabled?", FCVAR_PLUGIN, true, 0.0, true, 1.0);
    gH_Menu = CreateConVar("sm_information_menu", "1", "Information printing will be on menu or chat? [0 - Chat] [1 - Menu]", FCVAR_PLUGIN, true, 0.0, true, 1.0);
    gH_Targets = CreateConVar("sm_information_targets", "1", "Allow admins to see another players information?", FCVAR_PLUGIN, true, 0.0, true, 1.0);
    
    gB_Enabled = true;
    gB_Menu = true;
    gB_Targets = true;
    
    RegConsoleCmd("sm_myinfo", Command_Info);
    RegConsoleCmd("sm_info", Command_Info);
    RegConsoleCmd("sm_information", Command_Info);
    
    HookConVarChange(gH_Enabled, ConVarChanged);
    HookConVarChange(gH_Menu, ConVarChanged);
    HookConVarChange(gH_Targets, ConVarChanged);
    
    LoadTranslations("common.phrases");
    
    AutoExecConfig();
}

public ConVarChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
{
    if(cvar == gH_Enabled)
    {
        gB_Enabled = StringToInt(newVal)? true:false;
    }
    else if(cvar == gH_Menu)
    {
        gB_Menu = StringToInt(newVal)? true:false;
    }
    else if(cvar == gH_Targets)
    {
        gB_Targets = StringToInt(newVal)? true:false;
    }
}

public Action:Command_Info(client, args)
{
    if(!gB_Enabled)
    {
        ReplyToCommand(client, "[SM] This plugin is disabled.");
        return Plugin_Handled;
    }
    
    decl String:arg1[MAX_TARGET_LENGTH];
    
    new target = client;
    
    if(args == 1 && gB_Targets && GetUserFlagBits(client) & ADMFLAG_GENERIC)
    {
        target = FindTarget(client, arg1);
    }
    
    decl String:Name[MAX_NAME_LENGTH+6];
    decl String:IP[32];
    decl String:SteamID[32];
    decl String:Muted[16];
    decl String:Gagged[16];
    decl String:UserID[16];
    decl String:Connected[32];
    
    GetClientIP(target, IP, 32);
    Format(IP, 32, "IP Address: %s.", IP);
    GetClientAuthString(target, SteamID, 32);
    Format(SteamID, 32, "SteamID: %s.", SteamID);
    Format(Muted, 16, "Muted: %s.", BaseComm_IsClientMuted(target)? "Yes":"No");
    Format(Gagged, 16, "Gagged: %s.", BaseComm_IsClientGagged(target)? "Yes":"No");
    Format(UserID, 16, "UserID: #%d.", GetClientUserId(target));
    Format(Name, MAX_NAME_LENGTH+6, "Name: %N", target);
    Format(Connected, 32, "Connected: %d minuets.", (RoundToFloor(GetClientTime(target))));
    
    switch(gB_Menu)
    {
        case true:
        {
            new Handle:menu = CreateMenu(MenuHandler_menu);
            SetMenuTitle(menu, "%N's information", target);
            AddMenuItem(menu, "Name", Name);
            AddMenuItem(menu, "SteamID", SteamID);
            AddMenuItem(menu, "IP", IP);
            AddMenuItem(menu, "Muted", Muted);
            AddMenuItem(menu, "Gagged", Gagged);
            AddMenuItem(menu, "UserID", UserID);
            AddMenuItem(menu, "Connected", Connected);
            SetMenuExitButton(menu, true);
            DisplayMenu(menu, client, 20);
        }
        
        case false:
        {
            ReplyToCommand(client, "%s %N's information", PREFIX, target);
            ReplyToCommand(client, "Name", PREFIX, Name);
            ReplyToCommand(client, "SteamID", PREFIX, SteamID);
            ReplyToCommand(client, "IP", PREFIX, IP);
            ReplyToCommand(client, "Muted", PREFIX, Muted);
            ReplyToCommand(client, "Gagged", PREFIX, Gagged);
            ReplyToCommand(client, "UserID", PREFIX, UserID);
            ReplyToCommand(client, "Connected", PREFIX, Connected);
        }
    }
    
    return Plugin_Handled;
}

public MenuHandler_menu(Handle:menu, MenuAction:action, param1, param2)
{
    if(action == MenuAction_End)
    {
        CloseHandle(menu);
    }
}
Quite a bit weird, I fixed targeting and added it to your version.
I just updated SM 1.4.4 to 1.5.0 dev and it didn't worked well. Fixed

2.6 (24 August 2012) -
* Targets working.
* Works with developer SM version. [Thanks SooStoked]
+ Connection time [Thanks SooStoked]
+ Targets override "target_info"
__________________
retired
shavit is offline
SooStoked
Junior Member
Join Date: May 2009
Old 08-23-2012 , 23:21   Re: Information
Reply With Quote #14

Quote:
Originally Posted by shavit View Post
Quite a bit weird, I fixed targeting and added it to your version.
I just updated SM 1.4.4 to 1.5.0 dev and it didn't worked well. Fixed

2.6 (24 August 2012) -
* Targets working.
* Works with developer SM version. [Thanks SooStoked]
+ Connection time [Thanks SooStoked]
+ Targets override "target_info"
Great! But I noticed GetClientTime was in seconds, not minutes, and I'm guessing this is the best way to fix it. I don't code at all so I'm not really sure.
Code:
    Format(Connected, 32, "Connected: %d minutes.", RoundToFloor(GetClientTime(target) / 60));
Also, I've tried using partial names, full names, and UserIDs, but I can't get information on other people still. However there is an error this time "[SM] No matching client was found."

Last edited by SooStoked; 08-23-2012 at 23:33.
SooStoked is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-24-2012 , 00:14   Re: Information
Reply With Quote #15

Quote:
Originally Posted by SooStoked View Post
Great! But I noticed GetClientTime was in seconds, not minutes, and I'm guessing this is the best way to fix it. I don't code at all so I'm not really sure.
Code:
    Format(Connected, 32, "Connected: %d minutes.", RoundToFloor(GetClientTime(target) / 60));
Also, I've tried using partial names, full names, and UserIDs, but I can't get information on other people still. However there is an error this time "[SM] No matching client was found."
I'm a fail, I didn't used GetCmdArg

2.7 (24 Augut 2012) -
* Oh man fixed targets for the final time.
* Changed seconds to minutes.

*** IF SOMEONE CAN PLEASE GIVE ME A SCREENSHOT OF THE NEW VERSION BECAUSE I CAN'T SNAP ANYMORE IT SHOWS A BLACK SCREEN INSTEAD OF THE GAME ***
__________________
retired
shavit is offline
SooStoked
Junior Member
Join Date: May 2009
Old 08-24-2012 , 02:52   Re: Information
Reply With Quote #16

Quote:
Originally Posted by shavit View Post
I'm a fail, I didn't used GetCmdArg

2.7 (24 Augut 2012) -
* Oh man fixed targets for the final time.
* Changed seconds to minutes.

*** IF SOMEONE CAN PLEASE GIVE ME A SCREENSHOT OF THE NEW VERSION BECAUSE I CAN'T SNAP ANYMORE IT SHOWS A BLACK SCREEN INSTEAD OF THE GAME ***
Everything works as it's supposed to!
[IMG]http://img171.**************/img171/4792/infoscreenshot.jpg[/IMG]
SooStoked is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-24-2012 , 04:38   Re: Information
Reply With Quote #17

Quote:
Originally Posted by SooStoked View Post
Everything works as it's supposed to!
[IMG]http://img171.**************/img171/4792/infoscreenshot.jpg[/IMG]
Great, added to the thread.
__________________
retired
shavit is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-24-2012 , 04:56   Re: [ANY] Information [2.8 24/August/2012]
Reply With Quote #18

2.8 (24 August 2012) -
* Fixed the chat [It just showed "Name" instead of the real name]
+ Country
+ If the server don't have basecomm it will not show the mute/gag status.
__________________
retired
shavit is offline
karil
SourceMod Donor
Join Date: Jan 2010
Old 08-24-2012 , 05:57   Re: [ANY] Information [2.8 24/August/2012]
Reply With Quote #19

Hey, it works on CS:GO. The thing is it doesn't show IP address. The third line looks like this 'IP address'. Without : and no numbers.
karil is offline
shavit
AlliedModders Donor
Join Date: Dec 2011
Location: Israel
Old 08-24-2012 , 06:15   Re: [ANY] Information [2.8 24/August/2012]
Reply With Quote #20

Quote:
Originally Posted by karil View Post
Hey, it works on CS:GO. The thing is it doesn't show IP address. The third line looks like this 'IP address'. Without : and no numbers.
Update to the newest SourceMod, if still don't work I'll report a bug for you.
__________________
retired
shavit 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 23:41.


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