Código:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <zombieplague>
#define PLUGIN "[ZP] Donate Ap Menu"
#define VERSION "1.0"
#define AUTHOR "Biel-oGrande"
#define Prefix "Serve"
new Player[33]
new block[33]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("say /doar","menu_ammo_donate")
register_clcmd("say_team /doar","menu_ammo_donate")
register_clcmd("DOAR_AMMOPACKS","cmd_donate_ammo")
}
public menu_ammo_donate(id) {
if(cs_get_user_team(id) == CS_TEAM_SPECTATOR) return PLUGIN_HANDLED
new menu = menu_create("\rEscolha um jogador para doar:\w", "handled_menu_ammo_donate")
new players[32], pnum, tempid
new szName[32], szTempid[10]
get_players(players, pnum)
for( new i; i<pnum; i++ ) {
tempid = players[i]
if(id != tempid) {
get_user_name(tempid, szName, 31)
num_to_str(tempid, szTempid, 9)
menu_additem(menu, szName, szTempid, 0)
menu_setprop(menu, MPROP_EXITNAME, "Sair")
menu_setprop(menu, MPROP_BACKNAME, "Voltar")
menu_setprop(menu, MPROP_NEXTNAME, "Proxima")
}
}
menu_display(id, menu)
return PLUGIN_HANDLED
}
public handled_menu_ammo_donate(id, menu, item) {
if(item == MENU_EXIT) return PLUGIN_HANDLED
new data[6], iName[64]
new access, callback
menu_item_getinfo(menu, item, access, data,5, iName, 63, callback)
Player[id] = str_to_num(data)
client_cmd(id, "messagemode DOAR_AMMOPACKS")
set_hudmessage(0, 255, 0, 0.02, 0.17, 0, 6.0, 12.0)
show_hudmessage(id, "Digite o valor que deseja doar.")
client_print_color(id, "!g[%s] !tDigite o valor que deseja doar.",Prefix)
block[id] = true
return PLUGIN_HANDLED
}
public cmd_donate_ammo(id) {
new szArgs[16]
read_args(szArgs, charsmax(szArgs))
remove_quotes(szArgs)
trim(szArgs)
new szName_a[32], szName_b[32]
get_user_name(id, szName_a, charsmax(szName_a))
get_user_name(Player[id], szName_b, charsmax(szName_b))
new szNum = str_to_num(szArgs)
if (szNum <= 0) {
set_hudmessage(255, 0, 0, 0.02, 0.17, 0, 6.0, 12.0)
show_hudmessage(id, "Quantia invalida.")
client_print_color(id, "!g[%s] !tQuantia invalida.",Prefix)
menu_ammo_donate(id)
return PLUGIN_HANDLED
}
if(szNum > zp_get_user_ammo_packs(id)) {
set_hudmessage(255, 0, 0, 0.02, 0.17, 0, 6.0, 12.0)
show_hudmessage(id, "Quantia superior a atual.")
client_print_color(id, "!g[%s] !tQuantia superior a atual.",Prefix)
menu_ammo_donate(id)
return PLUGIN_HANDLED
}
zp_set_user_ammo_packs(id, zp_get_user_ammo_packs(id) - szNum)
zp_set_user_ammo_packs(Player[id], zp_get_user_ammo_packs(Player[id]) + szNum)
client_print_color(0, "!g[%s]!y %s !tdoou!y %i !tAmmoPacks para!y %s.",Prefix, szName_a, szNum, szName_b)
return PLUGIN_HANDLED
}
stock client_print_color(const id, const input[], any:...) {
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4")
replace_all(msg, 190, "!y", "^1")
replace_all(msg, 190, "!t", "^3")
replace_all(msg, 190, "!team2", "^0")
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, get_user_msgid("SayText"), _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1046\\ f0\\ fs16 \n\\ par }
*/
Eu queria que Master com Flag B poderia acessar esse comando.