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

Weapon menu


Post New Thread Reply   
 
Thread Tools Display Modes
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-09-2011 , 16:45   Re: Weapon menu
Reply With Quote #11

if you want cts to get this menu when they spawn then i guess you can do something like this:
Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> public plugin_init() {     register_plugin("hej", "1", "afs")     RegisterHam(Ham_Spawn, "player", "EventHamSpawn", 1)     // Add your own code here } public EventHamSpawn(id) {     if(is_user_alive(id) && get_user_team(id) == 2)         showMenu(id) } public showMenu(id) {     new menu = menu_create("Weapon Menu", "menuHandler")         menu_additem(menu, "\wak47 + Deagle", "1", 0);     menu_additem(menu, "\wM4A1 + Deagle", "2", 0);     menu_additem(menu, "\wMP5 Navy + Deagle", "3", 0);     menu_additem(menu, "\wXM1014  + Deagle", "4", 0);     menu_additem(menu, "\wM3  + Deagle", "5", 0);     menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER)     menu_display(id, menu, 0) } public menuHandler(id, menu, item) {     new data[6], szName[64];     new access, callback;     menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback);         new key = str_to_num(data)         switch(key)     {         case 1: //your stuff         case 3: //your stuff         case 4: //your stuff         case 5: //your stuff     }     menu_destroy(menu)     return PLUGIN_CONTINUE; }

Not tested but think it should do it

-----EDIT------

Tested works good...
Doesn't have a Exit option so they cant accidently close it.
But you could do this, add a item to exit it and then send them to a submenu
And ask them if they are sure they want to exit and send them back if they choose no

Last edited by Erox902; 06-11-2011 at 08:45. Reason: Small mistake :p
Erox902 is offline
STr!ker
Senior Member
Join Date: Jun 2009
Location: Germany
Old 06-10-2011 , 16:00   Re: Weapon menu
Reply With Quote #12

Lol i have already done this, but i want, that they can reopen it one time, if they have closed this menu, because they have pressed exit or another menu breaks the weaponmenu (e.g. Mapvotemenu etc.)

Quote:
Originally Posted by STr!ker View Post
PHP Code:
 #include <amxmodx>
 #include <cstrike>
 #include <fun>
 
 #define PLUGINNAME    "WeaponsforCT"
#define VERSION        "0.1b"
#define AUTHOR        "STrike"

 
public plugin_init()
 {
    
register_plugin(PLUGINNAMEVERSIONAUTHOR)
    
register_event"ResetHUD""Event_ResetHUD""be" );
    
register_clcmd"AntiFurien WaffenMenu","WeaponMenuforCt");
 }
public 
Event_ResetHUD(id)
{
    if(
is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
    {
        
WeaponMenuforCt(id)
    }
}
 public 
WeaponMenuforCt(id)
 {
    new 
menu menu_create("\rAntiFurien WaffenMenu:""menu_handler");
   
    
menu_additem(menu"\wak47 + Deagle""1"0);
    
menu_additem(menu"\wM4A1 + Deagle""2"0);
    
menu_additem(menu"\wMP5 Navy + Deagle""3"0);
    
menu_additem(menu"\wXM1014  + Deagle""4"0); 
    
menu_additem(menu"\wM3  + Deagle""5"0);
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL);
   
    
menu_display(idmenu0);
 
 }
 public 
menu_handler(idmenuitem)
{
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);
    new 
key str_to_num(data);
 
    switch(
key)
    {
        case 
1:
        {
    
give_item(id"weapon_ak47")
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(id,CSW_AK47,90)  
    
cs_set_user_bpammo(id,CSW_DEAGLE,35
        }
        case 
2:
        {
    
give_item(id"weapon_m4a1")
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(id,CSW_M4A1,90)  
    
cs_set_user_bpammo(id,CSW_DEAGLE,35
        }
        case 
3
        {
    
give_item(id"weapon_mp5navy")
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(id,CSW_MP5NAVY,120)  
    
cs_set_user_bpammo(id,CSW_DEAGLE,35
       }
case 
4
        {
    
give_item(id"weapon_xm1014")
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(id,CSW_XM1014,32)  
    
cs_set_user_bpammo(id,CSW_DEAGLE,35
        }
case 
5
        {
    
give_item(id"weapon_m3")
    
give_item(id"weapon_deagle")
    
cs_set_user_bpammo(id,CSW_M3,32)  
    
cs_set_user_bpammo(id,CSW_DEAGLE,35
        }
    }

    
menu_destroy(menu);
    return 
PLUGIN_HANDLED;
 } 
STr!ker is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-11-2011 , 06:52   Re: Weapon menu
Reply With Quote #13

dude look at it there IS NO EXIT BUTTON so they cant accidently close it
Erox902 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-11-2011 , 07:14   Re: Weapon menu
Reply With Quote #14

ResetHUD event is not appropriated, use Ham_Spawn is much better.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-11-2011 , 07:52   Re: Weapon menu
Reply With Quote #15

mine uses Ham_Spawn but he seems to be too lazy to try it -.-
Erox902 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-11-2011 , 08:36   Re: Weapon menu
Reply With Quote #16

Well, it's not directly related to his problem/request.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-11-2011 , 08:47   Re: Weapon menu
Reply With Quote #17

ConnorMcLeod:
if he just want it at new round and not on spawn he could do
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
right?

------------
Yeah maybe not I couldn't really understand what he accually wanted just did from what I understood :/

Last edited by Erox902; 06-11-2011 at 08:50. Reason: don't wanna do another post now :p
Erox902 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 06-11-2011 , 10:13   Re: Weapon menu
Reply With Quote #18

Quote:
Originally Posted by Erox902 View Post
right?
Wrong, players have not respawned yet at HLTV event.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-11-2011 , 11:35   Re: Weapon menu
Reply With Quote #19

ok thnx... that should be edited at this tutorial http://forums.alliedmods.net/showthr...ghlight=events...
so ppl get that
Erox902 is offline
STr!ker
Senior Member
Join Date: Jun 2009
Location: Germany
Old 08-07-2011 , 15:03   Re: Weapon menu
Reply With Quote #20

Quote:
Originally Posted by Erox902 View Post
if you want cts to get this menu when they spawn then i guess you can do something like this:
Code:
#include <amxmodx> #include <amxmisc> #include <hamsandwich> public plugin_init() { &nbsp;&nbsp;&nbsp;&nbsp;register_plugin("hej", "1", "afs") &nbsp;&nbsp;&nbsp;&nbsp;RegisterHam(Ham_Spawn, "player", "EventHamSpawn", 1) &nbsp;&nbsp;&nbsp;&nbsp;// Add your own code here } public EventHamSpawn(id) { &nbsp;&nbsp;&nbsp;&nbsp;if(is_user_alive(id) && get_user_team(id) == 2) &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;showMenu(id) } public showMenu(id) { &nbsp;&nbsp;&nbsp;&nbsp;new menu = menu_create("Weapon Menu", "menuHandler") &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;menu_additem(menu, "\wak47 + Deagle", "1", 0); &nbsp;&nbsp;&nbsp;&nbsp;menu_additem(menu, "\wM4A1 + Deagle", "2", 0); &nbsp;&nbsp;&nbsp;&nbsp;menu_additem(menu, "\wMP5 Navy + Deagle", "3", 0); &nbsp;&nbsp;&nbsp;&nbsp;menu_additem(menu, "\wXM1014 + Deagle", "4", 0); &nbsp;&nbsp;&nbsp;&nbsp;menu_additem(menu, "\wM3 + Deagle", "5", 0); &nbsp;&nbsp;&nbsp;&nbsp;menu_setprop(menu, MPROP_EXIT, MEXIT_NEVER) &nbsp;&nbsp;&nbsp;&nbsp;menu_display(id, menu, 0) } public menuHandler(id, menu, item) { &nbsp;&nbsp;&nbsp;&nbsp;new data[6], szName[64]; &nbsp;&nbsp;&nbsp;&nbsp;new access, callback; &nbsp;&nbsp;&nbsp;&nbsp;menu_item_getinfo(menu, item, access, data,charsmax(data), szName,charsmax(szName), callback); &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;new key = str_to_num(data) &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;switch(key) &nbsp;&nbsp;&nbsp;&nbsp;{ &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;case 1: //your stuff &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;case 3: //your stuff &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;case 4: //your stuff &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;case 5: //your stuff &nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;menu_destroy(menu) &nbsp;&nbsp;&nbsp;&nbsp;return PLUGIN_CONTINUE; }


Not tested but think it should do it

-----EDIT------

Tested works good...
Doesn't have a Exit option so they cant accidently close it.
But you could do this, add a item to exit it and then send them to a submenu
And ask them if they are sure they want to exit and send them back if they choose no

No i have the problem again with the new script...

The script:

PHP Code:
#include <amxmodx>
    #include <amxmisc>
    #include <hamsandwich>
    #include <cstrike>
    #include <fun>
     
    #define PLUGINNAME    "WeaponsforCT"
    #define VERSION        "0.2b"
    #define AUTHOR        "STrike"
     
     
    
public plugin_init()
    {
            
register_plugin(PLUGINNAMEVERSIONAUTHOR)
       
RegisterHam(Ham_Spawn"player""EventHamSpawn"1)
}

public 
EventHamSpawn(id)
{
    if(
is_user_alive(id) && get_user_team(id) == 2)
        
showMenu(id)

}

public 
showMenu(id)
{
    new 
menu menu_create("Weapon Menu""menuHandler")
    
    
menu_additem(menu"\wak47 + Deagle""1"0);
    
menu_additem(menu"\wM4A1 + Deagle""2"0);
    
menu_additem(menu"\wMP5 Navy + Deagle""3"0);
    
menu_additem(menu"\wXM1014  + Deagle""4"0); 
    
menu_additem(menu"\wM3  + Deagle""5"0);

    
menu_setprop(menuMPROP_EXITMEXIT_NEVER)
    
menu_display(idmenu0)
}

public 
menuHandler(idmenuitem)
{
    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);
    
    new 
key str_to_num(data)
    
    switch(
key)
    {
                      case 
1:
                    {
                                  
                            
give_item(id"weapon_ak47")
                            
give_item(id"weapon_deagle")
                            
cs_set_user_bpammo(id,CSW_AK47,90)  
                            
cs_set_user_bpammo(id,CSW_DEAGLE,35)
                           
                    }
                    case 
2:
                    {
                           
                            
give_item(id"weapon_m4a1")
                            
give_item(id"weapon_deagle")
                            
cs_set_user_bpammo(id,CSW_M4A1,90)  
                            
cs_set_user_bpammo(id,CSW_DEAGLE,35)
                    }
                    case 
3:
                    {
                           
                            
give_item(id"weapon_mp5navy")
                            
give_item(id"weapon_deagle")
                            
cs_set_user_bpammo(id,CSW_MP5NAVY,120)  
                            
cs_set_user_bpammo(id,CSW_DEAGLE,35)
                    }
                    case 
4:
                    {                          
                            
give_item(id"weapon_xm1014")
                            
give_item(id"weapon_deagle")
                            
cs_set_user_bpammo(id,CSW_XM1014,32)  
                            
cs_set_user_bpammo(id,CSW_DEAGLE,35)
                    }
                    case 
5:
                    {                         
                            
give_item(id"weapon_m3")
                            
give_item(id"weapon_deagle")
                            
cs_set_user_bpammo(id,CSW_M3,32)  
                            
cs_set_user_bpammo(id,CSW_DEAGLE,35)
                    }
    }
    
menu_destroy(menu)
    return 
PLUGIN_CONTINUE;



Come to my server and i will show you the problem!

IP: 62.75.204.158:27016

If you are ct, and you want to buy something buy the shop first (with writing shop in the chat) the weapon menu, which appears at every start of a round, isnīt shown again. (the shop is by the furienmod )

So i have suggested, that all players can write /guns in the chat, that they become the weaponmenu again, because they havenīt got already a weapon by the menu!

Itīs like CSDM, you can choose a weapon, but then you canīt reopen it. And when you havenīt got a weapon, you can write /guns ;)

I hope you understand me now.
STr!ker 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 16:40.


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