Member
Join Date: Jun 2011
Location: Milan, Italy.
|
11-24-2016
, 13:01
[help] amxlast
|
#1
|
Hello, i need to remove ip from amx_last, i need to show only name, authid and acces. This is the code:
Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "CmdLast"
#define VERSION "1.0"
#define AUTHOR "Artizy"
#define ACCESS ADMIN_BAN
#define OLD_CONNECTION_QUEUE 10
new g_Size;
new g_Names[OLD_CONNECTION_QUEUE][32];
new g_SteamIDs[OLD_CONNECTION_QUEUE][32];
new g_IPs[OLD_CONNECTION_QUEUE][32];
new g_Access[OLD_CONNECTION_QUEUE];
new g_Tracker;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_concmd("amx_last","last_cmd",ACCESS)
}
public last_cmd(id, level, cid)
{
if(!(get_user_flags(id) & ACCESS)){
console_print(id,"You don't have access to that command.")
return PLUGIN_HANDLED
}
new name[32];
new authid[32];
new ip[32];
new flags[32];
new access;
console_print(id, "%19s %20s %15s %s", "name", "authid", "ip", "access");
for (new i = 0; i < g_Size; i++)
{
GetInfo(i, name, charsmax(name), authid, charsmax(authid), ip, charsmax(ip), access);
get_flags(access, flags, charsmax(flags));
console_print(id, "%19s %20s %15s %s", name, authid, ip, flags);
}
console_print(id, "%d old connections saved.", g_Size);
return PLUGIN_HANDLED;
}
stock InsertInfo(id)
{
if (g_Size > 0)
{
new ip[32]
new auth[32];
get_user_authid(id, auth, charsmax(auth));
get_user_ip(id, ip, charsmax(ip), 1/*no port*/);
new last = 0;
if (g_Size < sizeof(g_SteamIDs))
{
last = g_Size - 1;
}
else
{
last = g_Tracker - 1;
if (last < 0)
{
last = g_Size - 1;
}
}
if (equal(auth, g_SteamIDs[last]) &&
equal(ip, g_IPs[last]))
{
get_user_name(id, g_Names[last], charsmax(g_Names[]));
g_Access[last] = get_user_flags(id);
return;
}
}
new target = 0;
if (g_Size < sizeof(g_SteamIDs))
{
target = g_Size;
++g_Size;
}
else
{
target = g_Tracker;
++g_Tracker;
if (g_Tracker == sizeof(g_SteamIDs))
{
g_Tracker = 0;
}
}
get_user_authid(id, g_SteamIDs[target], charsmax(g_SteamIDs[]));
get_user_name(id, g_Names[target], charsmax(g_Names[]));
get_user_ip(id, g_IPs[target], charsmax(g_IPs[]), 1/*no port*/);
g_Access[target] = get_user_flags(id);
}
stock GetInfo(i, name[], namesize, auth[], authsize, ip[], ipsize, &access)
{
if (i >= g_Size)
{
abort(AMX_ERR_NATIVE, "GetInfo: Out of bounds (%d:%d)", i, g_Size);
}
new target = (g_Tracker + i) % sizeof(g_SteamIDs);
copy(name, namesize, g_Names[target]);
copy(auth, authsize, g_SteamIDs[target]);
copy(ip, ipsize, g_IPs[target]);
access = g_Access[target];
}
public client_disconnect(id)
{
if (!is_user_bot(id))
{
InsertInfo(id);
}
}
|
|