AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   voting (https://forums.alliedmods.net/showthread.php?t=57432)

flyeni6 07-04-2007 15:14

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

purple_pixie 07-05-2007 07:27

Re: voting
 
Send a menu out to all clients and stick their responses into an array ...

flyeni6 07-05-2007 16:04

Re: voting
 
yea i need an example

Rolnaaba 07-05-2007 17:33

Re: voting
 
1 Attachment(s)
hope this helps?

flyeni6 07-06-2007 00:34

Re: voting
 
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

Rolnaaba 07-06-2007 12:46

Re: voting
 
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.

Rolnaaba 07-06-2007 12:48

Re: voting
 
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.

Lee 07-06-2007 20:28

Re: voting
 
Just out of interest, why use #else if there's no code to compile?

Rolnaaba 07-07-2007 11:03

Re: voting
 
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 :P


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

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