Here I fixed up half or all of your code. Now all the menus works 100%
PHP Code:
#include <amxmodx>
#include <amxmisc>
new reason[33][32]
new damage[33]
new target[33]
new type[33]
public plugin_init()
{
register_plugin("slap/slay/kick reason", "val", "1.0");
register_clcmd("amx_kickmenu", "cmdKickMenu")
register_clcmd("amx_slapmenu", "cmdSlapMenu")
}
/////////////STOCKS
stock KickPlayer(id, szBuffer[], any:...)
{
static szReason[60]
vformat(szReason, charsmax(szReason), szBuffer, 3)
message_begin(MSG_ONE, SVC_DISCONNECT,_, id)
write_string(szReason)
message_end()
}
/////////////////////SLAP MENU////////////////////////////////
public cmdSlapMenu(id) {
if(!(get_user_flags(id) & ADMIN_SLAY)) {
return PLUGIN_HANDLED
}
type[id] = 1;
//Create a variable to hold the menu
new menu = menu_create( "\rChoose a player!:", "menu_handler4" );
//We will need to create some variables so we can loop through all the players
new players[32], pnum,i, tempid;
//Some variables to hold information about the players
new szName [32], sInfo[2]
//Fill players with available players
get_players( players, pnum);
//Start looping through all players
for ( i=0;i<pnum;i++ )
{
//Save a tempid so we do not re-index
tempid = players[i];
sInfo[0] = tempid; sInfo[1] = 0;
//Get the players name and userid as strings
get_user_name( tempid, szName, charsmax( szName ) );
//Add the item for this player
menu_additem( menu,szName, sInfo);
}
//We now have all players in the menu, lets display the menu
menu_display( id, menu);
return PLUGIN_HANDLED
}
public menu_handler4( id, menu, item )
{
if ( item == MENU_EXIT )
{
menu_destroy(menu);
return PLUGIN_HANDLED;
}
new szData4[2], szName[64];
new item,access, item_callback;
menu_item_getinfo( menu, item,access, szData4,charsmax(szData4), szName,charsmax( szName ), item_callback );
target[id] = str_to_num(szData4)
client_print(0,print_chat,"%s player id = #%d",szName, player)
menu_destroy( menu );
ChooseDamage(id)
return PLUGIN_HANDLED;
}
/////////////////////KICK MENU////////////////////////////////
public cmdKickMenu(id) {
if(!(get_user_flags(id) & ADMIN_KICK)) {
return PLUGIN_HANDLED
}
type[id] = 2;
//Create a variable to hold the menu
new menu = menu_create( "\rChoose a player!:", "menu_handler3" );
//We will need to create some variables so we can loop through all the players
new players[32], pnum, tempid, i;
//Some variables to hold information about the players
new szName[32],szUserId[2];
//Fill players with available players
get_players( players, pnum);
for (i = 0; i<pnum;i++)
{
//Save a tempid so we do not re-index
tempid = players[i];
//Get the players name and userid as strings
get_user_name( tempid, szName, charsmax( szName ) );
szUserId [0] = tempid; szUserId [1] = 0;
//Add the item for this player
menu_additem( menu, szName,szUserId);
}
//We now have all players in the menu, lets display the menu
menu_display( id, menu);
return PLUGIN_HANDLED
}
public menu_handler3( id, menu, item )
{
if ( item == MENU_EXIT )
{
return PLUGIN_HANDLED;
}
new szData3[2], szName[64];
new item,access, item_callback;
menu_item_getinfo( menu, item,access, szData3,charsmax(szData3), szName,charsmax( szName ), item_callback );
target[id] = str_to_num(szData3)
menu_destroy( menu );
AwesomeMenu( id )
return PLUGIN_HANDLED;
}
public ChooseDamage(id) {
new menu = menu_create( "\rChoose Damage!:", "menu_handler5" );
menu_additem( menu, "\w1 DMG", "", 0 );
menu_additem( menu, "\w5 DMG", "", 0 );
menu_additem( menu, "\w10 DMG", "", 0 );
menu_additem( menu, "\w50 DMG", "", 0 );
menu_additem( menu, "\wSLAY", "", 0 );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, menu, 0 );
}
public menu_handler5( id, menu, item )
{
if ( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
switch( item )
{
case 0:
{
damage[id] = 1;
}
case 1:
{
damage[id] = 5
}
case 2:
{
damage[id] = 10
}
case 3:
{
damage[id] = 50
}
case 4:
{
damage[id] = 999
}
}
menu_destroy( menu );
AwesomeMenu( id )
return PLUGIN_HANDLED;
}
public AwesomeMenu( id ) {
new menu = menu_create( "\rChoose Reason!:", "menu_handler" );
menu_additem( menu, "\wRetry", "", 0 );
menu_additem( menu, "\wAir", "", 0 );
menu_additem( menu, "\wNekanen", "", 0 );
menu_additem( menu, "\wBez baza", "", 0 );
menu_additem( menu, "\wDruga prichina", "", 0 );
menu_setprop( menu, MPROP_EXIT, MEXIT_ALL );
menu_display( id, menu, 0 );
}
public menu_handler( id, menu, item )
{
if ( item == MENU_EXIT )
{
menu_destroy( menu );
return PLUGIN_HANDLED;
}
switch( item )
{
case 0:
{
format(reason[id],charsmax(reason[]),"Retry")
}
case 1:
{
format(reason[id],charsmax(reason[]),"Air")
}
case 2:
{
format(reason[id],charsmax(reason[]),"Nekanen")
}
case 3:
{
format(reason[id],charsmax(reason[]),"Bez baza")
}
case 4:
{
format(reason[id],charsmax(reason[]),"Druga prichina")
}
}
menu_destroy( menu );
Punish(id)
return PLUGIN_HANDLED;
}
public Punish(id) {
//slap
if(type[id] == 1) {
if (is_user_alive( target[id] ) )
{
user_slap(target[id],damage)
new name[32]
get_user_name(id,name,31)
new name2[32]
get_user_name(target[id],name2,31)
client_print(0,print_chat,"Admin %s has slapped %s with %d damage, Reason: %s",name,name2,damage,reason)
}
}
//kick
else if(type[id] == 2){
if (is_user_connected( target[id] ) )
{
KickPlayer(target[id],reason)
new name[32]
get_user_name(id,name,31)
new name2[32]
get_user_name(target[id],name2,31)
client_print(0,print_chat,"Admin %s has kicked %s, Reason: %s",name,name2,reason[id])
}
}
//clear
target[id] = 0
type[id] = 0
damage[id] = 0
//end clear
return PLUGIN_HANDLED;
}