Já traduzido e sem BUG's. ^^
#include < amxmodx >
#include < amxmisc >
#include < zombieplague >
#define PLUGIN "[ZP] Donate Ammo Packs"
#define VERSION "1.0"
#define AUTHOR "r1laX , PomanoB"
new g_UserTotalAmmo[33]
new g_CvarAllowDonate
new SayText
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
g_CvarAllowDonate = register_cvar("zp_stats_allow_donate", "1")
register_clcmd("say", "handleSay")
register_clcmd("say_team", "handleSay")
register_event("HLTV", "RoundStart", "a", "1=0", "2=0")
SayText = get_user_msgid("SayText")
}
public RoundStart()
{
if (get_pcvar_num(g_CvarAllowDonate))
set_task(2.2, "MsgOnRoundStart")
}
public MsgOnRoundStart()
{
if(get_pcvar_num(g_CvarAllowDonate))
client_printcolor(0, "!g[ZP] !yPara doar ammo packs digite !g/donate")
}
public handleSay(id)
{
new args[64]
read_args(args, charsmax(args))
remove_quotes(args)
new arg1[16]
new arg2[32]
strbreak(args, arg1, charsmax(arg1), arg2, charsmax(arg2))
if (get_pcvar_num(g_CvarAllowDonate) && equal(arg1,"/donate", 7))
donate(id, arg2)
}
public donate(id, arg[])
{
new to[32], count[10]
strbreak(arg, to, 31, count, 9)
if (!to[0] || !count[0])
{
client_printcolor(id, "!g[ZP] !yUsage: say /donate ")
return
}
new ammo_sender = zp_get_user_ammo_packs(id)
new ammo
if (equal(count, "all"))
ammo = ammo_sender
else
ammo = str_to_num(count)
if (ammo <= 0)
{
client_printcolor(id, "!g[ZP] !yQuantidade de ammo packs invalida!")
return
}
ammo_sender -= ammo
if (ammo_sender < 0)
{
ammo+=ammo_sender
ammo_sender = 0
}
new reciever = cmd_target(id, to, (CMDTARGET_ALLOW_SELF))
if (!reciever || reciever == id)
{
client_printcolor(id, "!g[ZP] !yPlayer !g%s !ynao foi encontrado no servidor!", to)
return
}
zp_set_user_ammo_packs(reciever, zp_get_user_ammo_packs(reciever) + ammo)
g_UserTotalAmmo[reciever] += ammo
zp_set_user_ammo_packs(id, ammo_sender)
new aName[32], vName[32]
get_user_name(id, aName, 31)
get_user_name(reciever, vName, 31)
set_hudmessage(255, 0, 0, -1.0, 0.3, 0, 6.0, 6.0)
show_hudmessage(0, "%s doou %d Ammo Packs para %s!", aName, ammo, vName)
}
stock client_printcolor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!t", "^3") // Team Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for ( new i = 0; i < count; i++ )
{
if ( is_user_connected(players[i]) )
{
message_begin(MSG_ONE_UNRELIABLE, SayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}