Proszę, sprawdź czy działa
#include <amxmodx> #include <amxmisc> #define PLUGIN "TimeVotes" #define AUTHOR "FTS" #define VERSION "1.0" new choises[6] new Float:g_timelimit public plugin_init() { register_plugin("PLUGIN", "VERSION", "AUTHOR") set_task(180.0, "start_vote"); } public start_vote(id) { new menu = menu_create("rWybierz czas grania tej mapy.", "menu_handler") menu_additem(menu, "w10 minut", "1", 0) menu_additem(menu, "w15 minut", "2", 0) menu_additem(menu, "w20 minut", "3", 0) menu_additem(menu, "w25 minut", "4", 0) menu_additem(menu, "w30 minut", "5", 0) menu_addblank(menu, 0) menu_setprop(menu, MPROP_EXIT, MEXIT_ALL) new players[32], inum get_players(players, inum, "ch") for(new i = 0; i < inum; i++) { menu_display(players[i], menu, 0) } set_task(15.0, "finish_vote") choises[1] = choises[2] = choises[3] = choises[4] = choises[5] = 0 return 1 } public menu_handler(id, menu, item) { if (item == MENU_EXIT) { menu_cancel(id) return PLUGIN_HANDLED } new data[6], name[32] new access, callback menu_item_getinfo(menu, item, access, data, 5, _, _, callback) new key = str_to_num(data) get_user_name(id, name, 31) switch (key) { case 1: { client_print (0, print_chat, "[TimeVotes] %s zaglosowal na 10 minut.", name); } case 2: { client_print (0, print_chat, "[TimeVotes] %s zaglosowal na 15 minut.", name); } case 3: { client_print (0, print_chat, "[TimeVotes] %s zaglosowal na 20 minut.", name); } case 4: { client_print (0, print_chat, "[TimeVotes] %s zaglosowal na 25 minut.", name); } case 5: { client_print (0, print_chat, "[TimeVotes] %s zaglosowal na 30 minut.", name); } } ++choises[key] menu_cancel(id) return PLUGIN_HANDLED } public finish_vote() { g_timelimit = get_cvar_float("mp_timelimit") if(choises[1] > choises[2] && choises[1] > choises[3] && choises[1] > choises[4] && choises[1] > choises[5]) { client_print(0, print_chat, "[TimeVotes] Opcja ^"10 minut^" WYGRALA ( %d ) glosami.", choises[1]) server_cmd("mp_timelimit 10"); } else if(choises[2] > choises[1] && choises[2] > choises[3] && choises[2] > choises[4] && choises[2] > choises[5]) { client_print(0, print_chat, "[TimeVotes] Opcja ^"15 minut^" WYGRALA ( %d ) glosami", choises[2]) server_cmd("mp_timelimit 15"); } else if(choises[3] > choises[1] && choises[3] > choises[2] && choises[3] > choises[4] && choises[3] > choises[5]) { client_print(0, print_chat, "[TimeVotes] Opcja ^"20 minut^" WYGRALA ( %d ) glosami", choises[3]) server_cmd("mp_timelimit 20"); } else if(choises[4] > choises[1] && choises[4] > choises[2] && choises[4] > choises[3] && choises[4] > choises[5]) { client_print(0, print_chat, "[TimeVotes] Opcja ^"25 minut^" WYGRALA ( %d ) glosami", choises[4]) server_cmd("mp_timelimit 25"); } else if(choises[5] > choises[1] && choises[5] > choises[2] && choises[5] > choises[3] && choises[5] > choises[4]) { client_print(0, print_chat, "[TimeVotes] Opcja ^"30 minut^" WYGRALA ( %d ) glosami", choises[5]) server_cmd("mp_timelimit 30"); } } public plugin_end() { set_cvar_float("mp_timelimit", g_timelimit) }