thats why i posted VoteMod. It creates a menu sends it to all players. then tallys the votes.
Code:
public Vote_Disrespect() {
#if defined DEBUG
log_amx("[AVM] Vote Disrespect Selected Processing Menu Creation...");
#else
#endif
new menuBody[576];
new player_name[32];
get_user_name(player, player_name, 31);
new len = format(menuBody,575,"\rIs %s being Disrespectful (Flaming)?^n^n",player_name);
len += format(menuBody[len],575-len, "\w1. Yes^n");
len += format(menuBody[len],575-len, "\w2. No");
vote = "Slaying"
format(vote_cmd, 256, "amx_slay %s", player_name);
menuesid = show_menu(0,(1<<0)|(1<<1),menuBody,-1,"Disrespect");
set_task(get_pcvar_float(menu_last), "tally");
}
thats shows the menu to all players.
then on handle:
Code:
public Pressedvote(id,key) {
#if defined DEBUG
log_amx("[AVM] Proccessing Key Pressed on Vote Menu...Key= %i", key);
#else
#endif
switch (key) {
case 0: yes++;
case 1: no++;
}
return PLUGIN_HANDLED;
}
and at show menu it sets a task to tally:
Code:
public tally() {
#if defined DEBUG
log_amx("[AVM] Displaying Results...Yes: %i, No: %i", yes, no);
#else
#endif
menu_destroy(menuesid);
client_print(0,print_chat,"[AVM] Voting Results: Yes: %i, No %i", yes, no);
new player_name[32];
get_user_name(player, player_name, 31);
if(yes>no) {
#if defined DEBUG
log_amx("[AVM] Taking Action...");
#else
#endif
client_print(0,print_chat,"[AVM] %s %s",vote, player_name);
server_cmd(vote_cmd)
}
else {
#if defined DEBUG
log_amx("[AVM] Not Taking Action...");
#else
#endif
client_print(0,print_chat,"[AVM] NOT %s %s",vote, player_name);
}
return PLUGIN_HANDLED;
}
and make yes/no gloabal, so for you, have a diff var for each mode, and increment that var upon that selection. Easy.
__________________