Raised This Month: $ Target: $400
 0% 

voting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-06-2007 , 12:46   Re: voting
Reply With Quote #1

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.
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:32.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode