Raised This Month: $ Target: $400
 0% 

[HELP] Menu Problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 10-10-2015 , 06:57   Re: [HELP] Menu Problem
Reply With Quote #3

Code:
#include < amxmodx >
#include < cstrike >
#include < fun >
#include < zp50_core >
#include < zp50_class_survivor >
#include < zp50_class_sniper >
#include <rz_vip_core >
#include < zp50_colorchat >

const PRIMARY = ((1<<CSW_M4A1)|(1<<CSW_AK47)|(1<<CSW_GALI)|(1<<CSW_FAMAS)|(1<<CSW_AUG)|(1<<CSW_SG550)|(1<<CSW_SG552)|(1<<CSW_G3SG1)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_TMP)|(1<<CSW_MAC10)|(1<<CSW_UMP45)|(1<<CSW_P90)|(1<<CSW_SCOUT)|(1<<CSW_M3)|(1<<CSW_XM1014)|(1<<CSW_P90)|(1<<CSW_M249))

new g_used[33]

public plugin_init() 
{
    register_plugin( "[VIP] Weapon Menu", "1.0", "ADN" );  
    
    register_clcmd("say /weapon", "weapon_menu")
    
    register_event("HLTV", "HLTV", "a", "1=0", "2=0")

}

public HLTV()
{
    for (new id; id <= 32; id++)
    {
        g_used[id] = false
    }
}
    
public weapon_menu(id)
{
    if(!rz_is_user_happy(id) && !rz_is_user_vip(id) && !rz_is_user_god(id))
    {
        zp_colored_print(id, "Only^x04 VIP^x01 players can use this command")
        
        return PLUGIN_HANDLED
    }
        
    if(!is_user_alive(id) || zp_core_is_zombie(id) || zp_class_survivor_get(id) || zp_class_sniper_get(id))
    {
        zp_colored_print(id, "This command cannot be used right now")
        
        return PLUGIN_HANDLED
    }
    
    if(g_used[id])
    {
        zp_colored_print(id, "This command can be used once per round")
        
        return PLUGIN_HANDLED
    }
     
    new menu = menu_create( "Weapon Menu", "principal_handler" );
     
    menu_additem(menu, "SG550 Auto Sniper", "1", 0); 
    menu_additem(menu, "G3SG1 Auto Sniper", "2", 0); 
    menu_additem(menu, "M-249 Machine Gun", "3", 0); 
     
    menu_setprop( menu, MPROP_EXITNAME, "Exit")
    menu_display( id, menu, 0);
    
    return PLUGIN_CONTINUE;
}


public principal_handler(id, menu, item)
{
    if(item == MENU_EXIT)
    {
        menu_destroy(menu)
        return PLUGIN_HANDLED
    }
    
    switch(item)
    {
        case 0:
        {
            drop_prim(id)
            give_item(id, "weapon_sg550")
            cs_set_user_bpammo(id, CSW_SG550, 90)
            
            g_used[id] = true
        }
        case 1:
        {
            drop_prim(id)
            give_item(id, "weapon_g3sg1")
            cs_set_user_bpammo(id, CSW_G3SG1, 90)
            
            g_used[id] = true
        }
        case 2:
        {
            drop_prim(id)
            give_item(id, "weapon_m249")
            cs_set_user_bpammo(id, CSW_M249, 200)
            
            g_used[id] = true
        }
    }
    
    menu_destroy(menu);
    return PLUGIN_HANDLED;    
}

stock drop_prim(id) 
{
    new weapons[32], num
    get_user_weapons(id, weapons, num)
    for (new i = 0; i < num; i++) {
        if (PRIMARY & (1<<weapons[i])) 
        {
            static wname[32]
            get_weaponname(weapons[i], wname, sizeof wname - 1)
            engclient_cmd(id, "drop", wname)
        }
    }
}
zmd94 is offline
 



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 22:15.


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