Raised This Month: $ Target: $400
 0% 

Help with menu loop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
KuvZz
Member
Join Date: Sep 2013
Location: Spain
Old 09-15-2013 , 14:39   Help with menu loop
Reply With Quote #1

Hello. I am starting with PAWN and I made a menu with three submenus. I tried to add a loop on the 3rd submenu but when I select the option on the second page, it has no effect.
Sorry if my English is not perfect.
PHP Code:
#include <amxmodx>  //Esencial
#include <fun>
#include <cstrike>
#include <amxmisc>

#define PLUGIN "Basic Menu"
#define VERSION "1.0"
#define AUTHOR "KuvZz"

#define OTROS 8 // OTROS es igual a 8.
new const Rank[OTROS][] = { "Glow Rojo""Glow Verde""Glow Azul""Peso ligero""Asesino""Hibrido""Juggernaut""INVISIBILIDAD! (Admin only)" }

public 
plugin_init()
{

    
// Registración de Plugin
    
register_plugin(PLUGIN,VERSION,AUTHOR )
    
register_clcmd("say /menu""abrir_menu")
    
register_clcmd("say_team /menu" "abrir_menu")
    
register_cvar("asesino""850")
    
}


public 
abrir_menu id 
{
    new 
Menu menu_create("\rMENU DE ARMAS POR \wKuvZz""menu1")
    
menu_additem(Menu"\wArmas CT" "1"0)
    
menu_additem(Menu"\wArmas T" "2"0)
    
menu_additem(Menu"\wOtros" "3"0)
    
ChatColor(id"!gTodo esto !teames gratuito !g:3 !y(por ahora)")
    
    
menu_setprop(Menu,MPROP_EXITNAME,"Salir")
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idMenu0)
    return 
PLUGIN_CONTINUE
    
}


public 
menu1(idMenuitem)

{

    if (
item == MENU_EXIT)
    {
        
menu_destroy(Menu)
    
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6], iAccessiCallbackiName[64];
    
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)
    
    
    switch (
str_to_num(iData)) 
    {
       
        case 
1ct(id)
       
        case 
2tt(id)
            
        case 
3otros(id)
    
    }
    
    return 
PLUGIN_CONTINUE
}
 
public 
ct(id)
{
    new 
Menu menu_create("\rArmas \wCounter Terrorist""menu_ct")
    
menu_additem(Menu"\w M4A1" "1"0)
    
menu_additem(Menu"\w SG550" "2"0)
    
menu_additem(Menu"\w Pack CT" "3"0)
    
    
menu_setprop(Menu,MPROP_EXITNAME,"Salir")
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idMenu0)
}

public 
menu_ct (idMenuitem)
{

    if (
item == MENU_EXIT)
    
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6], iAccessiCallbackiName[64];
    
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)
    
    switch (
str_to_num(iData)) 
    {
      case 
1
      {
      
ChatColor(id"!g[Weapons] !yElegiste !teamM4");
      
give_item(id"weapon_m4a1"); 
      }
      case 
2
      {
      
ChatColor(id"!g[Weapons] !yElegiste !teamSG550");
      
give_item(id"weapon_sg550");
      }
      case 
3:
      {
      
strip_user_weapons(id);
      
ChatColor(id"!g[Weapons] !yElegiste !teamel pack de CT");
      
give_item(id"weapon_knife");
      
give_item(id"weapon_m4a1");
      
give_item(id"weapon_usp");
      
give_item(id"weapon_sg550");
      
give_item(id"weapon_hegrenade");
      
give_item(id"weapon_flashbang");
      
give_item(id"weapon_flashbang");
      
give_item(id"weapon_smokegrenade");
      }
    }
return 
PLUGIN_HANDLED;
}
public 
tt(id)
{
    new 
Menu menu_create("\rArmas \wTerrorist""menu_tt")
    
menu_additem(Menu"\w AK-47" "1"0)
    
menu_additem(Menu"\w G3SG1" "2"0)
    
menu_additem(Menu"\w Pack Terrorist" "3"0)
    
    
menu_setprop(Menu,MPROP_EXITNAME,"Salir")
    
menu_setprop(MenuMPROP_EXITMEXIT_ALL)
    
    
menu_display(idMenu0)
}

public 
menu_tt (idMenuitem)
{

    if (
item == MENU_EXIT)
    
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6], iAccessiCallbackiName[64];
    
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)
    
    switch (
str_to_num(iData)) 
    {
      case 
1
      {
      
ChatColor(id"!g[Weapons] !yElegiste !teamAK-47");
      
give_item(id"weapon_ak47");
      }
      case 
2
      {
      
ChatColor(id"!g[Weapons] !yElegiste !teamG3SG1");
      
give_item(id"weapon_g3sg1");
      }
      case 
3:
      {
      
strip_user_weapons(id);
      
ChatColor(id"!g[Weapons] !yElegiste !teamel pack de T");
      
give_item(id"weapon_knife");
      
give_item(id"weapon_ak47");
      
give_item(id"weapon_elite");
      
give_item(id"weapon_g3sg1");
      
give_item(id"weapon_hegrenade");
      
give_item(id"weapon_flashbang");
      
give_item(id"weapon_flashbang");
      
give_item(id"weapon_smokegrenade");
      }
    }
    return 
PLUGIN_HANDLED;
}

public 
otros(id)
{
    new 
Posicion[8//Dos variables
    
new Menu menu_create("\rVarias cositas""menu_otro")
    
    for(new 
0OTROSi++)
    {
    
num_to_str(iPosicioncharsmax(Posicion))
    
menu_additem(MenuRank[i], Posicion)   
    }
    
menu_setprop(MenuMPROP_NEXTNAME"Pagina siguiente")
    
menu_setprop(MenuMPROP_BACKNAME"Pagina anterior")
    
menu_setprop(MenuMPROP_EXITNAME"Salir")
    
    
menu_display(idMenu0)
    return 
PLUGIN_HANDLED;
}

public 
menu_otro (idMenuitem)
{

    if (
item == MENU_EXIT)
    
    {
        
menu_destroy(Menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6], iAccessiCallbackiName[64];
    
    
menu_item_getinfo(MenuitemiAccessiData5iName63iCallback)
    
    switch (
str_to_num(iData)) 
    {
      case 
1
      {
      
ChatColor(id"!g[Glow] !yTe rodea un brillo !teamrojo");
      
set_user_rendering(idkRenderFxGlowShell,  25500kRenderNormal16);
      }
      case 
2
      {
      
ChatColor(id"!g[Glow] !yTe rodea un brillo !teamverde");
      
set_user_rendering(idkRenderFxGlowShell,  02550kRenderNormal16);
      }
      case 
3:
      {
      
ChatColor(id"!g[Glow] !yTe rodea un brillo !teamazul");
      
set_user_rendering(idkRenderFxGlowShell,  00255kRenderNormal16)
      }
      case 
4:
      {
      
ChatColor(id"!g[Ability] !yAhora pesas !teammenos");
      
set_user_gravity(id0.5)
      }
      case 
5:
      {
      
ChatColor(id"!g[Ability] !yVelocidad de movimiento !teamaumentada");
      
give_item(id"weapon_tmp");
      
set_user_maxspeed(idfloat(get_cvar_num("asesino")))
      
set_user_gravity(id1.0);
      }
      case 
6:
      {
      
ChatColor(id"!g[Ability] !yCorres y saltas mas con el !teamcuchillo");
      
strip_user_weapons(id);
      
give_item(id"weapon_knife");
      
set_user_gravity(id0.3)
      }
      case 
7:
      {
      
ChatColor(id"!g[Ability] !team+HP +Armor +Gravity -Speed");
      
strip_user_weapons(id);
      
give_item(id"weapon_m249");
      
set_user_gravity(id1.5)
      
set_user_health(id500);
      
set_user_armor(id200);
      }
      case 
8
      {
      if(!
is_user_admin(id)) //NO PONER PUNTO Y COMA!
         
{
         
ChatColor(id"!gERES INVISIBLE! !y(mas o menos)");
         
set_user_rendering(idkRenderFxGlowShell,  0000);
         }
      }
    }
    return 
PLUGIN_HANDLED;
// Stock del ChatColor, no modificar.
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color
    
replace_all(msg190"!team2""^0"// Team2 Color
    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
                
message_begin(MSG_ONE_UNRELIABLEget_user_msgid("SayText"), _players[i])
                
write_byte(players[i]);
                
write_string(msg);
                
message_end();
            }
        }
    }


Last edited by KuvZz; 09-15-2013 at 15:16.
KuvZz is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 09-15-2013 , 15:05   Re: Help with menu loop
Reply With Quote #2

I don't know but may
PHP Code:
 menu_additem(MenuRank[i], Posicion
should be
PHP Code:
 menu_additem(MenuRank[i], Posicion0
?

Last edited by ~Ice*shOt; 09-15-2013 at 15:05.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
KuvZz
Member
Join Date: Sep 2013
Location: Spain
Old 09-15-2013 , 15:15   Re: Help with menu loop
Reply With Quote #3

No. I renamed the "case 1" to "case 0", the "case 2" to "case 1"... because if I select the first option it has no effect, and the option of the second page too :/

Ty for post!
KuvZz is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 09-15-2013 , 15:44   Re: Help with menu loop
Reply With Quote #4

the case should start from 0 because your loop starts from 0 too

Edit. I saw a stupid mistake you've made, the last item is only for admins yes? And you are checking if is not player admin.. just remove '!'

Last edited by ~Ice*shOt; 09-15-2013 at 15:54.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
KuvZz
Member
Join Date: Sep 2013
Location: Spain
Old 09-15-2013 , 16:05   Re: Help with menu loop
Reply With Quote #5

Aaah! Thanks man, now works. Of course, it had no effect bacause I'm admin and it was checking for not admin. Ty.
KuvZz 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 18:59.


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