View Single Post
Author Message
abood alnjjar
Member
Join Date: Oct 2015
Location: palestine
Old 11-25-2015 , 15:42   [HELP] limit buy HP
Reply With Quote #1

hi guys...
how to limit this Extra item to can be buy it just 1 time in round

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

new const item_name[] = "Buy 2500 HP!"
new g_itemid_buyhp
new hpamount

public plugin_init() 
{
	register_plugin("[ZoZ] Buy Health Points", "1.0", "T[h]E Dis[as]teR")
	hpamount = register_cvar("zp_buyhp_amount", "2500")
	g_itemid_buyhp = zp_register_extra_item(item_name, 5, ZP_TEAM_HUMAN & ZP_TEAM_ZOMBIE)
}
public zp_extra_item_selected(id,itemid)
{
	if(!is_user_alive(id))
	
	return PLUGIN_HANDLED;
	
	if(itemid==g_itemid_buyhp)
	{
		if(zp_get_user_ammo_packs(id) < 5)
		{
			client_print(id, print_chat,"[ZoZ] Not enough Ammopacks!");
			return PLUGIN_HANDLED;
		}
		else
		{
			set_user_health(id,get_user_health(id)+get_pcvar_num(hpamount));
			zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - 5);
			client_print(id, print_chat,"[ZP] You Bought HP!");
		}
	}
	return PLUGIN_CONTINUE;
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang3082\\ f0\\ fs16 \n\\ par }
*/
__________________
abood alnjjar is offline