/*================================================================================
=
= Plugin: Time Present's
= Version: 0.1
= Version mod: Public
=
=
= Description:
= - This is plugin add in game presents.
= Presents are given every 3 min, 5 min, 10 min.
=
= Defaults:
= 3 min - 3000 $
= 5 min - 5000 $
= 10 min - 10000 $
=
=
=================================================================================*/
#include <amxmodx>
#include <cstrike>
/*================================================================================
[Macros]
=================================================================================*/
#define SMALL 3000
#define AVERAGE 5000
#define LARGE 10000
/*================================================================================
[Plugin Init]
=================================================================================*/
public plugin_init()
{
register_plugin("Time Presents", "0.1", "WPMG Team")
}
/*================================================================================
[Set Tasks]
=================================================================================*/
public client_putinserver(id)
{
set_task(180.0, "small_present", id)
set_task(300.0, "average_present", id)
set_task(600.0, "large_present", id)
set_task(100.0, "extraavarge_present",id)
}
/*================================================================================
[Remove Task]
=================================================================================*/
public client_disconnect(id)
{
if(task_exists(id))
remove_task(id)
}
/*================================================================================
[Give Presents]
=================================================================================*/
public small_present(id)
{
cs_set_user_money(id, min(cs_get_user_money(id) + SMALL, 16000), 1)
client_printcolor(id, "^4[Szerotol-ajandek] ^1Kaptal ^4%d $^1, mert jaccotal ezen a szerveren^4 3 percet.", SMALL)
}
public average_present(id)
{
cs_set_user_money(id, min(cs_get_user_money(id) + AVERAGE, 16000), 1)
client_printcolor(id, "^4[Szerotol-ajandek] ^1Kaptal ^4%d $^1, mert jaccotal ezen a szerveren^4 5 percet.", AVERAGE)
}
public large_present(id)
{
cs_set_user_money(id, min(cs_get_user_money(id) + LARGE, 16000), 1)
client_printcolor(id, "^4[Szerotol-ajandek] ^1Kaptal ^4%d $^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()
}
}
}