Raised This Month: $ Target: $400
 0% 

GHW amxmodmenu


Post New Thread Reply   
 
Thread Tools Display Modes
3v0
Junior Member
Join Date: Feb 2011
Old 02-28-2011 , 12:30   Re: GHW amxmodmenu
Reply With Quote #31

I had the unknown command error too the fix can be found below

Fix for the problem open up GHW_amxmodmenu.sma and paste in these 2 PHP codes (i couldn't paste it all in 1 PHP because its too big) in order for it to work first paste part 1 then part 2 then recompile
OR you can download it from my post below
uh oh and GHW_Chronic, excellent plugin good job
Part 1 of PHP Code

PHP Code:
#define VERSION    "1.0"

#include <amxmodx>
#include <amxmisc>

#define MAX_ITEMS    100

new menu_file[256] = "ghwmodmenu.ini"

new description[MAX_ITEMS][32]
new 
admin_flags[MAX_ITEMS]
new 
execute_string[MAX_ITEMS][256]
new 
execute_location[MAX_ITEMS]
new 
bool:requires_menu_two[MAX_ITEMS]
new 
num_items

new current_page[33]
new 
current_options[33][7]
new 
next_command[33]
new 
selected_command[33]

public 
plugin_init()
{
    
register_plugin("GHW amxmodmenu",VERSION,"GHW_Chronic")
    
register_concmd("amxmodmenu2","cmd_menu")
    
register_concmd("ghwmodmenu","cmd_menu")

    
register_menucmd(register_menuid("menu_one"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"menu_one_pressed")
    
register_menucmd(register_menuid("menu_two"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9),"menu_two_pressed")

    
load_menu()
}

public 
load_menu()
{
    new 
configsdir[256]
    
get_configsdir(configsdir,255)
    
format(menu_file,255,"%s/%s",configsdir,menu_file)

    if(!
file_exists(menu_file))
        return ;

    new 
Fsize file_size(menu_file,1)

    new 
read[512], trash
    
new temp[32]
    for(new 
i=0;i<Fsize && num_items<100;i++)
    {
        
read_file(menu_file,i,read,511,trash)

        if(
read[0]== ';' || strlen(read) < 10)
        {
            if(
== Fsize 1)
                break;
            continue ;
        }

        
strbreak(read,description[num_items],31,read,511)
        
strbreak(read,temp,31,read,511)
        for(new 
j=strlen(temp) - 1;>= 0;j--)
        {
            switch(
temp[j])
            {
                case 
'a'admin_flags[num_items] += ADMIN_IMMUNITY
                
case 'b'admin_flags[num_items] += ADMIN_RESERVATION
                
case 'c'admin_flags[num_items] += ADMIN_KICK
                
case 'd'admin_flags[num_items] += ADMIN_BAN
                
case 'e'admin_flags[num_items] += ADMIN_SLAY
                
case 'f'admin_flags[num_items] += ADMIN_MAP
                
case 'g'admin_flags[num_items] += ADMIN_CVAR
                
case 'h'admin_flags[num_items] += ADMIN_CFG
                
case 'i'admin_flags[num_items] += ADMIN_CHAT
                
case 'j'admin_flags[num_items] += ADMIN_VOTE
                
case 'k'admin_flags[num_items] += ADMIN_PASSWORD
                
case 'l'admin_flags[num_items] += ADMIN_RCON
                
case 'm'admin_flags[num_items] += ADMIN_LEVEL_A
                
case 'n'admin_flags[num_items] += ADMIN_LEVEL_B
                
case 'o'admin_flags[num_items] += ADMIN_LEVEL_C
                
case 'p'admin_flags[num_items] += ADMIN_LEVEL_D
                
case 'q'admin_flags[num_items] += ADMIN_LEVEL_E
                
case 'r'admin_flags[num_items] += ADMIN_LEVEL_F
                
case 's'admin_flags[num_items] += ADMIN_LEVEL_G
                
case 't'admin_flags[num_items] += ADMIN_LEVEL_H
                
case 'u'admin_flags[num_items] += ADMIN_MENU
                
case 'y'admin_flags[num_items] += ADMIN_ADMIN
            
}
        }

        
strbreak(read,temp,31,read,511)
        
execute_location[num_items] = 1
        
if(equali(temp,"server"))
            
execute_location[num_items] = 2
        
else if(equali(temp,"target") || equali(temp,"client"))
            
execute_location[num_items] = 3

        strbreak
(read,temp,31,read,511)
        if(
equali(temp,"yes"))
            
requires_menu_two[num_items]=true

        format
(execute_string[num_items],255,"%s",read)

        new 
0
        
while(execute_string[num_items][j]==' ')
            
j++
        if(
execute_string[num_items][j]=='"')
            
execute_string[num_items][j] = ' '

        
strlen(execute_string[num_items]) - 1

        
while(j>=&& execute_string[num_items][j]==' ' || execute_string[num_items][j]=='    ')
            
j--

        if(
execute_string[num_items][j]=='"')
            
execute_string[num_items][j] = ' '


        
num_items++
    }

    return ;
}

public 
cmd_menu(id)
{
    
current_page[id] = 0
    next_command
[id] = 0
    create_menu_one
(id)
}

public 
create_menu_one(id)
{
    new 
menu[1024], keys
    keys 
MENU_KEY_0

    format
(menu,1023,"|GHW| AMX MOD X Menu^n")

    new 
current_keyi
    
new adminflags get_user_flags(id)
    for(
next_command[id], current_key 0;num_items && current_key 7;i++, current_key++)
    {
        if(
admin_flags[i] && !(adminflags admin_flags[i]))
        {
            
current_key--
            continue ;
        }

        
keys |= (1<<current_key)
        
current_options[id][current_key] = i
        format
(menu,1023,"%s^n%d. %s",menu,current_key 1,description[i])
    }

    
format(menu,1023,"%s^n",menu)

    if(
current_page[id])
    {
        
format(menu,1023,"%s^n8. Previous Page",menu)
        
keys |= MENU_KEY_8
    
}
    if( ((
current_page[id] + 1) * 7) < num_items )
    {
        
format(menu,1023,"%s^n9. Next Page",menu)
        
keys |= MENU_KEY_9
    
}

    
format(menu,1023,"%s^n^n0. Exit",menu)

    
show_menu(id,keys,menu,-1,"menu_one")
}

public 
menu_one_pressed(id,key)
{
    if(
key 7)
    {
        
selected_command[id] = current_options[id][key]
        
current_page[id] = 0
        
if(requires_menu_two[selected_command[id]])
        {
            
create_menu_two(id)
        }
        else
        {
            new 
name[34]
            new 
authid[32]
            new 
ip[32]
            new 
userid[8]
            
get_user_name(id,name,33)
            
get_user_authid(id,authid,31)
            
get_user_ip(id,ip,31,1)
            
format(userid,7,"%d",id)

            new 
copystring[384]
            
format(copystring,383,"%s",execute_string[selected_command[id]])
            
replace_all(copystring,383,"*n",name)
            
replace_all(copystring,383,"*name",name)
            
replace_all(copystring,383,"*u",userid)
            
replace_all(copystring,383,"*userid",userid)
            
replace_all(copystring,383,"*a",authid)
            
replace_all(copystring,383,"*authid",authid)
            
replace_all(copystring,383,"*s",authid)
            
replace_all(copystring,383,"*steamid",authid)
            
replace_all(copystring,383,"*i",ip)
            
replace_all(copystring,383,"*ip",ip)

            switch(
execute_location[selected_command[id]])
            {
                case 
2server_cmd("%s",copystring)
                default: 
client_cmd(id,"%s",copystring)
            }

            
cmd_menu(id)
        }
    }
    else if(
key == 7)
    {
        
current_page[id]--
        
next_command[id] -= 7
        
if(current_page[id] < || next_command[id] < 0)
        {
            
current_page[id] = 0
            next_command
[id] = 0
        
}

        
create_menu_one(id)
    }
    else if(
key == 8)
    {
        
current_page[id]++
        
next_command[id] += 7
        
if(next_command[id] > num_items)
        {
            
current_page[id] = 0
            next_command
[id] = 0
        
}
        
create_menu_one(id)
    }
}

public 
create_menu_two(id)
{
    new 
menu[1024], keys
    keys 
MENU_KEY_0

    format
(menu,1023,"|GHW| AMX MOD X Menu^n")

    new 
players[32], num
    get_players
(players,num,"h")

    new 
current_keyiname[32]
    for(
= (current_page[id] * 7), current_key 0;< ((current_page[id] + 1) * 7) && num;i++, current_key++)
    {
        if(
id!=players[i] && (get_user_flags(players[i]) & ADMIN_IMMUNITY))
        {
            
current_key--
            continue ;
        }

        
keys |= (1<<current_key)
        
current_options[id][current_key] = players[i]
        
get_user_name(players[i],name,31)
        
format(menu,1023,"%s^n%d. %s",menu,current_key 1,name)
    }

    
format(menu,1023,"%s^n",menu)

    if(
current_page[id])
    {
        
format(menu,1023,"%s^n8. Previous Page",menu)
        
keys |= MENU_KEY_8
    
}
    if( 
num )
    {
        
format(menu,1023,"%s^n9. Next Page",menu)
        
keys |= MENU_KEY_9
    
}

    
format(menu,1023,"%s^n^n0. Main Menu",menu)

    
show_menu(id,keys,menu,-1,"menu_two")
}

public 
menu_two_pressed(id,key)
{
    if(
key 7)
    {
        new 
target current_options[id][key]
        if(
is_user_connected(target))
        {
            new 
name[34]
            new 
authid[32
Part 2 of 2 PHP

PHP Code:
new ip[32]
            new 
userid[8]
            
get_user_name(target,name,33)
            
get_user_authid(target,authid,31)
            
get_user_ip(target,ip,31,1)
            
format(userid,7,"%d",get_user_userid(target))

            new 
copystring[384]
            
format(copystring,383,"%s",execute_string[selected_command[id]])
            
replace_all(copystring,383,"*n",name)
            
replace_all(copystring,383,"*name",name)
            
replace_all(copystring,383,"*u",userid)
            
replace_all(copystring,383,"*userid",userid)
            
replace_all(copystring,383,"*a",authid)
            
replace_all(copystring,383,"*authid",authid)
            
replace_all(copystring,383,"*s",authid)
            
replace_all(copystring,383,"*steamid",authid)
            
replace_all(copystring,383,"*i",ip)
            
replace_all(copystring,383,"*ip",ip)

            switch(
execute_location[selected_command[id]])
            {
                case 
2server_cmd("%s",copystring)
                case 
3client_cmd(target,"%s",copystring)
                default: 
client_cmd(id,"%s",copystring)
            }
            
client_print(id,print_chat,"[AMXX] %s Executed on %s",description[selected_command[id]],name)
            
        }
        else
        {
            
client_print(id,print_chat,"[AMXX] Client Disconnected already")
        }
        
cmd_menu(id)
    }
    else if(
key == 7)
    {
        
current_page[id]--
        if(
current_page[id] < 0)
            
current_page[id] = 0
        create_menu_two
(id)
    }
    else if(
key == 8)
    {
        
current_page[id]++
        
create_menu_two(id)
    }
    else
    {
        
cmd_menu(id)
    }

Attached Files
File Type: sma Get Plugin or Get Source (GHW_amxmodmenu.sma - 819 views - 9.0 KB)

Last edited by 3v0; 03-01-2011 at 08:31. Reason: organized
3v0 is offline
Bestkid
Member
Join Date: Jan 2013
Location: Under your Bed
Old 02-18-2013 , 07:24   Re: GHW amxmodmenu
Reply With Quote #32

I kinda have a problem with this plugin. I added slap to it and I generally give the menu for VIP use. But when like they select the player to slap, it slaps the player then it redirects them to the start of the menu. How can I stop this so when they press a number to slap someone, it doesn't redirect them to the main menu. Like so, they can keep pressing the number therefore keep slapping them...
Bestkid is offline
saad700
Member
Join Date: Dec 2012
Location: Morocco :D
Old 08-09-2013 , 15:13   Re: GHW amxmodmenu
Reply With Quote #33

Wow Thank's *_* I love You GHW
__________________
saad700 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:33.


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