/* меню было взято у плагина screen maker by neugomon, звуки и идея у Wrecked */
#include <amxmodx>
#include <fakemeta>
new const FartSounds[][]=
{
"items/fart.wav",
"items/fart4.wav"
}
public plugin_precache()
{
for(new i=0;i<sizeof(FartSounds); i++)
engfunc(EngFunc_PrecacheSound, FartSounds[i])
}
public plugin_init()
{
register_plugin("[AMXX] Fart Menu", "Simple", "xxx")
register_clcmd("say /fartmenu", "Show_FartMenu")
}
public Show_FartMenu(id)
{
new menu = menu_create("\d[FartMenu] \yВыберите игрока", "players_menu")
new call = menu_makecallback("players_callback")
menu_setprop(menu, MPROP_EXITNAME, "Выход")
menu_setprop(menu, MPROP_BACKNAME, "Назад")
menu_setprop(menu, MPROP_NEXTNAME, "Далее")
new pl[32], pnum
get_players(pl, pnum, "ach")
for(new i, pid[2], name[32]; i < pnum; i++)
{
pid[0] = pl[i]
get_user_name(pl[i], name, charsmax(name))
menu_additem(menu, name, pid, 0, call)
}
menu_display(id, menu, 0)
return PLUGIN_HANDLED
}
public players_callback(id, menu, item)
{
new pid[2], _access, callback
new szItem[32], szNewItem[64]
menu_item_getinfo(menu, item, _access, pid, charsmax(pid), szItem, charsmax(szItem), callback)
if(pid[0] == id)
{
formatex(szNewItem, charsmax(szNewItem), "%s \d[\yВы\d]", szItem)
menu_item_setname(menu, item, szNewItem)
return ITEM_DISABLED
}
return ITEM_ENABLED
}
public players_menu(id, menu, item)
{
if(item == MENU_EXIT)
{
menu_destroy(menu)
return PLUGIN_HANDLED
}
new pid[2], _access, call
menu_item_getinfo(menu, item, _access, pid, charsmax(pid), .callback = call)
if(!is_user_connected(pid[0]))
client_print(id, print_chat, "* Игрок покинул сервер")
else
{
/*
new Float:Time = get_gametime()
new Float:LastFart[33]
if(Time - LastFart[pid[0]] >= 3.0)
{
LastFart[pid[0]] = Time
emit_sound(pid[0], CHAN_WEAPON, FartSounds[random(sizeof(FartSounds))], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}*/
emit_sound(pid[0], CHAN_WEAPON, FartSounds[random(sizeof(FartSounds))], VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
}
menu_destroy(menu)
return PLUGIN_HANDLED
}