/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
#define Keys (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
new MenuPos
new MenuPlayers[32]
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_menucmd(register_menuid(""), Keys, "Pressed")
register_clcmd("say /dodajVIP","DodawanieVIPa", "ADMIN_RCON","Dodaje VIP'a z poziomu serwera"
}
public DodawanieVIPa
{
}
public Show(id) {
ShowMenu(id, MenuPos = 0)
return PLUGIN_HANDLED
}
public ShowMenu(id, position) {
// Menu stuff //
if (position < 0) { return 0; }
new i, k
new MenuBody[255]
new CurrentKey = 0
new Start = position * 7
new Num
new UserName[32]
get_players(MenuPlayers, Num)
if (Start >= Num) { Start = position = MenuPos = 0; }
new Len = format(MenuBody, 255, "\yDodaj VIPa\R%d/%d^n\w^n", position+1, (Num / 7 + ((Num % 7) ? 1 : 0 )) )
new End = Start + 7
new Keys = (1<<9)
if (End > Num) { End = Num; }
for(i=Start;i<End;i++) {
k = MenuPlayers[i]
get_user_name(k, UserName, 31)
Keys |= (1<<CurrentKey++)
Len += format(MenuBody[Len], (255-Len), "\w%i. %s^n", CurrentKey, UserName)
}
if (End != Num) {
format(MenuBody[Len], (255-Len), "^n\w9. Nastepna Strona^n%s", position ? "\w" : "\w0. Wyjdz z menu")
Keys |= (1<<8)
}
else {
format(MenuBody[Len], (255-Len), "^n%s", position ? "\w" : "\w0. Wyjdz z menu")
}
show_menu(id, Keys, MenuBody, -1, "")
return 0
}
public Pressed(id, key) {
switch (key) {
case 8: ShowMenu(id, ++MenuPos) // More Option
case 9: ShowMenu(id, --MenuPos) // Back Option
default: {
// Get User ID and Username
new PlayerID = MenuPlayers[MenuPos * 7 + key]
new UserName[32]
get_user_name(PlayerID, UserName, 31)
}
}
return PLUGIN_HANDLED
}