AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [Request]Menu Help (https://forums.alliedmods.net/showthread.php?t=253869)

Alexblood2013 12-29-2014 18:00

[Request]Menu Help
 
Hello, i just thinking if is possible to add a cooldown in a menu (float)
like this:

if(user_has_weapon(id, CSW_HEGRENADE))
menu_additem(Menu, "\dHe grenade\w - \rAlready Has HE", "6", 0)
else {
if(Hegrnd_Countdown[id] = 0)
menu_additem(Menu, "\wHe grenade - \rREADY", "6", 0)
else
menu_additem(Menu, "\dHe grenade\w - \r [%d]", "6", 0, Hegrnd_Countdown[id])
}

If can be done , how it should look>?

Right now i get a warning : possible unintended assignmenet

silentscope 12-31-2014 03:41

Re: [Request]Menu Help
 
a hint you have an error in your if statement and for cooldown you can use "set_task"

bat 12-31-2014 08:20

Re: [Request]Menu Help
 
Some sh*t
Code:

#include amxmodx
#include fun
#include amxmisc

new coutdownhegrenade[33]

public plugin_init(){
    register_clcmd("say test", "menu")
    register_menu("Menu Grenade", -1, "Gren")
}
public menu(id){
        new sMenu[512], iKeys = MENU_KEY_1
        new iLen = formatex (sMenu, charsmax (sMenu), "\yHe grenade menu^n")
        if(user_has_weapon(id, CSW_HEGRENADE))
        iLen += formatex(sMenu[iLen], charsmax(sMenu)-iLen, "\r1. Already have hegrenade!^n")
        else if(coutdownhegrenade[id] > 1)
        iLen += formatex(sMenu[iLen], charsmax(sMenu)-iLen, "\r1. wait: %d!^n", coutdownhegrenade[id])
        else
        iLen += formatex(sMenu[iLen], charsmax(sMenu)-iLen, "\r1. Get hegrenade!^n")
        show_menu(id, iKeys, sMenu, -1, "Menu Grenade")
}

public Gren(id, key)
{
      switch(key){
        case 0:
        {
            if(user_has_weapon(id, CSW_HEGRENADE)) return 0;
            if(coutdownhegrenade[id] > 1) return 0;

            give_item(id, "weapon_hegrenade")
                coutdownhegrenade[id] += 120
                cout(id)       
        }
    } return PLUGIN_CONTINUE
}

public cout(id){
    if(coutdownhegrenade[id] < 0)
        {
            return;
    }
        coutdownhegrenade[id] --
        set_task(1.0, "cout", id)
}


zmd94 12-31-2014 09:12

Re: [Request]Menu Help
 
Just use new AMX menu system to do the job. ;)


All times are GMT -4. The time now is 15:21.

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