Create menu buttons with an interval of use (Counter-Strike)
Hello,I need help,I want to make something like after pressing the menu button(the player is given the item) the next pressing can be performed in 2 minutes,how to do it?(For example, 3 Keyes)
The outcome:
#include
#include
#include
#include
#include
#define HEALTH 200
#define ARMOR 200
#define MONEY 8000
enum _:SKILLS_COUNT
{
SKILL_ASIMOV,
SKILL_WEAPONS,
SKILL_HP,
SKILL_ARMOR,
SKILL_DENEG
}
new UserSkill[33][SKILLS_COUNT];
new Ham:Ham_Player_ResetMaxSpeed = Ham_Item_PreFrame;
new MenuCan[33];
stock reset_skills(id) for(new i = 0; i < SKILLS_COUNT; i++) UserSkill[id] = 0;
public plugin_init()
{
register_plugin([CSDM] IMPERATOR Menu, 1.0, Anonymous);
RegisterHam(Ham_Spawn, player, fw_PlayerSpawn, 1);
register_clcmd(elita_menu, clcmd_vip_menu);
RegisterHam(Ham_Player_ResetMaxSpeed, player, fw_ResetMaxSpeed_Post, 1);
RegisterHam(Ham_TakeDamage, player, fw_TakeDamage);
register_message(get_user_msgid(CurWeapon), message_cur_weapon);
}
public client_authorized(id)
{
reset_skills(id);
}
public fw_PlayerSpawn(id)
{
if(!is_user_alive(id)) return;
reset_skills(id);
set_user_rendering(id);
MenuCan[id] = 2;
}
public clcmd_vip_menu(id)
{
if(!(get_user_flags(id) & ADMIN_RESERVATION)) return PLUGIN_CONTINUE;
if(MenuCan[id] < 1) return PLUGIN_HANDLED;
static szTemp[48];
by formatex(szTemp, 47, \rELITA menu [\dОсталось: %d\r], MenuCan[id]);
new menu = menu_create(szTemp, vip_menu_handle);
menu_additem(menu, Take HP \y[\r+200\y]);
menu_additem(menu, Take Armor \y[\r+200\y]);
menu_additem(menu, Take \d[In progress...]);
menu_additem(menu, Take \d[SANTISE]);
menu_additem(menu, Take \d[300$]);
menu_setprop(menu, MPROP_EXITNAME, Output);
menu_display(id, menu, 0);
return PLUGIN_HANDLED;
}
public vip_menu_handle(id, menu, item)
{
if(item == MENU_EXIT) return PLUGIN_HANDLED;
if(!is_user_alive(id)) return PLUGIN_HANDLED;
if(MenuCan[id] < 1) return PLUGIN_HANDLED;
switch(item)
{
case 0:
{
if(UserSkill[id][SKILL_HP] == 0)
{
UserSkill[id][SKILL_HP] = 1;
set_user_health(id, (get_user_health(id) + HEALTH));
MenuCan[id] -= 1;
}
else client_print(id, print_chat, You have already taken health);
}
case 1:
{
if(UserSkill[id][SKILL_ARMOR] == 0)
{
UserSkill[id][SKILL_ARMOR] = 1;
set_user_armor(id, (get_user_armor(id) + ARMOR));
MenuCan[id] -= 1;
}
else client_print(id, print_chat, You already took the armor);
}
case 4:
{
if(UserSkill[id][SKILL_DENEG] == 0)
{
UserSkill[id][SKILL_DENEG] = 1;
cs_set_user_money(id, cs_get_user_money(id) + 300)
MenuCan[id] -= 1;
}
else client_print(id, print_chat, You've taken away +300 $);
}
case 3:
{
if(UserSkill[id][SKILL_ASIMOV] == 0)
{
UserSkill[id][SKILL_ASIMOV] = 1;
client_cmd(id, zontik);
MenuCan[id] -= 1;
}
else client_print(id, print_chat, you already Have SANTISE);
}
case 2:
{
if(UserSkill[id][SKILL_ASIMOV] == 0)
{
UserSkill[id][SKILL_ASIMOV] = 1;
client_cmd(id, gfdr);
MenuCan[id] -= 1;
}
else client_print(id, print_chat, you already Have Starcher);
}
}
menu_destroy(menu);
return PLUGIN_HANDLED;
}
stock fm_cs_get_current_weapon_ent(id)
{
if (pev_valid(id) != 2)
return -1;
return get_pdata_cbase(id, 373, 5);
}
0 Comments