Witam.
Bardzo proszę o przerobienie pluginu wywołującego vote na czas mapy tak by były trzy opcje do wyboru: 15min, 20min, 30min.
/* Script generated by Pawn Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "TimeLimit vote"
#define AUTHOR "many"
#define VERSION "1.0.0"
new choises[6]
new Float:g_timelimit
public plugin_init()
{
register_plugin("PLUGIN", "VERSION", "AUTHOR")
set_task(60.0, "start_vote");
}
public start_vote(id)
{
new menu = menu_create("rJaki chcesz czas tej mapy?", "menu_handler")
menu_additem(menu, "w15 minut", "1", 0)
menu_additem(menu, "w20 minut", "2", 0)
menu_additem(menu, "w25 minut", "3", 0)
menu_additem(menu, "w35 minut", "4", 0)
menu_additem(menu, "w45 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, "[AMXX] %s zaglosowal na 15 minut", name);
}
case 2:
{
client_print (0, print_chat, "[AMXX] %s zaglosowal na 20 minut", name);
}
case 3:
{
client_print (0, print_chat, "[AMXX] %s zaglosowal na 25 minut", name);
}
case 4:
{
client_print (0, print_chat, "[AMXX] %s zaglosowal na 35 minut", name);
}
case 5:
{
client_print (0, print_chat, "[AMXX] %s zaglosowal na 45 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, "[AMXX] Czas mapy zostal ustawiony na ^"15 minut^", wybralo go %d osob", choises[1])
server_cmd("mp_timelimit 15");
}
else if(choises[2] > choises[1] && choises[2] > choises[3] && choises[2] > choises[4] && choises[2] > choises[5])
{
client_print(0, print_chat, "[AMXX] Czas mapy zostal ustawiony na ^"20 minut^", wybralo go %d osob", choises[2])
server_cmd("mp_timelimit 20");
}
else if(choises[3] > choises[1] && choises[3] > choises[2] && choises[3] > choises[4] && choises[3] > choises[5])
{
client_print(0, print_chat, "[AMXX] Czas mapy zostal ustawiony na ^"25 minut^", wybralo go %d osob", choises[3])
server_cmd("mp_timelimit 25");
}
else if(choises[4] > choises[1] && choises[4] > choises[2] && choises[4] > choises[3] && choises[4] > choises[5])
{
client_print(0, print_chat, "[AMXX] Czas mapy zostal ustawiony na ^"35 minut^", wybralo go %d osob", choises[4])
server_cmd("mp_timelimit 35");
}
else if(choises[5] > choises[1] && choises[5] > choises[2] && choises[5] > choises[3] && choises[5] > choises[4])
{
client_print(0, print_chat, "[AMXX] Czas mapy zostal ustawiony na ^"45 minut^", wybralo go %d osob", choises[5])
server_cmd("mp_timelimit 45");
}
}
public plugin_end()
{
set_cvar_float("mp_timelimit", g_timelimit)
}
Pisałem kiedyś tej sprawie. Otrzymałem odpowiedź i plugin chodził dobrze jednak po czasie wywalał mi błedy w logach:
L 01/09/2014 - 00:02:55: Start of error session. L 01/09/2014 - 00:02:55: Info (map "de_inferno") (file "addons/amxmodx/logs/error_20140109.log") L 01/09/2014 - 00:02:55: Played 3 is not in game L 01/09/2014 - 00:02:55: [AMXX] Run time error 10 (plugin "czasmapy_vote.amxx") (native "menu_cancel") - debug not enabled! L 01/09/2014 - 00:02:55: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes). L 01/09/2014 - 00:24:34: Start of error session. L 01/09/2014 - 00:24:34: Info (map "de_nuke") (file "addons/amxmodx/logs/error_20140109.log") L 01/09/2014 - 00:24:34: Played 3 is not in game L 01/09/2014 - 00:24:34: [AMXX] Run time error 10 (plugin "czasmapy_vote.amxx") (native "menu_cancel") - debug not enabled! L 01/09/2014 - 00:24:34: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes). L 01/09/2014 - 00:45:03: Start of error session. L 01/09/2014 - 00:45:03: Info (map "de_dust2") (file "addons/amxmodx/logs/error_20140109.log") L 01/09/2014 - 00:45:03: Played 3 is not in game L 01/09/2014 - 00:45:03: [AMXX] Run time error 10 (plugin "czasmapy_vote.amxx") (native "menu_cancel") - debug not enabled! L 01/09/2014 - 00:45:03: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
itd.


Dodatki SourceMod













