Raised This Month: $ Target: $400
 0% 

[Help] Menu Weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Xenon
Junior Member
Join Date: Sep 2008
Old 09-04-2008 , 11:42   [Help] Menu Weapons
Reply With Quote #1

Hi im beginning in scripting and i have a error not in the compiler,in the compiler nothing is wrong (sorry my bad english),when i test the plugin inside the game,plugin is about Menu Weapons,i wanna,when i type /rifles,shows a rifles menu,and when i type /pistols,shows a pistol menu,it works with /rifles but doesnt work with /pistols here my code:

Code:
#include <amxmod>


public plugin_init()
{
   register_clcmd( "say /rifles","ShowMenu", -1, "Shows The menu" )

   register_clcmd( "say /pistols","ShowMenu2", -1, "Shows The menu" )
   
   register_menucmd(register_menuid("\yMenu de Rifles:"), 1022, "MenuCommand" )
   
   register_menucmd(register_menuid("\yMenu de Armas:"), 1023, "MenuCommand2" )

   return PLUGIN_CONTINUE
}

public ShowMenu( id )
{
   new szMenuBody[256]
   new keys

   new nLen = format( szMenuBody, 255, "\yMenu de Armas:^n" )

   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w1. Granada" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. Ak 47" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w3. Colt m4a1" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w4. AWP" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w5. Mp5" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w6. Scout" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w7. arma" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w8. armazon" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w9. armeza" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Salir" )

   keys = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)

   show_menu( id, keys, szMenuBody, -1 )

   return PLUGIN_CONTINUE
}

public MenuCommand( id, key )
{
 

   switch( key )
   {
       case 0: give_item(id, "weapon_hegrenade") ,client_print( id, print_chat, "Has comprado una granada" )
       case 1: give_item(id, "weapon_ak47"), client_print( id, print_chat, "Has comprado ak 47" )
       case 2: give_item(id, "weapon_m4a1") , client_print( id, print_chat, "Has comprado ak m4a1" )
       case 3: give_item(id, "weapon_awp" ) , client_print( id, print_chat, "Has comprado AWP" )
       case 4: give_item(id, "weapon_mp5 navy" ) , client_print( id, print_chat, "Has comprado MP5" )
       case 5: give_item(id, "weapon_scout" ) , client_print( id, print_chat, "Has comprado Scout" )
       case 6: client_print( id, print_chat, "Menu Option #7" )
       case 7: client_print( id, print_chat, "Menu Option #8" )
       case 8: client_print( id, print_chat, "Menu Option #9" )
       case 9: client_print( id, print_chat, "Menu Option EXIT" )
   }

   return PLUGIN_CONTINUE
}

public ShowMenu2( id )
{
   new szMenuBody[256]
   new key

   new nLen = format( szMenuBody, 255, "\yMenu de Rifles:^n" )

   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w1. awp" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w2. SCOUT" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w3. Colt m4a1" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w4. ENCONSTRUCCION" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w5. ENCONSTURRICON" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w6. Scout" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w7. arma" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w8. armazon" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n\w9. armeza" )
   nLen += format( szMenuBody[nLen], 255-nLen, "^n^n\w0. Salir" )

   key = (1<<0|1<<1|1<<2|1<<3|1<<4|1<<5|1<<6|1<<7|1<<8|1<<9)

   show_menu( id, key, szMenuBody, -1 )

   return PLUGIN_CONTINUE
}

public MenuCommand2( id, letras )
{
 

   switch( key )
   {
       case 0: give_item(id, "weapon_awp") ,client_print( id, print_chat, "Has comprado una granada" )
       case 1: give_item(id, "weapon_scout"), client_print( id, print_chat, "Has comprado ak 47" )
       case 2: give_item(id, "weapon_m4a1") , client_print( id, print_chat, "Has comprado ak m4a1" )
       case 3: give_item(id, "weapon_awp" ) , client_print( id, print_chat, "Has comprado AWP" )
       case 4: give_item(id, "weapon_mp5 navy" ) , client_print( id, print_chat, "Has comprado MP5" )
       case 5: give_item(id, "weapon_hegrenade" ) , client_print( id, print_chat, "Has comprado Scout" )
       case 6: client_print( id, print_chat, "option2" )
       case 7: client_print( id, print_chat, "option3" )
       case 8: client_print( id, print_chat, "option" )
       case 9: client_print( id, print_chat, "asdasd EXIT" )
   }

   return PLUGIN_HANDLED
  
  }
When i choose any Option menu in the /pistols menu nothing happend ,but the /rifles menu it works,if somebody can help me,thank you.

Post data: Sorry my bad english im from Argentina.

Last edited by Xenon; 09-04-2008 at 11:45.
Xenon is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 09-05-2008 , 09:29   Re: [Help] Menu Weapons
Reply With Quote #2

PHP Code:
public MenuCommand2idletras 
need to be
PHP Code:
public MenuCommand2idkey 
__________________
xPaw is offline
Xenon
Junior Member
Join Date: Sep 2008
Old 09-05-2008 , 19:56   Re: [Help] Menu Weapons
Reply With Quote #3

Thank you very much,it helps me a lot .Good luck.
Xenon 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 03:12.


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