mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-25 06:15:37 +03:00
Added amb51 - 4 options in amx_vote
Also fixed a potential formatting issue with the vote display.
This commit is contained in:
parent
61052c41a1
commit
63427b2ad0
@ -35,6 +35,7 @@
|
|||||||
#include <amxmodx>
|
#include <amxmodx>
|
||||||
#include <amxmisc>
|
#include <amxmisc>
|
||||||
|
|
||||||
|
|
||||||
new g_Answer[128]
|
new g_Answer[128]
|
||||||
new g_optionName[4][64]
|
new g_optionName[4][64]
|
||||||
new g_voteCount[4]
|
new g_voteCount[4]
|
||||||
@ -58,7 +59,7 @@ public plugin_init()
|
|||||||
register_menucmd(register_menuid("Choose map: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")
|
register_menucmd(register_menuid("Choose map: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")
|
||||||
register_menucmd(register_menuid("Kick "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
register_menucmd(register_menuid("Kick "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||||
register_menucmd(register_menuid("Ban "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
register_menucmd(register_menuid("Ban "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
||||||
register_menucmd(register_menuid("Vote: "), MENU_KEY_1|MENU_KEY_2, "voteCount")
|
register_menucmd(register_menuid("Vote: "), MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4, "voteCount")
|
||||||
register_menucmd(register_menuid("The result: "), MENU_KEY_1|MENU_KEY_2, "actionResult")
|
register_menucmd(register_menuid("The result: "), MENU_KEY_1|MENU_KEY_2, "actionResult")
|
||||||
register_concmd("amx_votemap", "cmdVoteMap", ADMIN_VOTE, "<map> [map] [map] [map]")
|
register_concmd("amx_votemap", "cmdVoteMap", ADMIN_VOTE, "<map> [map] [map] [map]")
|
||||||
register_concmd("amx_votekick", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
|
register_concmd("amx_votekick", "cmdVoteKickBan", ADMIN_VOTE, "<name or #userid>")
|
||||||
@ -372,8 +373,12 @@ public cmdVote(id, level, cid)
|
|||||||
return PLUGIN_HANDLED
|
return PLUGIN_HANDLED
|
||||||
}
|
}
|
||||||
|
|
||||||
read_argv(2, g_optionName[0], 31)
|
new count=read_argc();
|
||||||
read_argv(3, g_optionName[1], 31)
|
server_print("count==%d",count);
|
||||||
|
for (new i=0;i<4 && (i+2)<count;i++)
|
||||||
|
{
|
||||||
|
read_argv(i+2, g_optionName[i], sizeof(g_optionName[])-1);
|
||||||
|
}
|
||||||
|
|
||||||
new authid[32], name[32]
|
new authid[32], name[32]
|
||||||
|
|
||||||
@ -400,18 +405,35 @@ public cmdVote(id, level, cid)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new menu_msg[256], lVote[16]
|
new menu_msg[512], lVote[16]
|
||||||
|
|
||||||
format(lVote, 15, "%L", LANG_SERVER, "VOTE")
|
format(lVote, 15, "%L", LANG_SERVER, "VOTE")
|
||||||
new keys = MENU_KEY_1|MENU_KEY_2
|
|
||||||
|
|
||||||
format(menu_msg, 255, g_coloredMenus ? "\y%s: %s\w^n^n1. %s^n2. %s" : "%s: %s^n^n1. %s^n2. %s", lVote, quest, g_optionName[0], g_optionName[1])
|
count-=2;
|
||||||
|
if (count>4)
|
||||||
|
{
|
||||||
|
count=4;
|
||||||
|
}
|
||||||
|
// count now shows how many options were listed
|
||||||
|
new keys=0;
|
||||||
|
for (new i=0;i<count;i++)
|
||||||
|
{
|
||||||
|
keys |= (1<<i);
|
||||||
|
}
|
||||||
|
|
||||||
|
new len=formatex(menu_msg, sizeof(menu_msg)-1, g_coloredMenus ? "\y%s: %s\w^n^n" : "%s: %s^n^n", lVote, quest);
|
||||||
|
|
||||||
|
for (new i=0;i<count;i++)
|
||||||
|
{
|
||||||
|
len+=formatex(menu_msg[len], sizeof(menu_msg) - 1 - len ,"%d. %s^n",i+1,g_optionName[i]);
|
||||||
|
}
|
||||||
g_execResult = false
|
g_execResult = false
|
||||||
|
|
||||||
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0
|
||||||
|
|
||||||
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
|
||||||
g_voteRatio = get_cvar_float("amx_vote_ratio")
|
g_voteRatio = get_cvar_float("amx_vote_ratio")
|
||||||
|
replace_all(quest,sizeof(quest)-1,"%","");
|
||||||
format(g_Answer, 127, "%s - %%s", quest)
|
format(g_Answer, 127, "%s - %%s", quest)
|
||||||
show_menu(0, keys, menu_msg, floatround(vote_time), "Vote: ")
|
show_menu(0, keys, menu_msg, floatround(vote_time), "Vote: ")
|
||||||
set_task(vote_time, "checkVotes", 99889988)
|
set_task(vote_time, "checkVotes", 99889988)
|
||||||
|
Loading…
Reference in New Issue
Block a user