/*================================================================================
=
=					Plugin: Time Present's
=					Version: 0.1
=					Version mod: Zombie Plague
=
=
=		Description:
=			- This is plugin add in game presents.
=			Presents are given every 3 min, 5 min, 10 min.
=
=		Defaults:
=			10 min - 15 Ammo Packs
=			20 min - 25 Ammo Packs
=			30 min - 35 Ammo Packs
=
=
=================================================================================*/
 
#include <amxmodx>
#include <zombieplague>
 
/*================================================================================
 [Macros]
=================================================================================*/
 
#define SMALL				15
#define AVERAGE			25
#define LARGE				35
 
/*================================================================================
 [Plugin Init]
=================================================================================*/
 
public plugin_init()
{
	register_plugin("Time Presents", "0.1", "WPMG Team")
}
 
/*================================================================================
 [Set Tasks]
=================================================================================*/
 
public client_putinserver(id)
{
	set_task(600.0, "small_present", id)
	set_task(1200.0, "average_present", id)
	set_task(1800.0, "large_present", id)
}
 
/*================================================================================
 [Remove Task]
=================================================================================*/
 
public client_disconnect(id)
{
	if(task_exists(id))
		remove_task(id)
}
 
/*================================================================================
 [Give Presents]
=================================================================================*/
 
public small_present(id)
{
	zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + SMALL)
	client_printcolor(id, "^4[L.o.L] ^1Kaptal ^4%d Loszercsomagot^1, mert jaccotal ezen a szerveren^4 3 percet.", SMALL)
}
 
public average_present(id)
{
	zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + AVERAGE)
	client_printcolor(id, "^4[L.o.L] ^1Kaptal ^4%d Loszercsomagot^1, mert jaccotal ezen a szerveren^4 5 percet.", AVERAGE)
}
 
public large_present(id)
{
	zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) + LARGE)
	client_printcolor(id, "^4[L.o.L] ^1Kaptal ^4%d Loszercsomagot^1, mert jaccotal ezen a szerveren^4 10 percet.", LARGE)
}
 
/*================================================================================
 [Stock]
=================================================================================*/
 
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", "^1")
	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()
		}
	}
}