Raised This Month: $32 Target: $400
 8% 

Help / Support ZP bonus menu in specific time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tomax079
Member
Join Date: Apr 2009
Location: Lithuania
Old 03-16-2019 , 05:04   ZP bonus menu in specific time
Reply With Quote #1

Hi everyone!

I need some help for extra zombie menu, when zombie can choose if he want to buy nemesis when he gets infected or not.
The problem is that menu don't dissapear and i want that menu would automatically close after 10 secs if zombie don't choose if he want to buy nemesis or not.
Can some one help me?

Code:
#include <amxmodx>
#include <amxmisc>
#include <zombieplague>

#define KEYSMENU		MENU_KEY_1 | MENU_KEY_2

#define NEMESIS_COST	25

public plugin_init()
{
	register_plugin("[ZP] Addon: First Zombie Bonus Menu", "0.1", "WPMG Team")
	register_menu("Buy Nemesis?", KEYSMENU, "menu_handler")
}

public zp_round_started(gamemode, id)
{
	if(gamemode != MODE_INFECTION)
		return PLUGIN_HANDLED

	if(zp_get_user_first_zombie(id))
	{
		new menu[256]

		formatex(menu, charsmax(menu), "\yYou want to buy Nemesis? \r%d Ammo Packs.^n^n\r1. \w%s^n\r2. \wNo.", NEMESIS_COST, zp_get_user_ammo_packs(id) > NEMESIS_COST ? "\wYes." : "\dYes.")
		show_menu(id, KEYSMENU, menu, -1, "Buy Nemesis?")
	}
	return PLUGIN_CONTINUE
}

public menu_handler(id, key)
{
	key++
	switch(key)
	{
		case 1:
		{
			if(zp_get_user_ammo_packs(id) > NEMESIS_COST)
			{
				zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - NEMESIS_COST)
				zp_make_user_nemesis(id)
				client_printcolor(id, "^4[ZP] ^1You bought Nemesis.")
			}
			else
			{
				client_printcolor(id, "^4[ZP] ^1Sorry. Not enough Ammo packs.")
			}
		}
	}
	return PLUGIN_HANDLED
}

stock client_printcolor(const id, const input[], any:...)
{
	new iCount = 1, iPlayers[32]
	static szMsg[191]

	vformat(szMsg, charsmax(szMsg), input, 3)
	replace_all(szMsg, 190, "/g", "^4")
	replace_all(szMsg, 190, "/y", "^1")
	replace_all(szMsg, 190, "/ctr", "^3")
	replace_all(szMsg, 190, "/w", "^0")

	if(id) iPlayers[0] = id
	else get_players(iPlayers, iCount, "ch")
	for (new i = 0; i < iCount; i++)
	{
		if(is_user_connected(iPlayers[i]))
		{
			message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, iPlayers[i])
			write_byte(iPlayers[i])
			write_string(szMsg)
			message_end()
		}
	}
}
tomax079 is offline
Send a message via Skype™ to tomax079
Reply


Thread Tools
Display Modes

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 14:51.


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