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

[Request]Menu Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alexblood2013
Senior Member
Join Date: Aug 2014
Old 12-29-2014 , 18:00   [Request]Menu Help
Reply With Quote #1

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
Alexblood2013 is offline
silentscope
Junior Member
Join Date: Jul 2011
Old 12-31-2014 , 03:41   Re: [Request]Menu Help
Reply With Quote #2

a hint you have an error in your if statement and for cooldown you can use "set_task"
silentscope is offline
bat
Veteran Member
Join Date: Jul 2012
Old 12-31-2014 , 08:20   Re: [Request]Menu Help
Reply With Quote #3

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)
}
__________________
bat is offline
Send a message via Skype™ to bat
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 12-31-2014 , 09:12   Re: [Request]Menu Help
Reply With Quote #4

Just use new AMX menu system to do the job. ;)
zmd94 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 13:38.


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