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

Plugin in 1 menu case


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
bornas
Junior Member
Join Date: Mar 2013
Old 04-09-2014 , 11:33   Plugin in 1 menu case
Reply With Quote #1

Hello from title I bet you didn't understood me so I'll explain you:

Is it possible to make this script add in menu?


The script:
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define OLD_CONNECTION_QUEUE 15

public plugin_init()
{
register_plugin("Amx_last","1.0""Clawww")
register_concmd("amx_last""cmdLast"ADMIN_BAN" - arata informatii despre userii care au iesi recent de pe server");
register_concmd("admin_last""cmdLast"ADMIN_BAN" - arata informatii despre userii care au iesi recent de pe server");
}

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;
new 
g_Size;

stock InsertInfo(id)
{

if (
g_Size 0)
{
new 
ip[32]
new 
auth[32];

get_user_authid(idauth31);
get_user_ip(idip311);

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(authg_SteamIDs[last]) &&
equal(ipg_IPs[last]))
{
get_user_name(idg_Names[last], 31);
g_Access[last] = get_user_flags(id);

return;
}
}

new 
target 0// the slot to save the info at

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(idg_SteamIDs[target], 31);
get_user_name(idg_Names[target], 31);
get_user_ip(idg_IPs[target], 311);

g_Access[target] = get_user_flags(id);

}
stock GetInfo(iname[], namesizeauth[], authsizeip[], ipsize, &access)
{
if (
>= g_Size)
{
abort(AMX_ERR_NATIVE"GetInfo: Out of bounds (%d:%d)"ig_Size);
}

new 
target = (g_Tracker i) % sizeof(g_SteamIDs);

copy(namenamesizeg_Names[target]);
copy(authauthsizeg_SteamIDs[target]);
copy(ipipsizeg_IPs[target]);
access g_Access[target];

}
public 
client_disconnect(id)
{
if (!
is_user_bot(id))
{
InsertInfo(id);
}
}


public 
cmdLast(idlevelcid)
{
if (!
cmd_access(idlevelcid1))
{
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 
0g_Sizei++)
{
GetInfo(iname31authid31ip31access);

get_flags(accessflags31);

console_print(id"%19s %20s %15s %s"nameauthidipflags);
}

console_print(id"%d Ip-uri salvate."g_Size);

return 
PLUGIN_HANDLED;


Thanks .


P.S. Sorry for bad english and I am very bad at scripting :C.
bornas is offline
NikKOo31
Senior Member
Join Date: May 2013
Location: Home
Old 04-09-2014 , 18:01   Re: Plugin in 1 menu case
Reply With Quote #2

I'm not sure if this is what you want D:
Also I think the lenght will exceed the max lenght of menu items

*not tested*

PHP Code:
public cmdLast(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    
new name[32]
    new 
authid[32]
    new 
ip[32]
    new 
flags[32]
    new 
access

    
new aux[128], pos[5], cnt 0
    
new menu menu_create("\rLast menu(?""last_menu")

    
//console_print(id, "%19s %20s %15s %s", "name", "authid", "ip", "access")

    
for (new 0g_Sizei++)
    {
        
GetInfo(iname31authid31ip31access)
        
get_flags(accessflags31)

        
format(aux127"\w%19s %20s %15s %s"nameauthidipflags)
        
num_to_str(cntpos4)
        
menu_additem(menuauxpos0)
        
//console_print(id, "%19s %20s %15s %s", name, authid, ip, flags)
    
}

    
//console_print(id, "%d Ip-uri salvate.", g_Size); 

    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED
}

public 
last_menu(idmenuitem)
{    
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    
    new 
name[32]
    new 
authid[32]
    new 
ip[32]
    new 
flags[32]
    
    
parseiNamenamecharsmax(name)-1authidcharsmax(authid)-1ipcharsmax(ip)-1flagscharsmax(flags)-1)
    
/*
        here you can do anything ._.
        
        amx_addban(authid)
        amx_addban(ip)
        
        etc..
    */
    
return PLUGIN_HANDLED


Last edited by NikKOo31; 04-09-2014 at 18:14.
NikKOo31 is offline
bornas
Junior Member
Join Date: Mar 2013
Old 04-10-2014 , 03:19   Re: Plugin in 1 menu case
Reply With Quote #3

Quote:
Originally Posted by NikKOo31 View Post
I'm not sure if this is what you want D:
Also I think the lenght will exceed the max lenght of menu items

*not tested*

PHP Code:
public cmdLast(idlevelcid)
{
    if (!
cmd_access(idlevelcid1))
        return 
PLUGIN_HANDLED

    
new name[32]
    new 
authid[32]
    new 
ip[32]
    new 
flags[32]
    new 
access

    
new aux[128], pos[5], cnt 0
    
new menu menu_create("\rLast menu(?""last_menu")

    
//console_print(id, "%19s %20s %15s %s", "name", "authid", "ip", "access")

    
for (new 0g_Sizei++)
    {
        
GetInfo(iname31authid31ip31access)
        
get_flags(accessflags31)

        
format(aux127"\w%19s %20s %15s %s"nameauthidipflags)
        
num_to_str(cntpos4)
        
menu_additem(menuauxpos0)
        
//console_print(id, "%19s %20s %15s %s", name, authid, ip, flags)
    
}

    
//console_print(id, "%d Ip-uri salvate.", g_Size); 

    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
    return 
PLUGIN_HANDLED
}

public 
last_menu(idmenuitem)
{    
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    
    new 
name[32]
    new 
authid[32]
    new 
ip[32]
    new 
flags[32]
    
    
parseiNamenamecharsmax(name)-1authidcharsmax(authid)-1ipcharsmax(ip)-1flagscharsmax(flags)-1)
    
/*
        here you can do anything ._.
        
        amx_addban(authid)
        amx_addban(ip)
        
        etc..
    */
    
return PLUGIN_HANDLED


:/

error 017: undefined symbol "g_Size"
error 017: undefined symbol "GetInfo"

Last edited by bornas; 04-10-2014 at 03:20.
bornas is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 04-10-2014 , 10:35   Re: Plugin in 1 menu case
Reply With Quote #4

Quote:
Originally Posted by bornas View Post
:/

error 017: undefined symbol "g_Size"
error 017: undefined symbol "GetInfo"
Then you did something wrong as they are defined in your script
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 19:52.


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