Raised This Month: $ Target: $400
 0% 

voting


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 07-04-2007 , 15:14   voting
Reply With Quote #1

how do i make a vote with 4 choices. thx
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
purple_pixie
Veteran Member
Join Date: Jun 2007
Location: Winchester, England
Old 07-05-2007 , 07:27   Re: voting
Reply With Quote #2

Send a menu out to all clients and stick their responses into an array ...
purple_pixie is offline
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 07-05-2007 , 16:04   Re: voting
Reply With Quote #3

yea i need an example
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-05-2007 , 17:33   Re: voting
Reply With Quote #4

hope this helps?
Attached Files
File Type: sma Get Plugin or Get Source (VoteMod.sma - 640 views - 5.6 KB)
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
flyeni6
Senior Member
Join Date: Jun 2006
Location: CAli
Old 07-06-2007 , 00:34   Re: voting
Reply With Quote #5

thx rolnaaba but i need it like this.

you know how my halo mod has game modes, i need this to be like this.
A player says "/votegamemode" then if a good amount of players say the same thing, a menu will comeup so that Players can vote to play the game modes, "Slayer,Juggernaut,Teamslayer,Territoreis ".

Quote:
Pick The Game You want to play!
1. slayer
2. teamslayer
3. juggernaut
4. territories
all i need is a way to tally the votes and ill do the rest
__________________

flyeni6 is offline
Send a message via AIM to flyeni6
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-06-2007 , 12:46   Re: voting
Reply With Quote #6

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
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-06-2007 , 12:48   Re: voting
Reply With Quote #7

even though it was baddly coded because it tried to encorporate both the old and new menu styles. you can use this on new menu style.
__________________
DO NOT PM me about avp mod.
Rolnaaba is offline
Lee
AlliedModders Donor
Join Date: Feb 2006
Old 07-06-2007 , 20:28   Re: voting
Reply With Quote #8

Just out of interest, why use #else if there's no code to compile?
Lee is offline
Rolnaaba
Veteran Member
Join Date: May 2006
Old 07-07-2007 , 11:03   Re: voting
Reply With Quote #9

I have no freakin idea lol, i just realized that I did that! Must have typed it like that the first time then I copy/pasted it to the rest of plugin
__________________
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 20:45.


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