1.1 --- a/plugins/include/menus.inc Tue Jun 05 16:27:45 2007 +0000
1.2 +++ b/plugins/include/menus.inc Tue Jun 05 16:44:19 2007 +0000
1.3 @@ -39,6 +39,7 @@
1.4 MenuAction_Cancel = (1<<3), /**< The menu was cancelled (param1=client, param2=reason) */
1.5 MenuAction_End = (1<<4), /**< A menu's display/selection cycle is complete (nothing passed). */
1.6 MenuAction_VoteEnd = (1<<5), /**< (VOTE ONLY): A vote sequence has ended (param1=chosen item) */
1.7 + MenuAction_VoteStart = (1<<6), /**< (VOTE ONLY): A vote sequence has started */
1.8 };
1.9
1.10 /** Default menu actions */
1.11 @@ -273,45 +274,34 @@
1.12 */
1.13 native CancelMenu(Handle:menu);
1.14
1.15 -#if 0
1.16 /**
1.17 - * Broadcasts a menu to a list of clients.
1.18 + * Broadcasts a menu to a list of clients. The most selected item will be
1.19 + * returned through MenuAction_End. On a tie, a random item will be returned
1.20 + * from a list of the tied items.
1.21 *
1.22 - * @param menu Menu Handle.
1.23 - * @param handler MenuHandler callback to receive actions.
1.24 - * @param players Array of players to broadcast to.
1.25 - * @param numPlayers Number of players in the array.
1.26 - * @param time Maximum time to leave menu on the screen.
1.27 - * @return Number of clients that broadcast will wait upon.
1.28 - * @error Invalid Handle.
1.29 - */
1.30 -native BroadcastMenu(Handle:menu, MenuHandler:handler, players[], numPlayers, time);
1.31 -
1.32 -/**
1.33 - * Broadcasts a menu to a list of clients. The most selected
1.34 - * item will be returned through MenuAction_End. On a tie, a random
1.35 - * item will be returned.
1.36 + * Note that MenuAction_VoteEnd and MenuAction_VoteStart are both
1.37 + * default callbacks and do not need to be enabled.
1.38 *
1.39 * @param menu Menu Handle.
1.40 - * @param handler MenuHandler callback to receive actions.
1.41 - * @param players Array of players to broadcast to.
1.42 - * @param numPlayers Number of players in the array.
1.43 + * @param clients Array of clients to broadcast to.
1.44 + * @param numClients Number of clients in the array.
1.45 * @param time Maximum time to leave menu on the screen.
1.46 - * @return Number of clients that vote will wait upon.
1.47 + * @return True on success, false if this menu already has a vote session
1.48 + * in progress.
1.49 * @error Invalid Handle.
1.50 */
1.51 -native VoteMenu(Handle:menu, MenuHandler:handler, players[], numPlayers, time);
1.52 +native bool:VoteMenu(Handle:menu, clients[], numClients, time);
1.53
1.54 /**
1.55 - * Broadcasts a menu to all clients.
1.56 + * Sends a vote menu to all clients. See VoteMenu() for more information.
1.57 *
1.58 * @param menu Menu Handle.
1.59 - * @param handler MenuHandler callback to receive actions.
1.60 * @param time Maximum time to leave menu on the screen.
1.61 - * @return Number of clients that broadcast will wait upon.
1.62 + * @return True on success, false if this menu already has a vote session
1.63 + * in progress.
1.64 * @error Invalid Handle.
1.65 */
1.66 -stock BroadcastMenuToAll(Handle:menu, MenuHandler:handler, time)
1.67 +stock VoteMenuToAll(Handle:menu, time)
1.68 {
1.69 new num = GetMaxClients();
1.70 new total;
1.71 @@ -326,40 +316,10 @@
1.72 players[total++] = i;
1.73 }
1.74
1.75 - return BroadcastMenu(menu, handler, players, total, time);
1.76 + return VoteMenu(menu, players, total, time);
1.77 }
1.78
1.79 /**
1.80 - * Broadcasts a menu to all clients. The most selected item will
1.81 - * be returned through MenuAction_End. On a tie, a random item
1.82 - * will be returned.
1.83 - *
1.84 - * @param menu Menu Handle.
1.85 - * @param handler MenuHandler callback to receive actions.
1.86 - * @param time Maximum time to leave menu on the screen.
1.87 - * @return Number of clients that the vote will wait upon.
1.88 - * @error Invalid Handle.
1.89 - */
1.90 -stock VoteMenuToAll(Handle:menu, MenuHandler:handler, time)
1.91 -{
1.92 - new num = GetMaxClients();
1.93 - new total;
1.94 - decl players[num];
1.95 -
1.96 - for (new i=1; i<=num; i++)
1.97 - {
1.98 - if (!IsClientConnected(i))
1.99 - {
1.100 - continue;
1.101 - }
1.102 - players[total++] = i;
1.103 - }
1.104 -
1.105 - return VoteMenu(menu, handler, players, total, time);
1.106 -}
1.107 -#endif
1.108 -
1.109 -/**
1.110 * Returns a style's global Handle.
1.111 *
1.112 * @param style Menu Style.