1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/configs/menu_configs.cfg Sat Oct 13 04:43:42 2007 +0000
1.3 @@ -0,0 +1,9 @@
1.4 +/**
1.5 + * List config files here (relative to moddir) to have them added to the exec config menu list
1.6 + * Left side is the filename, right side is the text to be added to the menu
1.7 + */
1.8 +Configs
1.9 +{
1.10 + "cfg/server.cfg" "Standard Server Setup"
1.11 + "cfg/sourcemod/sourcemod.cfg" "SourceMod Settings"
1.12 +}
1.13 \ No newline at end of file
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/configs/menu_maplist.ini Sat Oct 13 04:43:42 2007 +0000
2.3 @@ -0,0 +1,7 @@
2.4 +// menu_maplist.ini
2.5 +//
2.6 +// List maps here to be added to the map and votemap sections of the admin menu
2.7 +//
2.8 +de_dust
2.9 +de_dust2
2.10 +de_aztec
2.11 \ No newline at end of file
3.1 --- a/plugins/basebans.sp Mon Oct 08 22:13:49 2007 +0000
3.2 +++ b/plugins/basebans.sp Sat Oct 13 04:43:42 2007 +0000
3.3 @@ -34,6 +34,8 @@
3.4 #pragma semicolon 1
3.5
3.6 #include <sourcemod>
3.7 +#undef REQUIRE_PLUGIN
3.8 +#include <adminmenu>
3.9
3.10 public Plugin:myinfo =
3.11 {
3.12 @@ -44,6 +46,13 @@
3.13 url = "http://www.sourcemod.net/"
3.14 };
3.15
3.16 +new Handle:hTopMenu = INVALID_HANDLE;
3.17 +
3.18 +new g_BanTarget[MAXPLAYERS+1];
3.19 +new g_BanTime[MAXPLAYERS+1];
3.20 +
3.21 +#include "basebans/ban.sp"
3.22 +
3.23 public OnPluginStart()
3.24 {
3.25 LoadTranslations("common.phrases");
3.26 @@ -52,6 +61,40 @@
3.27 RegAdminCmd("sm_unban", Command_Unban, ADMFLAG_UNBAN, "sm_unban <steamid>");
3.28 RegAdminCmd("sm_addban", Command_AddBan, ADMFLAG_RCON, "sm_addban <time> <steamid> [reason]");
3.29 RegAdminCmd("sm_banip", Command_BanIp, ADMFLAG_BAN, "sm_banip <time> <ip|#userid|name> [reason]");
3.30 +
3.31 + /* Account for late loading */
3.32 + new Handle:topmenu;
3.33 + if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
3.34 + {
3.35 + OnAdminMenuReady(topmenu);
3.36 + }
3.37 +}
3.38 +
3.39 +public OnAdminMenuReady(Handle:topmenu)
3.40 +{
3.41 + /* Block us from being called twice */
3.42 + if (topmenu == hTopMenu)
3.43 + {
3.44 + return;
3.45 + }
3.46 +
3.47 + /* Save the Handle */
3.48 + hTopMenu = topmenu;
3.49 +
3.50 + /* Find the "Player Commands" category */
3.51 + new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
3.52 +
3.53 + if (player_commands != INVALID_TOPMENUOBJECT)
3.54 + {
3.55 + AddToTopMenu(hTopMenu,
3.56 + "Ban Player",
3.57 + TopMenuObject_Item,
3.58 + AdminMenu_Ban,
3.59 + player_commands,
3.60 + "sm_ban",
3.61 + ADMFLAG_BAN);
3.62 +
3.63 + }
3.64 }
3.65
3.66 public Action:Command_BanIp(client, args)
3.67 @@ -219,66 +262,3 @@
3.68 return Plugin_Handled;
3.69 }
3.70
3.71 -public Action:Command_Ban(client, args)
3.72 -{
3.73 - if (args < 2)
3.74 - {
3.75 - ReplyToCommand(client, "[SM] Usage: sm_ban <#userid|name> <minutes|0> [reason]");
3.76 - return Plugin_Handled;
3.77 - }
3.78 -
3.79 - decl String:arg[65];
3.80 - GetCmdArg(1, arg, sizeof(arg));
3.81 -
3.82 - new target = FindTarget(client, arg, true);
3.83 - if (target == -1)
3.84 - {
3.85 - return Plugin_Handled;
3.86 - }
3.87 -
3.88 - decl String:s_time[12];
3.89 - GetCmdArg(2, s_time, sizeof(s_time));
3.90 -
3.91 - new time = StringToInt(s_time);
3.92 -
3.93 - decl String:reason[128];
3.94 - if (args >= 3)
3.95 - {
3.96 - GetCmdArg(3, reason, sizeof(reason));
3.97 - } else {
3.98 - reason[0] = '\0';
3.99 - }
3.100 -
3.101 - decl String:authid[64];
3.102 - GetClientAuthString(target, authid, sizeof(authid));
3.103 - GetClientName(target, arg, sizeof(arg));
3.104 -
3.105 - if (!time)
3.106 - {
3.107 - if (reason[0] == '\0')
3.108 - {
3.109 - ShowActivity(client, "%t", "Permabanned player", arg);
3.110 - } else {
3.111 - ShowActivity(client, "%t", "Permabanned player reason", arg, reason);
3.112 - }
3.113 - } else {
3.114 - if (reason[0] == '\0')
3.115 - {
3.116 - ShowActivity(client, "%t", "Banned player", arg, time);
3.117 - } else {
3.118 - ShowActivity(client, "%t", "Banned player reason", arg, time, reason);
3.119 - }
3.120 - }
3.121 -
3.122 - LogAction(client, target, "\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", client, target, time, reason);
3.123 -
3.124 - if (reason[0] == '\0')
3.125 - {
3.126 - strcopy(reason, sizeof(reason), "Banned");
3.127 - }
3.128 -
3.129 - BanClient(target, time, BANFLAG_AUTO, reason, reason, "sm_ban", client);
3.130 -
3.131 - return Plugin_Handled;
3.132 -}
3.133 -
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/plugins/basebans/ban.sp Sat Oct 13 04:43:42 2007 +0000
4.3 @@ -0,0 +1,229 @@
4.4 +PrepareBan(client, target, time, String:reason[], size)
4.5 +{
4.6 + decl String:authid[64], String:name[32];
4.7 + GetClientAuthString(target, authid, sizeof(authid));
4.8 + GetClientName(target, name, sizeof(name));
4.9 +
4.10 + if (!time)
4.11 + {
4.12 + if (reason[0] == '\0')
4.13 + {
4.14 + ShowActivity(client, "%t", "Permabanned player", name);
4.15 + } else {
4.16 + ShowActivity(client, "%t", "Permabanned player reason", name, reason);
4.17 + }
4.18 + } else {
4.19 + if (reason[0] == '\0')
4.20 + {
4.21 + ShowActivity(client, "%t", "Banned player", name, time);
4.22 + } else {
4.23 + ShowActivity(client, "%t", "Banned player reason", name, time, reason);
4.24 + }
4.25 + }
4.26 +
4.27 + LogAction(client, target, "\"%L\" banned \"%L\" (minutes \"%d\") (reason \"%s\")", client, target, time, reason);
4.28 +
4.29 + if (reason[0] == '\0')
4.30 + {
4.31 + strcopy(reason, size, "Banned");
4.32 + }
4.33 +
4.34 + BanClient(target, time, BANFLAG_AUTO, reason, reason, "sm_ban", client);
4.35 +}
4.36 +
4.37 +DisplayBanTargetMenu(client)
4.38 +{
4.39 + new Handle:menu = CreateMenu(MenuHandler_BanPlayerList);
4.40 +
4.41 + decl String:title[100];
4.42 + Format(title, sizeof(title), "%T:", "Ban Player", client);
4.43 + SetMenuTitle(menu, title);
4.44 + SetMenuExitBackButton(menu, true);
4.45 +
4.46 + AddTargetsToMenu(menu, client, false);
4.47 +
4.48 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
4.49 +}
4.50 +
4.51 +DisplayBanTimeMenu(client)
4.52 +{
4.53 + new Handle:menu = CreateMenu(MenuHandler_BanTimeList);
4.54 +
4.55 + decl String:title[100];
4.56 + Format(title, sizeof(title), "%T:", "Ban Player", client);
4.57 + SetMenuTitle(menu, title);
4.58 + SetMenuExitBackButton(menu, true);
4.59 +
4.60 + AddMenuItem(menu, "0", "Permanent");
4.61 + AddMenuItem(menu, "10", "10 Minutes");
4.62 + AddMenuItem(menu, "30", "30 Minutes");
4.63 + AddMenuItem(menu, "60", "1 Hour");
4.64 + AddMenuItem(menu, "240", "4 Hours");
4.65 + AddMenuItem(menu, "1440", "1 Day");
4.66 + AddMenuItem(menu, "10080", "1 Week");
4.67 +
4.68 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
4.69 +}
4.70 +
4.71 +DisplayBanReasonMenu(client)
4.72 +{
4.73 + new Handle:menu = CreateMenu(MenuHandler_BanReasonList);
4.74 +
4.75 + decl String:title[100];
4.76 + Format(title, sizeof(title), "%T:", "Ban Reason", client);
4.77 + SetMenuTitle(menu, title);
4.78 + SetMenuExitBackButton(menu, true);
4.79 +
4.80 + AddMenuItem(menu, "Abusive", "Abusive");
4.81 + AddMenuItem(menu, "Racism", "Racism");
4.82 + AddMenuItem(menu, "General cheating/exploits", "General cheating/exploits");
4.83 + AddMenuItem(menu, "Wallhack", "Wallhack");
4.84 + AddMenuItem(menu, "Aimbot", "Aimbot");
4.85 + AddMenuItem(menu, "Speedhacking", "Speedhacking");
4.86 + AddMenuItem(menu, "Mic spamming", "Mic spamming");
4.87 + AddMenuItem(menu, "Admin disrepect", "Admin disrepect");
4.88 + AddMenuItem(menu, "Camping", "Camping");
4.89 + AddMenuItem(menu, "Team killing", "Team killing");
4.90 + AddMenuItem(menu, "Unacceptable Spray", "Unacceptable Spray");
4.91 + AddMenuItem(menu, "Breaking Server Rules", "Breaking Server Rules");
4.92 + AddMenuItem(menu, "Other", "Other");
4.93 +
4.94 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
4.95 +}
4.96 +
4.97 +public AdminMenu_Ban(Handle:topmenu,
4.98 + TopMenuAction:action,
4.99 + TopMenuObject:object_id,
4.100 + param,
4.101 + String:buffer[],
4.102 + maxlength)
4.103 +{
4.104 + if (action == TopMenuAction_DisplayOption)
4.105 + {
4.106 + Format(buffer, maxlength, "%T", "Ban Player", param);
4.107 + }
4.108 + else if (action == TopMenuAction_SelectOption)
4.109 + {
4.110 + DisplayBanTargetMenu(param);
4.111 + }
4.112 +}
4.113 +
4.114 +public MenuHandler_BanReasonList(Handle:menu, MenuAction:action, param1, param2)
4.115 +{
4.116 + if (action == MenuAction_End)
4.117 + {
4.118 + CloseHandle(menu);
4.119 + }
4.120 + else if (action == MenuAction_Cancel)
4.121 + {
4.122 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
4.123 + {
4.124 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
4.125 + }
4.126 + }
4.127 + else if (action == MenuAction_Select)
4.128 + {
4.129 + decl String:info[64];
4.130 +
4.131 + GetMenuItem(menu, param2, info, sizeof(info));
4.132 +
4.133 + PrepareBan(param1, g_BanTarget[param1], g_BanTime[param1], info, sizeof(info));
4.134 + }
4.135 +}
4.136 +
4.137 +public MenuHandler_BanPlayerList(Handle:menu, MenuAction:action, param1, param2)
4.138 +{
4.139 + if (action == MenuAction_End)
4.140 + {
4.141 + CloseHandle(menu);
4.142 + }
4.143 + else if (action == MenuAction_Cancel)
4.144 + {
4.145 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
4.146 + {
4.147 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
4.148 + }
4.149 + }
4.150 + else if (action == MenuAction_Select)
4.151 + {
4.152 + decl String:info[32], String:name[32];
4.153 + new userid, target;
4.154 +
4.155 + GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
4.156 + userid = StringToInt(info);
4.157 +
4.158 + if ((target = GetClientOfUserId(userid)) == 0)
4.159 + {
4.160 + PrintToChat(param1, "[SM] %t", "Player no longer available");
4.161 + }
4.162 + else if (!CanUserTarget(param1, target))
4.163 + {
4.164 + PrintToChat(param1, "[SM] %t", "Unable to target");
4.165 + }
4.166 + else
4.167 + {
4.168 + g_BanTarget[param1] = target;
4.169 + DisplayBanTimeMenu(param1);
4.170 + }
4.171 + }
4.172 +}
4.173 +
4.174 +public MenuHandler_BanTimeList(Handle:menu, MenuAction:action, param1, param2)
4.175 +{
4.176 + if (action == MenuAction_End)
4.177 + {
4.178 + CloseHandle(menu);
4.179 + }
4.180 + else if (action == MenuAction_Cancel)
4.181 + {
4.182 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
4.183 + {
4.184 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
4.185 + }
4.186 + }
4.187 + else if (action == MenuAction_Select)
4.188 + {
4.189 + decl String:info[32];
4.190 +
4.191 + GetMenuItem(menu, param2, info, sizeof(info));
4.192 + g_BanTime[param1] = StringToInt(info);
4.193 +
4.194 + DisplayBanReasonMenu(param1);
4.195 + }
4.196 +}
4.197 +
4.198 +
4.199 +public Action:Command_Ban(client, args)
4.200 +{
4.201 + if (args < 2)
4.202 + {
4.203 + ReplyToCommand(client, "[SM] Usage: sm_ban <#userid|name> <minutes|0> [reason]");
4.204 + return Plugin_Handled;
4.205 + }
4.206 +
4.207 + decl String:arg[65];
4.208 + GetCmdArg(1, arg, sizeof(arg));
4.209 +
4.210 + new target = FindTarget(client, arg, true);
4.211 + if (target == -1)
4.212 + {
4.213 + return Plugin_Handled;
4.214 + }
4.215 +
4.216 + decl String:s_time[12];
4.217 + GetCmdArg(2, s_time, sizeof(s_time));
4.218 +
4.219 + new time = StringToInt(s_time);
4.220 +
4.221 + decl String:reason[128];
4.222 + if (args >= 3)
4.223 + {
4.224 + GetCmdArg(3, reason, sizeof(reason));
4.225 + } else {
4.226 + reason[0] = '\0';
4.227 + }
4.228 +
4.229 + PrepareBan(client, target, time, reason, sizeof(reason));
4.230 +
4.231 + return Plugin_Handled;
4.232 +}
4.233 \ No newline at end of file
5.1 --- a/plugins/basecomm.sp Mon Oct 08 22:13:49 2007 +0000
5.2 +++ b/plugins/basecomm.sp Sat Oct 13 04:43:42 2007 +0000
5.3 @@ -33,6 +33,8 @@
5.4
5.5 #include <sourcemod>
5.6 #include <sdktools>
5.7 +#undef REQUIRE_PLUGIN
5.8 +#include <adminmenu>
5.9
5.10 #pragma semicolon 1
5.11
5.12 @@ -52,6 +54,12 @@
5.13 new Handle:g_Cvar_Alltalk = INVALID_HANDLE; // Holds the handle for sv_alltalk
5.14 new bool:g_Hooked = false; // Tracks if we've hooked events for deadtalk
5.15
5.16 +new Handle:hTopMenu = INVALID_HANDLE;
5.17 +
5.18 +new g_GagTarget[MAXPLAYERS+1];
5.19 +
5.20 +#include "basecomm/gag.sp"
5.21 +
5.22 public OnPluginStart()
5.23 {
5.24 LoadTranslations("common.phrases");
5.25 @@ -72,6 +80,39 @@
5.26 RegAdminCmd("sm_unsilence", Command_Unsilence, ADMFLAG_CHAT, "sm_unsilence <player> - Restores a player's ability to use voice and chat.");
5.27
5.28 HookConVarChange(g_Cvar_Deadtalk, ConVarChange_Deadtalk);
5.29 +
5.30 + /* Account for late loading */
5.31 + new Handle:topmenu;
5.32 + if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
5.33 + {
5.34 + OnAdminMenuReady(topmenu);
5.35 + }
5.36 +}
5.37 +
5.38 +public OnAdminMenuReady(Handle:topmenu)
5.39 +{
5.40 + /* Block us from being called twice */
5.41 + if (topmenu == hTopMenu)
5.42 + {
5.43 + return;
5.44 + }
5.45 +
5.46 + /* Save the Handle */
5.47 + hTopMenu = topmenu;
5.48 +
5.49 + /* Build the "Player Commands" category */
5.50 + new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
5.51 +
5.52 + if (player_commands != INVALID_TOPMENUOBJECT)
5.53 + {
5.54 + AddToTopMenu(hTopMenu,
5.55 + "Gag/Mute",
5.56 + TopMenuObject_Item,
5.57 + AdminMenu_Gag,
5.58 + player_commands,
5.59 + "sm_gag",
5.60 + ADMFLAG_CHAT);
5.61 + }
5.62 }
5.63
5.64 public ConVarChange_Deadtalk(Handle:convar, const String:oldValue[], const String:newValue[])
5.65 @@ -112,267 +153,6 @@
5.66 return Plugin_Continue;
5.67 }
5.68
5.69 -public Action:Command_Mute(client, args)
5.70 -{
5.71 - if (args < 1)
5.72 - {
5.73 - ReplyToCommand(client, "[SM] Usage: sm_mute <player>");
5.74 - return Plugin_Handled;
5.75 - }
5.76 -
5.77 - decl String:arg[64];
5.78 - GetCmdArg(1, arg, sizeof(arg));
5.79 -
5.80 - new target = FindTarget(client, arg);
5.81 - if (target == -1)
5.82 - {
5.83 - return Plugin_Handled;
5.84 - }
5.85 -
5.86 - if (g_Muted[target])
5.87 - {
5.88 - ReplyToCommand(client, "%t", "Already Muted");
5.89 - return Plugin_Handled;
5.90 - }
5.91 -
5.92 - g_Muted[target] = true;
5.93 - SetClientListeningFlags(target, VOICE_MUTED);
5.94 -
5.95 - decl String:name[64];
5.96 - GetClientName(target, name, sizeof(name));
5.97 -
5.98 - ShowActivity(client, "%t", "Player Muted", name);
5.99 - ReplyToCommand(client, "%t", "Player Muted", name);
5.100 - LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
5.101 -
5.102 - return Plugin_Handled;
5.103 -}
5.104 -
5.105 -public Action:Command_Gag(client, args)
5.106 -{
5.107 - if (args < 1)
5.108 - {
5.109 - ReplyToCommand(client, "[SM] Usage: sm_gag <player>");
5.110 - return Plugin_Handled;
5.111 - }
5.112 -
5.113 - decl String:arg[64];
5.114 - GetCmdArg(1, arg, sizeof(arg));
5.115 -
5.116 - new target = FindTarget(client, arg);
5.117 - if (target == -1)
5.118 - {
5.119 - return Plugin_Handled;
5.120 - }
5.121 -
5.122 - if (g_Gagged[target])
5.123 - {
5.124 - ReplyToCommand(client, "%t", "Already Gagged");
5.125 - return Plugin_Handled;
5.126 - }
5.127 -
5.128 - g_Gagged[target] = true;
5.129 -
5.130 - decl String:name[64];
5.131 - GetClientName(target, name, sizeof(name));
5.132 -
5.133 - ShowActivity(client, "%t", "Player Gagged", name);
5.134 - ReplyToCommand(client, "%t", "Player Gagged", name);
5.135 - LogAction(client, target, "\"%L\" gagged \"%L\"", client, target);
5.136 -
5.137 - return Plugin_Handled;
5.138 -}
5.139 -
5.140 -public Action:Command_Silence(client, args)
5.141 -{
5.142 - if (args < 1)
5.143 - {
5.144 - ReplyToCommand(client, "[SM] Usage: sm_silence <player>");
5.145 - return Plugin_Handled;
5.146 - }
5.147 -
5.148 - decl String:arg[64];
5.149 - GetCmdArg(1, arg, sizeof(arg));
5.150 -
5.151 - new target = FindTarget(client, arg);
5.152 - if (target == -1)
5.153 - {
5.154 - return Plugin_Handled;
5.155 - }
5.156 -
5.157 - if (g_Gagged[target] && g_Muted[target])
5.158 - {
5.159 - ReplyToCommand(client, "%t", "Already Silenced");
5.160 - return Plugin_Handled;
5.161 - }
5.162 -
5.163 - decl String:name[64];
5.164 - GetClientName(target, name, sizeof(name));
5.165 -
5.166 - if (!g_Gagged[target])
5.167 - {
5.168 - g_Gagged[target] = true;
5.169 -
5.170 - ShowActivity(client, "%t", "Player Gagged", name);
5.171 - ReplyToCommand(client, "%t", "Player Gagged", name);
5.172 - LogAction(client, target, "\"%L\" gagged \"%L\"", client, target);
5.173 - }
5.174 -
5.175 - if (!g_Muted[target])
5.176 - {
5.177 - g_Muted[target] = true;
5.178 - SetClientListeningFlags(target, VOICE_MUTED);
5.179 -
5.180 - ShowActivity(client, "%t", "Player Muted", name);
5.181 - ReplyToCommand(client, "%t", "Player Muted", name);
5.182 - LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
5.183 - }
5.184 -
5.185 - return Plugin_Handled;
5.186 -}
5.187 -
5.188 -public Action:Command_Unmute(client, args)
5.189 -{
5.190 - if (args < 1)
5.191 - {
5.192 - ReplyToCommand(client, "[SM] Usage: sm_unmute <player>");
5.193 - return Plugin_Handled;
5.194 - }
5.195 -
5.196 - decl String:arg[64];
5.197 - GetCmdArg(1, arg, sizeof(arg));
5.198 -
5.199 - new target = FindTarget(client, arg);
5.200 - if (target == -1)
5.201 - {
5.202 - return Plugin_Handled;
5.203 - }
5.204 -
5.205 - if (!g_Muted[target])
5.206 - {
5.207 - ReplyToCommand(client, "%t", "Player Not Muted");
5.208 - return Plugin_Handled;
5.209 - }
5.210 -
5.211 - g_Muted[target] = false;
5.212 - if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target))
5.213 - {
5.214 - SetClientListeningFlags(target, VOICE_LISTENALL);
5.215 - }
5.216 - else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target))
5.217 - {
5.218 - SetClientListeningFlags(target, VOICE_TEAM);
5.219 - }
5.220 - else
5.221 - {
5.222 - SetClientListeningFlags(target, VOICE_NORMAL);
5.223 - }
5.224 -
5.225 - decl String:name[64];
5.226 - GetClientName(target, name, sizeof(name));
5.227 -
5.228 - ShowActivity(client, "%t", "Player Unmuted", name);
5.229 - ReplyToCommand(client, "%t", "Player Unmuted", name);
5.230 - LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
5.231 -
5.232 - return Plugin_Handled;
5.233 -}
5.234 -
5.235 -public Action:Command_Ungag(client, args)
5.236 -{
5.237 - if (args < 1)
5.238 - {
5.239 - ReplyToCommand(client, "[SM] Usage: sm_ungag <player>");
5.240 - return Plugin_Handled;
5.241 - }
5.242 -
5.243 - decl String:arg[64];
5.244 - GetCmdArg(1, arg, sizeof(arg));
5.245 -
5.246 - new target = FindTarget(client, arg);
5.247 - if (target == -1)
5.248 - {
5.249 - return Plugin_Handled;
5.250 - }
5.251 -
5.252 - if (!g_Gagged[target])
5.253 - {
5.254 - ReplyToCommand(client, "%t", "Player Not Gagged");
5.255 - return Plugin_Handled;
5.256 - }
5.257 -
5.258 - g_Gagged[target] = false;
5.259 -
5.260 - decl String:name[64];
5.261 - GetClientName(target, name, sizeof(name));
5.262 -
5.263 - ShowActivity(client, "%t", "Player Ungagged", name);
5.264 - ReplyToCommand(client, "%t", "Player Ungagged", name);
5.265 - LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target);
5.266 -
5.267 - return Plugin_Handled;
5.268 -}
5.269 -
5.270 -public Action:Command_Unsilence(client, args)
5.271 -{
5.272 - if (args < 1)
5.273 - {
5.274 - ReplyToCommand(client, "[SM] Usage: sm_unsilence <player>");
5.275 - return Plugin_Handled;
5.276 - }
5.277 -
5.278 - decl String:arg[64];
5.279 - GetCmdArg(1, arg, sizeof(arg));
5.280 -
5.281 - new target = FindTarget(client, arg);
5.282 - if (target == -1)
5.283 - {
5.284 - return Plugin_Handled;
5.285 - }
5.286 -
5.287 - if (!g_Gagged[target] && !g_Muted[target])
5.288 - {
5.289 - ReplyToCommand(client, "%t", "Player Not Silenced");
5.290 - return Plugin_Handled;
5.291 - }
5.292 -
5.293 - decl String:name[64];
5.294 - GetClientName(target, name, sizeof(name));
5.295 -
5.296 - if (g_Gagged[target])
5.297 - {
5.298 - g_Gagged[target] = false;
5.299 -
5.300 - ShowActivity(client, "%t", "Player Ungagged", name);
5.301 - ReplyToCommand(client, "%t", "Player Ungagged", name);
5.302 - LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target);
5.303 - }
5.304 -
5.305 - if (g_Muted[target])
5.306 - {
5.307 - g_Muted[target] = false;
5.308 -
5.309 - if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target))
5.310 - {
5.311 - SetClientListeningFlags(target, VOICE_LISTENALL);
5.312 - }
5.313 - else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target))
5.314 - {
5.315 - SetClientListeningFlags(target, VOICE_TEAM);
5.316 - }
5.317 - else
5.318 - {
5.319 - SetClientListeningFlags(target, VOICE_NORMAL);
5.320 - }
5.321 -
5.322 - ShowActivity(client, "%t", "Player Unmuted", name);
5.323 - ReplyToCommand(client, "%t", "Player Unmuted", name);
5.324 - LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
5.325 - }
5.326 -
5.327 - return Plugin_Handled;
5.328 -}
5.329 -
5.330 public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
5.331 {
5.332 new client = GetClientOfUserId(GetEventInt(event, "userid"));
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/plugins/basecomm/gag.sp Sat Oct 13 04:43:42 2007 +0000
6.3 @@ -0,0 +1,443 @@
6.4 +enum CommType
6.5 +{
6.6 + CommType_Mute,
6.7 + CommType_UnMute,
6.8 + CommType_Gag,
6.9 + CommType_UnGag,
6.10 + CommType_Silence,
6.11 + CommType_UnSilence
6.12 +
6.13 +};
6.14 +
6.15 +DisplayGagTypesMenu(client)
6.16 +{
6.17 + new Handle:menu = CreateMenu(MenuHandler_GagTypes);
6.18 +
6.19 + decl String:title[100];
6.20 + Format(title, sizeof(title), "%T:", "Choose Type", client);
6.21 + SetMenuTitle(menu, title);
6.22 + SetMenuExitBackButton(menu, true);
6.23 +
6.24 + new target = g_GagTarget[client];
6.25 +
6.26 + if (!g_Muted[target])
6.27 + {
6.28 + AddMenuItem(menu, "0", "Mute Player");
6.29 + }
6.30 + else
6.31 + {
6.32 + AddMenuItem(menu, "1", "UnMute Player");
6.33 + }
6.34 +
6.35 + if (!g_Gagged[target])
6.36 + {
6.37 + AddMenuItem(menu, "2", "Gag Player");
6.38 + }
6.39 + else
6.40 + {
6.41 + AddMenuItem(menu, "3", "UnGag Player");
6.42 + }
6.43 +
6.44 + if (!g_Muted[target] || !g_Gagged[target])
6.45 + {
6.46 + AddMenuItem(menu, "4", "Silence Player");
6.47 + }
6.48 + else
6.49 + {
6.50 + AddMenuItem(menu, "5", "UnSilence Player");
6.51 + }
6.52 +
6.53 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
6.54 +}
6.55 +
6.56 +DisplayGagPlayerMenu(client)
6.57 +{
6.58 + new Handle:menu = CreateMenu(MenuHandler_GagPlayer);
6.59 +
6.60 + decl String:title[100];
6.61 + Format(title, sizeof(title), "%T:", "Gag/Mute Player", client);
6.62 + SetMenuTitle(menu, title);
6.63 + SetMenuExitBackButton(menu, true);
6.64 +
6.65 + AddTargetsToMenu(menu, client, false);
6.66 +
6.67 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
6.68 +}
6.69 +
6.70 +public AdminMenu_Gag(Handle:topmenu,
6.71 + TopMenuAction:action,
6.72 + TopMenuObject:object_id,
6.73 + param,
6.74 + String:buffer[],
6.75 + maxlength)
6.76 +{
6.77 + if (action == TopMenuAction_DisplayOption)
6.78 + {
6.79 + Format(buffer, maxlength, "%T", "Gag/Mute Player", param);
6.80 + }
6.81 + else if (action == TopMenuAction_SelectOption)
6.82 + {
6.83 + DisplayGagPlayerMenu(param);
6.84 + }
6.85 +}
6.86 +
6.87 +public MenuHandler_GagPlayer(Handle:menu, MenuAction:action, param1, param2)
6.88 +{
6.89 + if (action == MenuAction_End)
6.90 + {
6.91 + CloseHandle(menu);
6.92 + }
6.93 + else if (action == MenuAction_Cancel)
6.94 + {
6.95 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
6.96 + {
6.97 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
6.98 + }
6.99 + }
6.100 + else if (action == MenuAction_Select)
6.101 + {
6.102 + decl String:info[32];
6.103 + new userid, target;
6.104 +
6.105 + GetMenuItem(menu, param2, info, sizeof(info));
6.106 + userid = StringToInt(info);
6.107 +
6.108 + if ((target = GetClientOfUserId(userid)) == 0)
6.109 + {
6.110 + PrintToChat(param1, "[SM] %t", "Player no longer available");
6.111 + }
6.112 + else if (!CanUserTarget(param1, target))
6.113 + {
6.114 + PrintToChat(param1, "[SM] %t", "Unable to target");
6.115 + }
6.116 + else
6.117 + {
6.118 + g_GagTarget[param1] = GetClientOfUserId(userid);
6.119 + DisplayGagTypesMenu(param1);
6.120 + }
6.121 + }
6.122 +}
6.123 +
6.124 +public MenuHandler_GagTypes(Handle:menu, MenuAction:action, param1, param2)
6.125 +{
6.126 + if (action == MenuAction_End)
6.127 + {
6.128 + CloseHandle(menu);
6.129 + }
6.130 + else if (action == MenuAction_Cancel)
6.131 + {
6.132 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
6.133 + {
6.134 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
6.135 + }
6.136 + }
6.137 + else if (action == MenuAction_Select)
6.138 + {
6.139 + decl String:info[32];
6.140 + new CommType:type;
6.141 +
6.142 + GetMenuItem(menu, param2, info, sizeof(info));
6.143 + type = CommType:StringToInt(info);
6.144 +
6.145 + switch (type)
6.146 + {
6.147 + case CommType_Mute: PerformMute(param1, g_GagTarget[param1]);
6.148 + case CommType_UnMute: PerformUnMute(param1, g_GagTarget[param1]);
6.149 + case CommType_Gag: PerformGag(param1, g_GagTarget[param1]);
6.150 + case CommType_UnGag: PerformUnGag(param1, g_GagTarget[param1]);
6.151 + case CommType_Silence: PerformSilence(param1, g_GagTarget[param1]);
6.152 + case CommType_UnSilence: PerformUnSilence(param1, g_GagTarget[param1]);
6.153 + }
6.154 + }
6.155 +}
6.156 +
6.157 +PerformMute(client, target)
6.158 +{
6.159 + if (g_Muted[target])
6.160 + {
6.161 + ReplyToCommand(client, "%t", "Already Muted");
6.162 + return;
6.163 + }
6.164 +
6.165 + g_Muted[target] = true;
6.166 + SetClientListeningFlags(target, VOICE_MUTED);
6.167 +
6.168 + decl String:name[64];
6.169 + GetClientName(target, name, sizeof(name));
6.170 +
6.171 + ShowActivity(client, "%t", "Player Muted", name);
6.172 + ReplyToCommand(client, "%t", "Player Muted", name);
6.173 + LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
6.174 +}
6.175 +
6.176 +PerformUnMute(client, target)
6.177 +{
6.178 + if (!g_Muted[target])
6.179 + {
6.180 + ReplyToCommand(client, "%t", "Player Not Muted");
6.181 + return;
6.182 + }
6.183 +
6.184 + g_Muted[target] = false;
6.185 + if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target))
6.186 + {
6.187 + SetClientListeningFlags(target, VOICE_LISTENALL);
6.188 + }
6.189 + else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target))
6.190 + {
6.191 + SetClientListeningFlags(target, VOICE_TEAM);
6.192 + }
6.193 + else
6.194 + {
6.195 + SetClientListeningFlags(target, VOICE_NORMAL);
6.196 + }
6.197 +
6.198 + decl String:name[64];
6.199 + GetClientName(target, name, sizeof(name));
6.200 +
6.201 + ShowActivity(client, "%t", "Player Unmuted", name);
6.202 + ReplyToCommand(client, "%t", "Player Unmuted", name);
6.203 + LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
6.204 +}
6.205 +
6.206 +PerformGag(client, target)
6.207 +{
6.208 + if (g_Gagged[target])
6.209 + {
6.210 + ReplyToCommand(client, "%t", "Already Gagged");
6.211 + return;
6.212 + }
6.213 +
6.214 + g_Gagged[target] = true;
6.215 +
6.216 + decl String:name[64];
6.217 + GetClientName(target, name, sizeof(name));
6.218 +
6.219 + ShowActivity(client, "%t", "Player Gagged", name);
6.220 + ReplyToCommand(client, "%t", "Player Gagged", name);
6.221 + LogAction(client, target, "\"%L\" gagged \"%L\"", client, target);
6.222 +}
6.223 +
6.224 +PerformUnGag(client, target)
6.225 +{
6.226 + if (!g_Gagged[target])
6.227 + {
6.228 + ReplyToCommand(client, "%t", "Player Not Gagged");
6.229 + return;
6.230 + }
6.231 +
6.232 + g_Gagged[target] = false;
6.233 +
6.234 + decl String:name[64];
6.235 + GetClientName(target, name, sizeof(name));
6.236 +
6.237 + ShowActivity(client, "%t", "Player Ungagged", name);
6.238 + ReplyToCommand(client, "%t", "Player Ungagged", name);
6.239 + LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target);
6.240 +}
6.241 +
6.242 +PerformSilence(client, target)
6.243 +{
6.244 + if (g_Gagged[target] && g_Muted[target])
6.245 + {
6.246 + ReplyToCommand(client, "%t", "Already Silenced");
6.247 + return;
6.248 + }
6.249 +
6.250 + decl String:name[64];
6.251 + GetClientName(target, name, sizeof(name));
6.252 +
6.253 + if (!g_Gagged[target])
6.254 + {
6.255 + g_Gagged[target] = true;
6.256 +
6.257 + ShowActivity(client, "%t", "Player Gagged", name);
6.258 + ReplyToCommand(client, "%t", "Player Gagged", name);
6.259 + LogAction(client, target, "\"%L\" gagged \"%L\"", client, target);
6.260 + }
6.261 +
6.262 + if (!g_Muted[target])
6.263 + {
6.264 + g_Muted[target] = true;
6.265 + SetClientListeningFlags(target, VOICE_MUTED);
6.266 +
6.267 + ShowActivity(client, "%t", "Player Muted", name);
6.268 + ReplyToCommand(client, "%t", "Player Muted", name);
6.269 + LogAction(client, target, "\"%L\" muted \"%L\"", client, target);
6.270 + }
6.271 +}
6.272 +
6.273 +PerformUnSilence(client, target)
6.274 +{
6.275 + if (!g_Gagged[target] && !g_Muted[target])
6.276 + {
6.277 + ReplyToCommand(client, "%t", "Player Not Silenced");
6.278 + return;
6.279 + }
6.280 +
6.281 + decl String:name[64];
6.282 + GetClientName(target, name, sizeof(name));
6.283 +
6.284 + if (g_Gagged[target])
6.285 + {
6.286 + g_Gagged[target] = false;
6.287 +
6.288 + ShowActivity(client, "%t", "Player Ungagged", name);
6.289 + ReplyToCommand(client, "%t", "Player Ungagged", name);
6.290 + LogAction(client, target, "\"%L\" ungagged \"%L\"", client, target);
6.291 + }
6.292 +
6.293 + if (g_Muted[target])
6.294 + {
6.295 + g_Muted[target] = false;
6.296 +
6.297 + if (GetConVarInt(g_Cvar_Deadtalk) == 1 && !IsPlayerAlive(target))
6.298 + {
6.299 + SetClientListeningFlags(target, VOICE_LISTENALL);
6.300 + }
6.301 + else if (GetConVarInt(g_Cvar_Deadtalk) == 2 && !IsPlayerAlive(target))
6.302 + {
6.303 + SetClientListeningFlags(target, VOICE_TEAM);
6.304 + }
6.305 + else
6.306 + {
6.307 + SetClientListeningFlags(target, VOICE_NORMAL);
6.308 + }
6.309 +
6.310 + ShowActivity(client, "%t", "Player Unmuted", name);
6.311 + ReplyToCommand(client, "%t", "Player Unmuted", name);
6.312 + LogAction(client, target, "\"%L\" unmuted \"%L\"", client, target);
6.313 + }
6.314 +}
6.315 +
6.316 +public Action:Command_Mute(client, args)
6.317 +{
6.318 + if (args < 1)
6.319 + {
6.320 + ReplyToCommand(client, "[SM] Usage: sm_mute <player>");
6.321 + return Plugin_Handled;
6.322 + }
6.323 +
6.324 + decl String:arg[64];
6.325 + GetCmdArg(1, arg, sizeof(arg));
6.326 +
6.327 + new target = FindTarget(client, arg);
6.328 + if (target == -1)
6.329 + {
6.330 + return Plugin_Handled;
6.331 + }
6.332 +
6.333 + PerformMute(client, target);
6.334 +
6.335 + return Plugin_Handled;
6.336 +}
6.337 +
6.338 +public Action:Command_Gag(client, args)
6.339 +{
6.340 + if (args < 1)
6.341 + {
6.342 + ReplyToCommand(client, "[SM] Usage: sm_gag <player>");
6.343 + return Plugin_Handled;
6.344 + }
6.345 +
6.346 + decl String:arg[64];
6.347 + GetCmdArg(1, arg, sizeof(arg));
6.348 +
6.349 + new target = FindTarget(client, arg);
6.350 + if (target == -1)
6.351 + {
6.352 + return Plugin_Handled;
6.353 + }
6.354 +
6.355 + PerformGag(client, target);
6.356 +
6.357 + return Plugin_Handled;
6.358 +}
6.359 +
6.360 +public Action:Command_Silence(client, args)
6.361 +{
6.362 + if (args < 1)
6.363 + {
6.364 + ReplyToCommand(client, "[SM] Usage: sm_silence <player>");
6.365 + return Plugin_Handled;
6.366 + }
6.367 +
6.368 + decl String:arg[64];
6.369 + GetCmdArg(1, arg, sizeof(arg));
6.370 +
6.371 + new target = FindTarget(client, arg);
6.372 + if (target == -1)
6.373 + {
6.374 + return Plugin_Handled;
6.375 + }
6.376 +
6.377 + PerformSilence(client, target);
6.378 +
6.379 + return Plugin_Handled;
6.380 +}
6.381 +
6.382 +public Action:Command_Unmute(client, args)
6.383 +{
6.384 + if (args < 1)
6.385 + {
6.386 + ReplyToCommand(client, "[SM] Usage: sm_unmute <player>");
6.387 + return Plugin_Handled;
6.388 + }
6.389 +
6.390 + decl String:arg[64];
6.391 + GetCmdArg(1, arg, sizeof(arg));
6.392 +
6.393 + new target = FindTarget(client, arg);
6.394 + if (target == -1)
6.395 + {
6.396 + return Plugin_Handled;
6.397 + }
6.398 +
6.399 + PerformUnMute(client, target);
6.400 +
6.401 + return Plugin_Handled;
6.402 +}
6.403 +
6.404 +public Action:Command_Ungag(client, args)
6.405 +{
6.406 + if (args < 1)
6.407 + {
6.408 + ReplyToCommand(client, "[SM] Usage: sm_ungag <player>");
6.409 + return Plugin_Handled;
6.410 + }
6.411 +
6.412 + decl String:arg[64];
6.413 + GetCmdArg(1, arg, sizeof(arg));
6.414 +
6.415 + new target = FindTarget(client, arg);
6.416 + if (target == -1)
6.417 + {
6.418 + return Plugin_Handled;
6.419 + }
6.420 +
6.421 + PerformUnGag(client, target);
6.422 +
6.423 + return Plugin_Handled;
6.424 +}
6.425 +
6.426 +public Action:Command_Unsilence(client, args)
6.427 +{
6.428 + if (args < 1)
6.429 + {
6.430 + ReplyToCommand(client, "[SM] Usage: sm_unsilence <player>");
6.431 + return Plugin_Handled;
6.432 + }
6.433 +
6.434 + decl String:arg[64];
6.435 + GetCmdArg(1, arg, sizeof(arg));
6.436 +
6.437 + new target = FindTarget(client, arg);
6.438 + if (target == -1)
6.439 + {
6.440 + return Plugin_Handled;
6.441 + }
6.442 +
6.443 + PerformUnSilence(client, target);
6.444 +
6.445 + return Plugin_Handled;
6.446 +}
6.447 \ No newline at end of file
7.1 --- a/plugins/basecommands.sp Mon Oct 08 22:13:49 2007 +0000
7.2 +++ b/plugins/basecommands.sp Sat Oct 13 04:43:42 2007 +0000
7.3 @@ -48,9 +48,17 @@
7.4
7.5 new Handle:hTopMenu = INVALID_HANDLE;
7.6
7.7 +new Handle:g_MapList;
7.8 +new g_mapFileTime;
7.9 +
7.10 +new Handle:g_ConfigList;
7.11 +
7.12 #include "basecommands/kick.sp"
7.13 #include "basecommands/reloadadmins.sp"
7.14 #include "basecommands/cancelvote.sp"
7.15 +#include "basecommands/who.sp"
7.16 +#include "basecommands/map.sp"
7.17 +#include "basecommands/execcfg.sp"
7.18
7.19 public OnPluginStart()
7.20 {
7.21 @@ -72,6 +80,26 @@
7.22 {
7.23 OnAdminMenuReady(topmenu);
7.24 }
7.25 +
7.26 + g_MapList = CreateMenu(MenuHandler_ChangeMap);
7.27 + SetMenuTitle(g_MapList, "Please select a map");
7.28 + SetMenuExitBackButton(g_MapList, true);
7.29 +}
7.30 +
7.31 +public OnMapStart()
7.32 +{
7.33 + LoadMaps(g_MapList);
7.34 +
7.35 + ParseConfigs();
7.36 +}
7.37 +
7.38 +public OnMapEnd()
7.39 +{
7.40 + if (g_ConfigList != INVALID_HANDLE)
7.41 + {
7.42 + CloseHandle(g_ConfigList);
7.43 + g_ConfigList = INVALID_HANDLE;
7.44 + }
7.45 }
7.46
7.47 public OnAdminMenuReady(Handle:topmenu)
7.48 @@ -97,6 +125,14 @@
7.49 player_commands,
7.50 "sm_kick",
7.51 ADMFLAG_KICK);
7.52 +
7.53 + AddToTopMenu(hTopMenu,
7.54 + "Get Info",
7.55 + TopMenuObject_Item,
7.56 + AdminMenu_Who,
7.57 + player_commands,
7.58 + "sm_who",
7.59 + ADMFLAG_GENERIC);
7.60 }
7.61
7.62 new TopMenuObject:server_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_SERVERCOMMANDS);
7.63 @@ -110,6 +146,22 @@
7.64 server_commands,
7.65 "sm_reloadadmins",
7.66 ADMFLAG_BAN);
7.67 +
7.68 + AddToTopMenu(hTopMenu,
7.69 + "Change Map",
7.70 + TopMenuObject_Item,
7.71 + AdminMenu_Map,
7.72 + server_commands,
7.73 + "sm_map",
7.74 + ADMFLAG_CHANGEMAP);
7.75 +
7.76 + AddToTopMenu(hTopMenu,
7.77 + "Exec CFG",
7.78 + TopMenuObject_Item,
7.79 + AdminMenu_ExecCFG,
7.80 + server_commands,
7.81 + "sm_execcfg",
7.82 + ADMFLAG_CONFIG);
7.83 }
7.84
7.85 new TopMenuObject:voting_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_VOTINGCOMMANDS);
7.86 @@ -193,106 +245,6 @@
7.87 ImplodeStrings(joins, total, ", ", buffer, maxlength);
7.88 }
7.89
7.90 -public Action:Command_Who(client, args)
7.91 -{
7.92 - if (args < 1)
7.93 - {
7.94 - /* Display header */
7.95 - decl String:t_access[16], String:t_name[16];
7.96 - Format(t_access, sizeof(t_access), "%t", "Access", client);
7.97 - Format(t_name, sizeof(t_name), "%t", "Name", client);
7.98 -
7.99 - PrintToConsole(client, "%-24.23s %s", t_name, t_access);
7.100 -
7.101 - /* List all players */
7.102 - new maxClients = GetMaxClients();
7.103 - decl String:flagstring[255];
7.104 -
7.105 - for (new i=1; i<=maxClients; i++)
7.106 - {
7.107 - if (!IsClientInGame(i))
7.108 - {
7.109 - continue;
7.110 - }
7.111 - new flags = GetUserFlagBits(i);
7.112 - if (flags == 0)
7.113 - {
7.114 - strcopy(flagstring, sizeof(flagstring), "none");
7.115 - } else if (flags & ADMFLAG_ROOT) {
7.116 - strcopy(flagstring, sizeof(flagstring), "root");
7.117 - } else {
7.118 - FlagsToString(flagstring, sizeof(flagstring), flags);
7.119 - }
7.120 - decl String:name[65];
7.121 - GetClientName(i, name, sizeof(name));
7.122 - PrintToConsole(client, "%d. %-24.23s %s", i, name, flagstring);
7.123 - }
7.124 -
7.125 - if (GetCmdReplySource() == SM_REPLY_TO_CHAT)
7.126 - {
7.127 - ReplyToCommand(client, "[SM] %t", "See console for output");
7.128 - }
7.129 -
7.130 - return Plugin_Handled;
7.131 - }
7.132 -
7.133 - decl String:arg[65];
7.134 - GetCmdArg(1, arg, sizeof(arg));
7.135 -
7.136 - new clients[2];
7.137 - new numClients = SearchForClients(arg, clients, 2);
7.138 -
7.139 - if (numClients == 0)
7.140 - {
7.141 - ReplyToCommand(client, "[SM] %t", "No matching client");
7.142 - return Plugin_Handled;
7.143 - } else if (numClients > 1) {
7.144 - ReplyToCommand(client, "[SM] %t", "More than one client matches", arg);
7.145 - return Plugin_Handled;
7.146 - }
7.147 -
7.148 - new flags = GetUserFlagBits(clients[0]);
7.149 - decl String:flagstring[255];
7.150 - if (flags == 0)
7.151 - {
7.152 - strcopy(flagstring, sizeof(flagstring), "none");
7.153 - } else if (flags & ADMFLAG_ROOT) {
7.154 - strcopy(flagstring, sizeof(flagstring), "root");
7.155 - } else {
7.156 - FlagsToString(flagstring, sizeof(flagstring), flags);
7.157 - }
7.158 -
7.159 - ReplyToCommand(client, "[SM] %t: %s", "Access", flagstring);
7.160 -
7.161 - return Plugin_Handled;
7.162 -}
7.163 -
7.164 -public Action:Command_ExecCfg(client, args)
7.165 -{
7.166 - if (args < 1)
7.167 - {
7.168 - ReplyToCommand(client, "[SM] Usage: sm_execcfg <filename>");
7.169 - return Plugin_Handled;
7.170 - }
7.171 -
7.172 - new String:path[64] = "cfg/";
7.173 - GetCmdArg(1, path[4], sizeof(path)-4);
7.174 -
7.175 - if (!FileExists(path))
7.176 - {
7.177 - ReplyToCommand(client, "[SM] %t", "Config not found", path[4]);
7.178 - return Plugin_Handled;
7.179 - }
7.180 -
7.181 - ShowActivity(client, "%t", "Executed config", path[4]);
7.182 -
7.183 - LogAction(client, -1, "\"%L\" executed config (file \"%s\")", client, path[4]);
7.184 -
7.185 - ServerCommand("exec \"%s\"", path[4]);
7.186 -
7.187 - return Plugin_Handled;
7.188 -}
7.189 -
7.190 public Action:Command_Cvar(client, args)
7.191 {
7.192 if (args < 1)
7.193 @@ -388,44 +340,3 @@
7.194
7.195 return Plugin_Handled;
7.196 }
7.197 -
7.198 -public Action:Command_Map(client, args)
7.199 -{
7.200 - if (args < 1)
7.201 - {
7.202 - ReplyToCommand(client, "[SM] Usage: sm_map <map>");
7.203 - return Plugin_Handled;
7.204 - }
7.205 -
7.206 - decl String:map[64];
7.207 - GetCmdArg(1, map, sizeof(map));
7.208 -
7.209 - if (!IsMapValid(map))
7.210 - {
7.211 - ReplyToCommand(client, "[SM] %t", "Map was not found", map);
7.212 - return Plugin_Handled;
7.213 - }
7.214 -
7.215 - ShowActivity(client, "%t", "Changing map", map);
7.216 -
7.217 - LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map);
7.218 -
7.219 - new Handle:dp;
7.220 - CreateDataTimer(3.0, Timer_ChangeMap, dp);
7.221 - WritePackString(dp, map);
7.222 -
7.223 - return Plugin_Handled;
7.224 -}
7.225 -
7.226 -public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
7.227 -{
7.228 - decl String:map[65];
7.229 -
7.230 - ResetPack(dp);
7.231 - ReadPackString(dp, map, sizeof(map));
7.232 -
7.233 - ServerCommand("changelevel \"%s\"", map);
7.234 -
7.235 - return Plugin_Stop;
7.236 -}
7.237 -
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
8.2 +++ b/plugins/basecommands/execcfg.sp Sat Oct 13 04:43:42 2007 +0000
8.3 @@ -0,0 +1,116 @@
8.4 +PerformExec(client, String:path[])
8.5 +{
8.6 + if (!FileExists(path))
8.7 + {
8.8 + ReplyToCommand(client, "[SM] %t", "Config not found", path[4]);
8.9 + return;
8.10 + }
8.11 +
8.12 + ShowActivity(client, "%t", "Executed config", path[4]);
8.13 +
8.14 + LogAction(client, -1, "\"%L\" executed config (file \"%s\")", client, path[4]);
8.15 +
8.16 + ServerCommand("exec \"%s\"", path[4]);
8.17 +}
8.18 +
8.19 +public AdminMenu_ExecCFG(Handle:topmenu,
8.20 + TopMenuAction:action,
8.21 + TopMenuObject:object_id,
8.22 + param,
8.23 + String:buffer[],
8.24 + maxlength)
8.25 +{
8.26 + if (action == TopMenuAction_DisplayOption)
8.27 + {
8.28 + Format(buffer, maxlength, "%T", "Exec CFG", param);
8.29 + }
8.30 + else if (action == TopMenuAction_SelectOption)
8.31 + {
8.32 + DisplayMenu(g_ConfigList, param, MENU_TIME_FOREVER);
8.33 + }
8.34 +}
8.35 +
8.36 +public MenuHandler_ExecCFG(Handle:menu, MenuAction:action, param1, param2)
8.37 +{
8.38 + if (action == MenuAction_Cancel)
8.39 + {
8.40 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
8.41 + {
8.42 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
8.43 + }
8.44 + }
8.45 + else if (action == MenuAction_Select)
8.46 + {
8.47 + decl String:path[256];
8.48 +
8.49 + GetMenuItem(menu, param2, path, sizeof(path));
8.50 +
8.51 + PerformExec(param1, path);
8.52 + }
8.53 +}
8.54 +
8.55 +public Action:Command_ExecCfg(client, args)
8.56 +{
8.57 + if (args < 1)
8.58 + {
8.59 + ReplyToCommand(client, "[SM] Usage: sm_execcfg <filename>");
8.60 + return Plugin_Handled;
8.61 + }
8.62 +
8.63 + new String:path[64] = "cfg/";
8.64 + GetCmdArg(1, path[4], sizeof(path)-4);
8.65 +
8.66 + PerformExec(client, path);
8.67 +
8.68 + return Plugin_Handled;
8.69 +}
8.70 +
8.71 +ParseConfigs()
8.72 +{
8.73 + new Handle:list = SMC_CreateParser();
8.74 + SMC_SetReaders(list, NewSection, KeyValue, EndSection);
8.75 + SMC_SetParseEnd(list, ParseEnd);
8.76 +
8.77 + new Handle:menu = CreateMenu(MenuHandler_ExecCFG);
8.78 + SetMenuTitle(menu, "Choose Config");
8.79 + SetMenuExitBackButton(menu, true);
8.80 +
8.81 + decl String:configPath[256];
8.82 + BuildPath(Path_SM, configPath, sizeof(configPath), "configs/menu_configs.cfg");
8.83 +
8.84 + if (!FileExists(configPath))
8.85 + {
8.86 + LogError("Unable to locate exec config file, no maps loaded.");
8.87 +
8.88 + return;
8.89 + }
8.90 +
8.91 + g_ConfigList = menu;
8.92 +
8.93 + SMC_ParseFile(list, configPath);
8.94 +
8.95 + return;
8.96 +}
8.97 +
8.98 +public SMCResult:NewSection(Handle:smc, const String:name[], bool:opt_quotes)
8.99 +{
8.100 +
8.101 +}
8.102 +
8.103 +public SMCResult:KeyValue(Handle:smc, const String:key[], const String:value[], bool:key_quotes, bool:value_quotes)
8.104 +{
8.105 + AddMenuItem(g_ConfigList, key, value);
8.106 +}
8.107 +
8.108 +public SMCResult:EndSection(Handle:smc)
8.109 +{
8.110 +
8.111 +}
8.112 +
8.113 +public ParseEnd(Handle:smc, bool:halted, bool:failed)
8.114 +{
8.115 + if (halted || failed)
8.116 + LogError("Reading of configs file failed");
8.117 +
8.118 + CloseHandle(smc);
8.119 +}
8.120 \ No newline at end of file
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
9.2 +++ b/plugins/basecommands/map.sp Sat Oct 13 04:43:42 2007 +0000
9.3 @@ -0,0 +1,147 @@
9.4 +
9.5 +public MenuHandler_ChangeMap(Handle:menu, MenuAction:action, param1, param2)
9.6 +{
9.7 + if (action == MenuAction_Cancel)
9.8 + {
9.9 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
9.10 + {
9.11 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
9.12 + }
9.13 + }
9.14 + else if (action == MenuAction_Select)
9.15 + {
9.16 + decl String:map[64];
9.17 +
9.18 + GetMenuItem(menu, param2, map, sizeof(map));
9.19 +
9.20 + ShowActivity(param1, "%t", "Changing map", map);
9.21 +
9.22 + LogAction(param1, -1, "\"%L\" changed map to \"%s\"", param1, map);
9.23 +
9.24 + new Handle:dp;
9.25 + CreateDataTimer(3.0, Timer_ChangeMap, dp);
9.26 + WritePackString(dp, map);
9.27 +
9.28 + }
9.29 +}
9.30 +
9.31 +public AdminMenu_Map(Handle:topmenu,
9.32 + TopMenuAction:action,
9.33 + TopMenuObject:object_id,
9.34 + param,
9.35 + String:buffer[],
9.36 + maxlength)
9.37 +{
9.38 + if (action == TopMenuAction_DisplayOption)
9.39 + {
9.40 + Format(buffer, maxlength, "%T", "Choose Map", param);
9.41 + }
9.42 + else if (action == TopMenuAction_SelectOption)
9.43 + {
9.44 + DisplayMenu(g_MapList, param, MENU_TIME_FOREVER);
9.45 + }
9.46 +}
9.47 +
9.48 +public Action:Command_Map(client, args)
9.49 +{
9.50 + if (args < 1)
9.51 + {
9.52 + ReplyToCommand(client, "[SM] Usage: sm_map <map>");
9.53 + return Plugin_Handled;
9.54 + }
9.55 +
9.56 + decl String:map[64];
9.57 + GetCmdArg(1, map, sizeof(map));
9.58 +
9.59 + if (!IsMapValid(map))
9.60 + {
9.61 + ReplyToCommand(client, "[SM] %t", "Map was not found", map);
9.62 + return Plugin_Handled;
9.63 + }
9.64 +
9.65 + ShowActivity(client, "%t", "Changing map", map);
9.66 +
9.67 + LogAction(client, -1, "\"%L\" changed map to \"%s\"", client, map);
9.68 +
9.69 + new Handle:dp;
9.70 + CreateDataTimer(3.0, Timer_ChangeMap, dp);
9.71 + WritePackString(dp, map);
9.72 +
9.73 + return Plugin_Handled;
9.74 +}
9.75 +
9.76 +public Action:Timer_ChangeMap(Handle:timer, Handle:dp)
9.77 +{
9.78 + decl String:map[65];
9.79 +
9.80 + ResetPack(dp);
9.81 + ReadPackString(dp, map, sizeof(map));
9.82 +
9.83 + ServerCommand("changelevel \"%s\"", map);
9.84 +
9.85 + return Plugin_Stop;
9.86 +}
9.87 +
9.88 +LoadMaps(Handle:menu)
9.89 +{
9.90 + decl String:mapPath[256];
9.91 + BuildPath(Path_SM, mapPath, sizeof(mapPath), "configs/menu_maplist.ini");
9.92 +
9.93 + if (!FileExists(mapPath))
9.94 + {
9.95 + LogError("Unable to locate menu_maplist, no maps loaded.");
9.96 +
9.97 + if (g_MapList != INVALID_HANDLE)
9.98 + {
9.99 + RemoveAllMenuItems(menu);
9.100 + }
9.101 +
9.102 + return;
9.103 + }
9.104 +
9.105 + // If the file hasn't changed, there's no reason to reload
9.106 + // all of the maps.
9.107 + new fileTime = GetFileTime(mapPath, FileTime_LastChange);
9.108 + if (g_mapFileTime == fileTime)
9.109 + {
9.110 + return;
9.111 + }
9.112 +
9.113 + g_mapFileTime = fileTime;
9.114 +
9.115 + // Reset the array
9.116 + if (g_MapList != INVALID_HANDLE)
9.117 + {
9.118 + RemoveAllMenuItems(menu);
9.119 + }
9.120 +
9.121 + LogMessage("[SM] Loading menu map list file [%s]", mapPath);
9.122 +
9.123 + new Handle:file = OpenFile(mapPath, "rt");
9.124 + if (file == INVALID_HANDLE)
9.125 + {
9.126 + LogError("[SM] Could not open file: %s", mapPath);
9.127 + return;
9.128 + }
9.129 +
9.130 + decl String:buffer[64], len;
9.131 + while (!IsEndOfFile(file) && ReadFileLine(file, buffer, sizeof(buffer)))
9.132 + {
9.133 + TrimString(buffer);
9.134 +
9.135 + if ((len = StrContains(buffer, ".bsp", false)) != -1)
9.136 + {
9.137 + buffer[len] = '\0';
9.138 + }
9.139 +
9.140 + if (buffer[0] == '\0' || !IsValidConVarChar(buffer[0]) || !IsMapValid(buffer))
9.141 + {
9.142 + continue;
9.143 + }
9.144 +
9.145 + AddMenuItem(menu, buffer, buffer);
9.146 + }
9.147 +
9.148 + CloseHandle(file);
9.149 + return;
9.150 +}
9.151 \ No newline at end of file
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/plugins/basecommands/who.sp Sat Oct 13 04:43:42 2007 +0000
10.3 @@ -0,0 +1,157 @@
10.4 +
10.5 +PerformWho(client, target, ReplySource:reply)
10.6 +{
10.7 + new flags = GetUserFlagBits(target);
10.8 + decl String:flagstring[255];
10.9 + if (flags == 0)
10.10 + {
10.11 + strcopy(flagstring, sizeof(flagstring), "none");
10.12 + } else if (flags & ADMFLAG_ROOT) {
10.13 + strcopy(flagstring, sizeof(flagstring), "root");
10.14 + } else {
10.15 + FlagsToString(flagstring, sizeof(flagstring), flags);
10.16 + }
10.17 +
10.18 + if (reply == SM_REPLY_TO_CHAT)
10.19 + PrintToChat(client, "[SM] %t: %s", "Access", flagstring);
10.20 + else
10.21 + PrintToConsole(client, "[SM] %t: %s", "Access", flagstring);
10.22 +}
10.23 +
10.24 +DisplayWhoMenu(client)
10.25 +{
10.26 + new Handle:menu = CreateMenu(MenuHandler_Who);
10.27 +
10.28 + decl String:title[100];
10.29 + Format(title, sizeof(title), "%T:", "Check player access", client);
10.30 + SetMenuTitle(menu, title);
10.31 + SetMenuExitBackButton(menu, true);
10.32 +
10.33 + AddTargetsToMenu(menu, client, false);
10.34 +
10.35 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
10.36 +}
10.37 +
10.38 +public AdminMenu_Who(Handle:topmenu,
10.39 + TopMenuAction:action,
10.40 + TopMenuObject:object_id,
10.41 + param,
10.42 + String:buffer[],
10.43 + maxlength)
10.44 +{
10.45 + if (action == TopMenuAction_DisplayOption)
10.46 + {
10.47 + Format(buffer, maxlength, "%T", "Check player access", param);
10.48 + }
10.49 + else if (action == TopMenuAction_SelectOption)
10.50 + {
10.51 + DisplayWhoMenu(param);
10.52 + }
10.53 +}
10.54 +
10.55 +public MenuHandler_Who(Handle:menu, MenuAction:action, param1, param2)
10.56 +{
10.57 + if (action == MenuAction_End)
10.58 + {
10.59 + CloseHandle(menu);
10.60 + }
10.61 + else if (action == MenuAction_Cancel)
10.62 + {
10.63 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
10.64 + {
10.65 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
10.66 + }
10.67 + }
10.68 + else if (action == MenuAction_Select)
10.69 + {
10.70 + decl String:info[32];
10.71 + new userid, target;
10.72 +
10.73 + GetMenuItem(menu, param2, info, sizeof(info));
10.74 + userid = StringToInt(info);
10.75 +
10.76 + if ((target = GetClientOfUserId(userid)) == 0)
10.77 + {
10.78 + PrintToChat(param1, "[SM] %t", "Player no longer available");
10.79 + }
10.80 + else if (!CanUserTarget(param1, target))
10.81 + {
10.82 + PrintToChat(param1, "[SM] %t", "Unable to target");
10.83 + }
10.84 + else
10.85 + {
10.86 + PerformWho(param1, target, SM_REPLY_TO_CHAT);
10.87 + }
10.88 +
10.89 + /* Re-draw the menu if they're still valid */
10.90 +
10.91 + /* - Close the menu? redisplay? jump back up to the category?
10.92 + if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
10.93 + {
10.94 + DisplayWhoMenu(param1);
10.95 + }
10.96 + */
10.97 + }
10.98 +}
10.99 +public Action:Command_Who(client, args)
10.100 +{
10.101 + if (args < 1)
10.102 + {
10.103 + /* Display header */
10.104 + decl String:t_access[16], String:t_name[16];
10.105 + Format(t_access, sizeof(t_access), "%t", "Access", client);
10.106 + Format(t_name, sizeof(t_name), "%t", "Name", client);
10.107 +
10.108 + PrintToConsole(client, "%-24.23s %s", t_name, t_access);
10.109 +
10.110 + /* List all players */
10.111 + new maxClients = GetMaxClients();
10.112 + decl String:flagstring[255];
10.113 +
10.114 + for (new i=1; i<=maxClients; i++)
10.115 + {
10.116 + if (!IsClientInGame(i))
10.117 + {
10.118 + continue;
10.119 + }
10.120 + new flags = GetUserFlagBits(i);
10.121 + if (flags == 0)
10.122 + {
10.123 + strcopy(flagstring, sizeof(flagstring), "none");
10.124 + } else if (flags & ADMFLAG_ROOT) {
10.125 + strcopy(flagstring, sizeof(flagstring), "root");
10.126 + } else {
10.127 + FlagsToString(flagstring, sizeof(flagstring), flags);
10.128 + }
10.129 + decl String:name[65];
10.130 + GetClientName(i, name, sizeof(name));
10.131 + PrintToConsole(client, "%d. %-24.23s %s", i, name, flagstring);
10.132 + }
10.133 +
10.134 + if (GetCmdReplySource() == SM_REPLY_TO_CHAT)
10.135 + {
10.136 + ReplyToCommand(client, "[SM] %t", "See console for output");
10.137 + }
10.138 +
10.139 + return Plugin_Handled;
10.140 + }
10.141 +
10.142 + decl String:arg[65];
10.143 + GetCmdArg(1, arg, sizeof(arg));
10.144 +
10.145 + new clients[2];
10.146 + new numClients = SearchForClients(arg, clients, 2);
10.147 +
10.148 + if (numClients == 0)
10.149 + {
10.150 + ReplyToCommand(client, "[SM] %t", "No matching client");
10.151 + return Plugin_Handled;
10.152 + } else if (numClients > 1) {
10.153 + ReplyToCommand(client, "[SM] %t", "More than one client matches", arg);
10.154 + return Plugin_Handled;
10.155 + }
10.156 +
10.157 + PerformWho(client, clients[0], GetCmdReplySource());
10.158 +
10.159 + return Plugin_Handled;
10.160 +}
11.1 --- a/plugins/basefuncommands.sp Mon Oct 08 22:13:49 2007 +0000
11.2 +++ b/plugins/basefuncommands.sp Sat Oct 13 04:43:42 2007 +0000
11.3 @@ -35,6 +35,8 @@
11.4
11.5 #include <sourcemod>
11.6 #include <sdktools>
11.7 +#undef REQUIRE_PLUGIN
11.8 +#include <adminmenu>
11.9
11.10 public Plugin:myinfo =
11.11 {
11.12 @@ -45,6 +47,14 @@
11.13 url = "http://www.sourcemod.net/"
11.14 };
11.15
11.16 +new Handle:hTopMenu = INVALID_HANDLE;
11.17 +
11.18 +new g_SlapDamage[MAXPLAYERS+1];
11.19 +
11.20 +#include "basefuncommands/slay.sp"
11.21 +#include "basefuncommands/burn.sp"
11.22 +#include "basefuncommands/slap.sp"
11.23 +
11.24 public OnPluginStart()
11.25 {
11.26 LoadTranslations("common.phrases");
11.27 @@ -53,6 +63,55 @@
11.28 RegAdminCmd("sm_slap", Command_Slap, ADMFLAG_SLAY, "sm_slap <#userid|name> [damage]");
11.29 RegAdminCmd("sm_slay", Command_Slay, ADMFLAG_SLAY, "sm_slay <#userid|name>");
11.30 RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> <filename>");
11.31 +
11.32 + /* Account for late loading */
11.33 + new Handle:topmenu;
11.34 + if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
11.35 + {
11.36 + OnAdminMenuReady(topmenu);
11.37 + }
11.38 +}
11.39 +
11.40 +public OnAdminMenuReady(Handle:topmenu)
11.41 +{
11.42 + /* Block us from being called twice */
11.43 + if (topmenu == hTopMenu)
11.44 + {
11.45 + return;
11.46 + }
11.47 +
11.48 + /* Save the Handle */
11.49 + hTopMenu = topmenu;
11.50 +
11.51 + /* Find the "Player Commands" category */
11.52 + new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
11.53 +
11.54 + if (player_commands != INVALID_TOPMENUOBJECT)
11.55 + {
11.56 + AddToTopMenu(hTopMenu,
11.57 + "Slay Player",
11.58 + TopMenuObject_Item,
11.59 + AdminMenu_Slay,
11.60 + player_commands,
11.61 + "sm_slay",
11.62 + ADMFLAG_SLAY);
11.63 +
11.64 + AddToTopMenu(hTopMenu,
11.65 + "Burn Player",
11.66 + TopMenuObject_Item,
11.67 + AdminMenu_Burn,
11.68 + player_commands,
11.69 + "sm_burn",
11.70 + ADMFLAG_SLAY);
11.71 +
11.72 + AddToTopMenu(hTopMenu,
11.73 + "Slap Player",
11.74 + TopMenuObject_Item,
11.75 + AdminMenu_Slap,
11.76 + player_commands,
11.77 + "sm_slap",
11.78 + ADMFLAG_SLAY);
11.79 + }
11.80 }
11.81
11.82 public Action:Command_Play(client, args)
11.83 @@ -102,122 +161,3 @@
11.84 return Plugin_Handled;
11.85 }
11.86
11.87 -public Action:Command_Burn(client, args)
11.88 -{
11.89 - if (args < 1)
11.90 - {
11.91 - ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
11.92 - return Plugin_Handled;
11.93 - }
11.94 -
11.95 - decl String:arg[65];
11.96 - GetCmdArg(1, arg, sizeof(arg));
11.97 -
11.98 - new target = FindTarget(client, arg);
11.99 - if (target == -1)
11.100 - {
11.101 - return Plugin_Handled;
11.102 - }
11.103 -
11.104 - GetClientName(target, arg, sizeof(arg));
11.105 -
11.106 - if (!IsPlayerAlive(target))
11.107 - {
11.108 - ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
11.109 - return Plugin_Handled;
11.110 - }
11.111 -
11.112 - new Float:seconds = 20.0;
11.113 - if (args > 1)
11.114 - {
11.115 - decl String:time[20];
11.116 - GetCmdArg(2, time, sizeof(time));
11.117 - if (StringToFloatEx(time, seconds) == 0)
11.118 - {
11.119 - ReplyToCommand(client, "[SM] %t", "Invalid Amount");
11.120 - return Plugin_Handled;
11.121 - }
11.122 - }
11.123 -
11.124 - ShowActivity(client, "%t", "Ignited player", arg);
11.125 - LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
11.126 - IgniteEntity(target, seconds);
11.127 -
11.128 - return Plugin_Handled;
11.129 -}
11.130 -
11.131 -public Action:Command_Slap(client, args)
11.132 -{
11.133 - if (args < 1)
11.134 - {
11.135 - ReplyToCommand(client, "[SM] Usage: sm_slap <#userid|name> [damage]");
11.136 - return Plugin_Handled;
11.137 - }
11.138 -
11.139 - decl String:arg[65];
11.140 - GetCmdArg(1, arg, sizeof(arg));
11.141 -
11.142 - new target = FindTarget(client, arg);
11.143 - if (target == -1)
11.144 - {
11.145 - return Plugin_Handled;
11.146 - }
11.147 -
11.148 - GetClientName(target, arg, sizeof(arg));
11.149 -
11.150 - if (!IsPlayerAlive(target))
11.151 - {
11.152 - ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
11.153 - return Plugin_Handled;
11.154 - }
11.155 -
11.156 - new damage = 0;
11.157 - if (args > 1)
11.158 - {
11.159 - decl String:arg2[20];
11.160 - GetCmdArg(2, arg2, sizeof(arg2));
11.161 - if (StringToIntEx(arg2, damage) == 0)
11.162 - {
11.163 - ReplyToCommand(client, "[SM] %t", "Invalid Amount");
11.164 - return Plugin_Handled;
11.165 - }
11.166 - }
11.167 -
11.168 - ShowActivity(client, "%t", "Slapped player", arg);
11.169 - LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
11.170 - SlapPlayer(target, damage, true);
11.171 -
11.172 - return Plugin_Handled;
11.173 -}
11.174 -
11.175 -public Action:Command_Slay(client, args)
11.176 -{
11.177 - if (args < 1)
11.178 - {
11.179 - ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
11.180 - return Plugin_Handled;
11.181 - }
11.182 -
11.183 - decl String:arg[65];
11.184 - GetCmdArg(1, arg, sizeof(arg));
11.185 -
11.186 - new target = FindTarget(client, arg);
11.187 - if (target == -1)
11.188 - {
11.189 - return Plugin_Handled;
11.190 - }
11.191 -
11.192 - GetClientName(target, arg, sizeof(arg));
11.193 -
11.194 - if (!IsPlayerAlive(target))
11.195 - {
11.196 - ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
11.197 - return Plugin_Handled;
11.198 - }
11.199 -
11.200 - ShowActivity(client, "%t", "Slayed player", arg);
11.201 - LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
11.202 - ForcePlayerSuicide(target);
11.203 -
11.204 - return Plugin_Handled;
11.205 -}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/plugins/basefuncommands/burn.sp Sat Oct 13 04:43:42 2007 +0000
12.3 @@ -0,0 +1,124 @@
12.4 +PerformBurn(client, target, Float:seconds)
12.5 +{
12.6 + new String:name[32];
12.7 +
12.8 + GetClientName(target, name, sizeof(name));
12.9 +
12.10 + if (!IsPlayerAlive(target))
12.11 + {
12.12 + ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
12.13 + return;
12.14 + }
12.15 +
12.16 + ShowActivity(client, "%t", "Ignited player", name);
12.17 + LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
12.18 + IgniteEntity(target, seconds);
12.19 +}
12.20 +
12.21 +DisplayBurnMenu(client)
12.22 +{
12.23 + new Handle:menu = CreateMenu(MenuHandler_Burn);
12.24 +
12.25 + decl String:title[100];
12.26 + Format(title, sizeof(title), "%T:", "Burn Player", client);
12.27 + SetMenuTitle(menu, title);
12.28 + SetMenuExitBackButton(menu, true);
12.29 +
12.30 + AddTargetsToMenu(menu, client, false);
12.31 +
12.32 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
12.33 +}
12.34 +
12.35 +public AdminMenu_Burn(Handle:topmenu,
12.36 + TopMenuAction:action,
12.37 + TopMenuObject:object_id,
12.38 + param,
12.39 + String:buffer[],
12.40 + maxlength)
12.41 +{
12.42 + if (action == TopMenuAction_DisplayOption)
12.43 + {
12.44 + Format(buffer, maxlength, "%T", "Burn Player", param);
12.45 + }
12.46 + else if (action == TopMenuAction_SelectOption)
12.47 + {
12.48 + DisplayBurnMenu(param);
12.49 + }
12.50 +}
12.51 +
12.52 +public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
12.53 +{
12.54 + if (action == MenuAction_End)
12.55 + {
12.56 + CloseHandle(menu);
12.57 + }
12.58 + else if (action == MenuAction_Cancel)
12.59 + {
12.60 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
12.61 + {
12.62 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
12.63 + }
12.64 + }
12.65 + else if (action == MenuAction_Select)
12.66 + {
12.67 + decl String:info[32];
12.68 + new userid, target;
12.69 +
12.70 + GetMenuItem(menu, param2, info, sizeof(info));
12.71 + userid = StringToInt(info);
12.72 +
12.73 + if ((target = GetClientOfUserId(userid)) == 0)
12.74 + {
12.75 + PrintToChat(param1, "[SM] %t", "Player no longer available");
12.76 + }
12.77 + else if (!CanUserTarget(param1, target))
12.78 + {
12.79 + PrintToChat(param1, "[SM] %t", "Unable to target");
12.80 + }
12.81 + else
12.82 + {
12.83 + PerformBurn(param1, target, 20.0);
12.84 + }
12.85 +
12.86 + /* Re-draw the menu if they're still valid */
12.87 + if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
12.88 + {
12.89 + DisplaySlayMenu(param1);
12.90 + }
12.91 + }
12.92 +}
12.93 +
12.94 +public Action:Command_Burn(client, args)
12.95 +{
12.96 + if (args < 1)
12.97 + {
12.98 + ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
12.99 + return Plugin_Handled;
12.100 + }
12.101 +
12.102 + decl String:arg[65];
12.103 + GetCmdArg(1, arg, sizeof(arg));
12.104 +
12.105 + new target = FindTarget(client, arg);
12.106 + if (target == -1)
12.107 + {
12.108 + return Plugin_Handled;
12.109 + }
12.110 +
12.111 + new Float:seconds = 20.0;
12.112 +
12.113 + if (args > 1)
12.114 + {
12.115 + decl String:time[20];
12.116 + GetCmdArg(2, time, sizeof(time));
12.117 + if (StringToFloatEx(time, seconds) == 0)
12.118 + {
12.119 + ReplyToCommand(client, "[SM] %t", "Invalid Amount");
12.120 + return Plugin_Handled;
12.121 + }
12.122 + }
12.123 +
12.124 + PerformBurn(client, target, seconds);
12.125 +
12.126 + return Plugin_Handled;
12.127 +}
12.128 \ No newline at end of file
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/plugins/basefuncommands/slap.sp Sat Oct 13 04:43:42 2007 +0000
13.3 @@ -0,0 +1,167 @@
13.4 +PerformSlap(client, target, damage)
13.5 +{
13.6 + new String:name[32];
13.7 +
13.8 + GetClientName(target, name, sizeof(name));
13.9 +
13.10 + if (!IsPlayerAlive(target))
13.11 + {
13.12 + ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
13.13 + return;
13.14 + }
13.15 +
13.16 + ShowActivity(client, "%t", "Slapped player", name);
13.17 + LogAction(client, target, "\"%L\" slapped \"%L\" (damage \"%d\")", client, target, damage);
13.18 + SlapPlayer(target, damage, true);
13.19 +}
13.20 +
13.21 +DisplaySlapDamageMenu(client)
13.22 +{
13.23 + new Handle:menu = CreateMenu(MenuHandler_SlapDamage);
13.24 +
13.25 + decl String:title[100];
13.26 + Format(title, sizeof(title), "%T:", "Slap Damage", client);
13.27 + SetMenuTitle(menu, title);
13.28 + SetMenuExitBackButton(menu, true);
13.29 +
13.30 + AddMenuItem(menu, "0", "0");
13.31 + AddMenuItem(menu, "1", "1");
13.32 + AddMenuItem(menu, "5", "5");
13.33 + AddMenuItem(menu, "10", "10");
13.34 + AddMenuItem(menu, "20", "20");
13.35 + AddMenuItem(menu, "50", "50");
13.36 + AddMenuItem(menu, "99", "99");
13.37 +
13.38 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
13.39 +}
13.40 +
13.41 +DisplaySlapTargetMenu(client)
13.42 +{
13.43 + new Handle:menu = CreateMenu(MenuHandler_Slap);
13.44 +
13.45 + decl String:title[100];
13.46 + Format(title, sizeof(title), "%T:", "Slap Player", client);
13.47 + SetMenuTitle(menu, title);
13.48 + SetMenuExitBackButton(menu, true);
13.49 +
13.50 + AddTargetsToMenu(menu, client, false);
13.51 +
13.52 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
13.53 +}
13.54 +
13.55 +public AdminMenu_Slap(Handle:topmenu,
13.56 + TopMenuAction:action,
13.57 + TopMenuObject:object_id,
13.58 + param,
13.59 + String:buffer[],
13.60 + maxlength)
13.61 +{
13.62 + if (action == TopMenuAction_DisplayOption)
13.63 + {
13.64 + Format(buffer, maxlength, "%T", "Slap Player", param);
13.65 + }
13.66 + else if (action == TopMenuAction_SelectOption)
13.67 + {
13.68 + DisplaySlapDamageMenu(param);
13.69 + }
13.70 +}
13.71 +
13.72 +public MenuHandler_SlapDamage(Handle:menu, MenuAction:action, param1, param2)
13.73 +{
13.74 + if (action == MenuAction_End)
13.75 + {
13.76 + CloseHandle(menu);
13.77 + }
13.78 + else if (action == MenuAction_Cancel)
13.79 + {
13.80 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
13.81 + {
13.82 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
13.83 + }
13.84 + }
13.85 + else if (action == MenuAction_Select)
13.86 + {
13.87 + decl String:info[32];
13.88 +
13.89 + GetMenuItem(menu, param2, info, sizeof(info));
13.90 + g_SlapDamage[param1] = StringToInt(info);
13.91 +
13.92 + DisplaySlapTargetMenu(param1);
13.93 + }
13.94 +}
13.95 +
13.96 +public MenuHandler_Slap(Handle:menu, MenuAction:action, param1, param2)
13.97 +{
13.98 + if (action == MenuAction_End)
13.99 + {
13.100 + CloseHandle(menu);
13.101 + }
13.102 + else if (action == MenuAction_Cancel)
13.103 + {
13.104 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
13.105 + {
13.106 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
13.107 + }
13.108 + }
13.109 + else if (action == MenuAction_Select)
13.110 + {
13.111 + decl String:info[32];
13.112 + new userid, target;
13.113 +
13.114 + GetMenuItem(menu, param2, info, sizeof(info));
13.115 + userid = StringToInt(info);
13.116 +
13.117 + if ((target = GetClientOfUserId(userid)) == 0)
13.118 + {
13.119 + PrintToChat(param1, "[SM] %t", "Player no longer available");
13.120 + }
13.121 + else if (!CanUserTarget(param1, target))
13.122 + {
13.123 + PrintToChat(param1, "[SM] %t", "Unable to target");
13.124 + }
13.125 + else
13.126 + {
13.127 + PerformSlap(param1, target, g_SlapDamage[param1]);
13.128 + }
13.129 +
13.130 + /* Re-draw the menu if they're still valid */
13.131 + if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
13.132 + {
13.133 + DisplaySlapTargetMenu(param1);
13.134 + }
13.135 + }
13.136 +}
13.137 +
13.138 +public Action:Command_Slap(client, args)
13.139 +{
13.140 + if (args < 1)
13.141 + {
13.142 + ReplyToCommand(client, "[SM] Usage: sm_slap <#userid|name> [damage]");
13.143 + return Plugin_Handled;
13.144 + }
13.145 +
13.146 + decl String:arg[65];
13.147 + GetCmdArg(1, arg, sizeof(arg));
13.148 +
13.149 + new target = FindTarget(client, arg);
13.150 + if (target == -1)
13.151 + {
13.152 + return Plugin_Handled;
13.153 + }
13.154 +
13.155 + new damage = 0;
13.156 + if (args > 1)
13.157 + {
13.158 + decl String:arg2[20];
13.159 + GetCmdArg(2, arg2, sizeof(arg2));
13.160 + if (StringToIntEx(arg2, damage) == 0)
13.161 + {
13.162 + ReplyToCommand(client, "[SM] %t", "Invalid Amount");
13.163 + return Plugin_Handled;
13.164 + }
13.165 + }
13.166 +
13.167 + PerformSlap(client, target, damage);
13.168 +
13.169 + return Plugin_Handled;
13.170 +}
13.171 \ No newline at end of file
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/plugins/basefuncommands/slay.sp Sat Oct 13 04:43:42 2007 +0000
14.3 @@ -0,0 +1,112 @@
14.4 +
14.5 +PerformSlay(client, target)
14.6 +{
14.7 + decl String:name[32];
14.8 +
14.9 + GetClientName(target, name, sizeof(name));
14.10 +
14.11 + if (!IsPlayerAlive(target))
14.12 + {
14.13 + ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
14.14 + return;
14.15 + }
14.16 +
14.17 + ShowActivity(client, "%t", "Slayed player", name);
14.18 + LogAction(client, target, "\"%L\" slayed \"%L\"", client, target);
14.19 + ForcePlayerSuicide(target);
14.20 +}
14.21 +
14.22 +DisplaySlayMenu(client)
14.23 +{
14.24 + new Handle:menu = CreateMenu(MenuHandler_Slay);
14.25 +
14.26 + decl String:title[100];
14.27 + Format(title, sizeof(title), "%T:", "Slay player", client);
14.28 + SetMenuTitle(menu, title);
14.29 + SetMenuExitBackButton(menu, true);
14.30 +
14.31 + AddTargetsToMenu(menu, client, false);
14.32 +
14.33 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
14.34 +}
14.35 +
14.36 +public AdminMenu_Slay(Handle:topmenu,
14.37 + TopMenuAction:action,
14.38 + TopMenuObject:object_id,
14.39 + param,
14.40 + String:buffer[],
14.41 + maxlength)
14.42 +{
14.43 + if (action == TopMenuAction_DisplayOption)
14.44 + {
14.45 + Format(buffer, maxlength, "%T", "Slay player", param);
14.46 + }
14.47 + else if (action == TopMenuAction_SelectOption)
14.48 + {
14.49 + DisplaySlayMenu(param);
14.50 + }
14.51 +}
14.52 +
14.53 +public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
14.54 +{
14.55 + if (action == MenuAction_End)
14.56 + {
14.57 + CloseHandle(menu);
14.58 + }
14.59 + else if (action == MenuAction_Cancel)
14.60 + {
14.61 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
14.62 + {
14.63 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
14.64 + }
14.65 + }
14.66 + else if (action == MenuAction_Select)
14.67 + {
14.68 + decl String:info[32];
14.69 + new userid, target;
14.70 +
14.71 + GetMenuItem(menu, param2, info, sizeof(info));
14.72 + userid = StringToInt(info);
14.73 +
14.74 + if ((target = GetClientOfUserId(userid)) == 0)
14.75 + {
14.76 + PrintToChat(param1, "[SM] %t", "Player no longer available");
14.77 + }
14.78 + else if (!CanUserTarget(param1, target))
14.79 + {
14.80 + PrintToChat(param1, "[SM] %t", "Unable to target");
14.81 + }
14.82 + else
14.83 + {
14.84 + PerformSlay(param1, target);
14.85 + }
14.86 +
14.87 + /* Re-draw the menu if they're still valid */
14.88 + if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
14.89 + {
14.90 + DisplaySlayMenu(param1);
14.91 + }
14.92 + }
14.93 +}
14.94 +
14.95 +public Action:Command_Slay(client, args)
14.96 +{
14.97 + if (args < 1)
14.98 + {
14.99 + ReplyToCommand(client, "[SM] Usage: sm_slay <#userid|name>");
14.100 + return Plugin_Handled;
14.101 + }
14.102 +
14.103 + decl String:arg[65];
14.104 + GetCmdArg(1, arg, sizeof(arg));
14.105 +
14.106 + new target = FindTarget(client, arg);
14.107 + if (target == -1)
14.108 + {
14.109 + return Plugin_Handled;
14.110 + }
14.111 +
14.112 + PerformSlay(client, target);
14.113 +
14.114 + return Plugin_Handled;
14.115 +}
15.1 --- a/plugins/basefunvotes.sp Mon Oct 08 22:13:49 2007 +0000
15.2 +++ b/plugins/basefunvotes.sp Sat Oct 13 04:43:42 2007 +0000
15.3 @@ -36,6 +36,9 @@
15.4 #include <sourcemod>
15.5 #include <sdktools>
15.6
15.7 +#undef REQUIRE_PLUGIN
15.8 +#include <adminmenu>
15.9 +
15.10 public Plugin:myinfo =
15.11 {
15.12 name = "Basic Fun Votes",
15.13 @@ -64,7 +67,7 @@
15.14 slay,
15.15 alltalk,
15.16 ff
15.17 -}
15.18 +};
15.19
15.20 new voteType:g_voteType = voteType:gravity;
15.21
15.22 @@ -80,6 +83,14 @@
15.23 #define VOTE_IP 2
15.24 new String:g_voteInfo[3][65]; /* Holds the target's name, authid, and IP */
15.25
15.26 +new Handle:hTopMenu = INVALID_HANDLE;
15.27 +
15.28 +#include "basefunvotes/votegravity.sp"
15.29 +#include "basefunvotes/voteburn.sp"
15.30 +#include "basefunvotes/voteslay.sp"
15.31 +#include "basefunvotes/votealltalk.sp"
15.32 +#include "basefunvotes/voteff.sp"
15.33 +
15.34 public OnPluginStart()
15.35 {
15.36 LoadTranslations("common.phrases");
15.37 @@ -109,279 +120,71 @@
15.38 g_Cvar_Show = CreateConVar("sm_vote_show", "1", "Show player's votes? Default on.", 0, true, 0.0, true, 1.0);
15.39 }
15.40 */
15.41 -}
15.42 -
15.43 -public Action:Command_VoteGravity(client, args)
15.44 -{
15.45 - if (args < 1)
15.46 - {
15.47 - ReplyToCommand(client, "[SM] Usage: sm_votegravity <amount> [amount2] ... [amount5]");
15.48 - return Plugin_Handled;
15.49 - }
15.50
15.51 - if (IsVoteInProgress())
15.52 - {
15.53 - ReplyToCommand(client, "[SM] %t", "Vote in Progress");
15.54 - return Plugin_Handled;
15.55 - }
15.56 -
15.57 - if (!TestVoteDelay(client))
15.58 - {
15.59 - return Plugin_Handled;
15.60 - }
15.61 -
15.62 - decl String:text[256];
15.63 - GetCmdArgString(text, sizeof(text));
15.64 -
15.65 - decl String:items[5][64];
15.66 - new count;
15.67 - new len, pos;
15.68 -
15.69 - while (pos != -1 && count < 5)
15.70 - {
15.71 - pos = BreakString(text[len], items[count], sizeof(items[]));
15.72 -
15.73 - decl Float:temp;
15.74 - if (StringToFloatEx(items[count], temp) == 0)
15.75 - {
15.76 - ReplyToCommand(client, "[SM] %t", "Invalid Amount");
15.77 - return Plugin_Handled;
15.78 - }
15.79 -
15.80 - count++;
15.81 -
15.82 - if (pos != -1)
15.83 - {
15.84 - len += pos;
15.85 - }
15.86 - }
15.87 -
15.88 - LogAction(client, -1, "\"%L\" initiated a gravity vote.", client);
15.89 - ShowActivity(client, "%t", "Initiated Vote Gravity");
15.90 -
15.91 - g_voteType = voteType:gravity;
15.92 -
15.93 - g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
15.94 -
15.95 - if (count == 1)
15.96 - {
15.97 - strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), items[0]);
15.98 -
15.99 - SetMenuTitle(g_hVoteMenu, "Change Gravity To");
15.100 - AddMenuItem(g_hVoteMenu, items[0], "Yes");
15.101 - AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
15.102 - }
15.103 - else
15.104 + /* Account for late loading */
15.105 + new Handle:topmenu;
15.106 + if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
15.107 {
15.108 - g_voteInfo[VOTE_NAME][0] = '\0';
15.109 -
15.110 - SetMenuTitle(g_hVoteMenu, "Gravity Vote");
15.111 - for (new i = 0; i < count; i++)
15.112 - {
15.113 - AddMenuItem(g_hVoteMenu, items[i], items[i]);
15.114 - }
15.115 - }
15.116 -
15.117 - SetMenuExitButton(g_hVoteMenu, false);
15.118 - VoteMenuToAll(g_hVoteMenu, 20);
15.119 -
15.120 - return Plugin_Handled;
15.121 -}
15.122 -
15.123 -public Action:Command_VoteBurn(client, args)
15.124 -{
15.125 - if (args < 1)
15.126 - {
15.127 - ReplyToCommand(client, "[SM] Usage: sm_voteburn <player>");
15.128 - return Plugin_Handled;
15.129 - }
15.130 -
15.131 - if (IsVoteInProgress())
15.132 - {
15.133 - ReplyToCommand(client, "[SM] %t", "Vote in Progress");
15.134 - return Plugin_Handled;
15.135 - }
15.136 -
15.137 - if (!TestVoteDelay(client))
15.138 - {
15.139 - return Plugin_Handled;
15.140 + OnAdminMenuReady(topmenu);
15.141 }
15.142 -
15.143 - decl String:text[256], String:arg[64];
15.144 - GetCmdArgString(text, sizeof(text));
15.145 -
15.146 - BreakString(text, arg, sizeof(arg));
15.147 -
15.148 - new target = FindTarget(client, arg);
15.149 - if (target == -1)
15.150 - {
15.151 - return Plugin_Handled;
15.152 - }
15.153 -
15.154 - if (!IsPlayerAlive(target))
15.155 - {
15.156 - ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
15.157 - return Plugin_Handled;
15.158 - }
15.159 -
15.160 - g_voteClient[VOTE_CLIENTID] = target;
15.161 - GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
15.162 -
15.163 - LogAction(client, target, "\"%L\" initiated a burn vote against \"%L\"", client, target);
15.164 - ShowActivity(client, "%t", "Initiated Vote Burn", g_voteInfo[VOTE_NAME]);
15.165 -
15.166 - g_voteType = voteType:burn;
15.167 -
15.168 - g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
15.169 - SetMenuTitle(g_hVoteMenu, "Voteburn Player");
15.170 - AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
15.171 - AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
15.172 - SetMenuExitButton(g_hVoteMenu, false);
15.173 - VoteMenuToAll(g_hVoteMenu, 20);
15.174 -
15.175 - return Plugin_Handled;
15.176 }
15.177
15.178 -public Action:Command_VoteSlay(client, args)
15.179 +public OnAdminMenuReady(Handle:topmenu)
15.180 {
15.181 - if (args < 1)
15.182 - {
15.183 - ReplyToCommand(client, "[SM] Usage: sm_voteslay <player>");
15.184 - return Plugin_Handled;
15.185 - }
15.186 -
15.187 - if (IsVoteInProgress())
15.188 - {
15.189 - ReplyToCommand(client, "[SM] %t", "Vote in Progress");
15.190 - return Plugin_Handled;
15.191 - }
15.192 -
15.193 - if (!TestVoteDelay(client))
15.194 - {
15.195 - return Plugin_Handled;
15.196 - }
15.197 -
15.198 - decl String:text[256], String:arg[64];
15.199 - GetCmdArgString(text, sizeof(text));
15.200 -
15.201 - BreakString(text, arg, sizeof(arg));
15.202 -
15.203 - new target = FindTarget(client, arg);
15.204 - if (target == -1)
15.205 + /* Block us from being called twice */
15.206 + if (topmenu == hTopMenu)
15.207 {
15.208 - return Plugin_Handled;
15.209 - }
15.210 -
15.211 - if (!IsPlayerAlive(target))
15.212 - {
15.213 - ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", arg);
15.214 - return Plugin_Handled;
15.215 - }
15.216 -
15.217 - g_voteClient[VOTE_CLIENTID] = target;
15.218 - GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
15.219 -
15.220 - LogAction(client, target, "\"%L\" initiated a slay vote against \"%L\"", client, target);
15.221 - ShowActivity(client, "%t", "Initiated Vote Slay", g_voteInfo[VOTE_NAME]);
15.222 -
15.223 - g_voteType = voteType:slay;
15.224 -
15.225 - g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
15.226 - SetMenuTitle(g_hVoteMenu, "Voteslay Player");
15.227 - AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
15.228 - AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
15.229 - SetMenuExitButton(g_hVoteMenu, false);
15.230 - VoteMenuToAll(g_hVoteMenu, 20);
15.231 -
15.232 - return Plugin_Handled;
15.233 -}
15.234 -
15.235 -public Action:Command_VoteAlltalk(client, args)
15.236 -{
15.237 - if (args > 0)
15.238 - {
15.239 - ReplyToCommand(client, "[SM] Usage: sm_votealltalk");
15.240 - return Plugin_Handled;
15.241 + return;
15.242 }
15.243
15.244 - if (IsVoteInProgress())
15.245 - {
15.246 - ReplyToCommand(client, "[SM] %t", "Vote in Progress");
15.247 - return Plugin_Handled;
15.248 - }
15.249 -
15.250 - if (!TestVoteDelay(client))
15.251 - {
15.252 - return Plugin_Handled;
15.253 - }
15.254 -
15.255 - LogAction(client, -1, "\"%L\" initiated an alltalk vote.", client);
15.256 - ShowActivity(client, "%t", "Initiated Vote Alltalk");
15.257 + /* Save the Handle */
15.258 + hTopMenu = topmenu;
15.259
15.260 - g_voteType = voteType:alltalk;
15.261 - g_voteInfo[VOTE_NAME][0] = '\0';
15.262 -
15.263 - g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
15.264 -
15.265 - if (GetConVarBool(g_Cvar_Alltalk))
15.266 - {
15.267 - SetMenuTitle(g_hVoteMenu, "Votealltalk Off");
15.268 - }
15.269 - else
15.270 - {
15.271 - SetMenuTitle(g_hVoteMenu, "Votealltalk On");
15.272 - }
15.273 -
15.274 - AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
15.275 - AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
15.276 - SetMenuExitButton(g_hVoteMenu, false);
15.277 - VoteMenuToAll(g_hVoteMenu, 20);
15.278 -
15.279 - return Plugin_Handled;
15.280 -}
15.281 + /* Build the "Voting Commands" category */
15.282 + new TopMenuObject:voting_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_VOTINGCOMMANDS);
15.283
15.284 -public Action:Command_VoteFF(client, args)
15.285 -{
15.286 - if (args > 0)
15.287 + if (voting_commands != INVALID_TOPMENUOBJECT)
15.288 {
15.289 - ReplyToCommand(client, "[SM] Usage: sm_voteff");
15.290 - return Plugin_Handled;
15.291 - }
15.292 -
15.293 - if (IsVoteInProgress())
15.294 - {
15.295 - ReplyToCommand(client, "[SM] %t", "Vote in Progress");
15.296 - return Plugin_Handled;
15.297 - }
15.298 -
15.299 - if (!TestVoteDelay(client))
15.300 - {
15.301 - return Plugin_Handled;
15.302 + AddToTopMenu(hTopMenu,
15.303 + "Vote Gravity",
15.304 + TopMenuObject_Item,
15.305 + AdminMenu_VoteGravity,
15.306 + voting_commands,
15.307 + "sm_votegravity",
15.308 + ADMFLAG_VOTE);
15.309 +
15.310 + AddToTopMenu(hTopMenu,
15.311 + "Vote Burn",
15.312 + TopMenuObject_Item,
15.313 + AdminMenu_VoteBurn,
15.314 + voting_commands,
15.315 + "sm_voteburn",
15.316 + ADMFLAG_VOTE|ADMFLAG_SLAY);
15.317 +
15.318 + AddToTopMenu(hTopMenu,
15.319 + "Vote Slay",
15.320 + TopMenuObject_Item,
15.321 + AdminMenu_VoteSlay,
15.322 + voting_commands,
15.323 + "sm_voteslay",
15.324 + ADMFLAG_VOTE|ADMFLAG_SLAY);
15.325 +
15.326 + AddToTopMenu(hTopMenu,
15.327 + "Vote AllTalk",
15.328 + TopMenuObject_Item,
15.329 + AdminMenu_VoteAllTalk,
15.330 + voting_commands,
15.331 + "sm_votealltalk",
15.332 + ADMFLAG_VOTE);
15.333 +
15.334 + AddToTopMenu(hTopMenu,
15.335 + "Vote FF",
15.336 + TopMenuObject_Item,
15.337 + AdminMenu_VoteFF,
15.338 + voting_commands,
15.339 + "sm_voteff",
15.340 + ADMFLAG_VOTE);
15.341 }
15.342 -
15.343 - LogAction(client, -1, "\"%L\" initiated a friendly fire vote.", client);
15.344 - ShowActivity(client, "%t", "Initiated Vote FF");
15.345 -
15.346 - g_voteType = voteType:ff;
15.347 - g_voteInfo[VOTE_NAME][0] = '\0';
15.348 -
15.349 - g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
15.350 -
15.351 - if (GetConVarBool(g_Cvar_Alltalk))
15.352 - {
15.353 - SetMenuTitle(g_hVoteMenu, "Voteff Off");
15.354 - }
15.355 - else
15.356 - {
15.357 - SetMenuTitle(g_hVoteMenu, "Voteff On");
15.358 - }
15.359 -
15.360 - AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
15.361 - AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
15.362 - SetMenuExitButton(g_hVoteMenu, false);
15.363 - VoteMenuToAll(g_hVoteMenu, 20);
15.364 -
15.365 - return Plugin_Handled;
15.366 }
15.367
15.368 public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/plugins/basefunvotes/votealltalk.sp Sat Oct 13 04:43:42 2007 +0000
16.3 @@ -0,0 +1,71 @@
16.4 +DisplayVoteAllTalkMenu(client)
16.5 +{
16.6 + if (IsVoteInProgress())
16.7 + {
16.8 + ReplyToCommand(client, "[SM] %t", "Vote in Progress");
16.9 + return;
16.10 + }
16.11 +
16.12 + if (!TestVoteDelay(client))
16.13 + {
16.14 + return;
16.15 + }
16.16 +
16.17 + LogAction(client, -1, "\"%L\" initiated an alltalk vote.", client);
16.18 + ShowActivity(client, "%t", "Initiated Vote Alltalk");
16.19 +
16.20 + g_voteType = voteType:alltalk;
16.21 + g_voteInfo[VOTE_NAME][0] = '\0';
16.22 +
16.23 + g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
16.24 +
16.25 + if (GetConVarBool(g_Cvar_Alltalk))
16.26 + {
16.27 + SetMenuTitle(g_hVoteMenu, "Votealltalk Off");
16.28 + }
16.29 + else
16.30 + {
16.31 + SetMenuTitle(g_hVoteMenu, "Votealltalk On");
16.32 + }
16.33 +
16.34 + AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
16.35 + AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
16.36 + SetMenuExitButton(g_hVoteMenu, false);
16.37 + VoteMenuToAll(g_hVoteMenu, 20);
16.38 +}
16.39 +
16.40 +
16.41 +public AdminMenu_VoteAllTalk(Handle:topmenu,
16.42 + TopMenuAction:action,
16.43 + TopMenuObject:object_id,
16.44 + param,
16.45 + String:buffer[],
16.46 + maxlength)
16.47 +{
16.48 + if (action == TopMenuAction_DisplayOption)
16.49 + {
16.50 + Format(buffer, maxlength, "%T", "Vote AllTalk", param);
16.51 + }
16.52 + else if (action == TopMenuAction_SelectOption)
16.53 + {
16.54 + DisplayVoteAllTalkMenu(param);
16.55 + }
16.56 + else if (action == TopMenuAction_DrawOption)
16.57 + {
16.58 + /* disable this option if a vote is already running */
16.59 + buffer[0] = IsVoteInProgress() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
16.60 + }
16.61 +}
16.62 +
16.63 +public Action:Command_VoteAlltalk(client, args)
16.64 +{
16.65 + if (args > 0)
16.66 + {
16.67 + ReplyToCommand(client, "[SM] Usage: sm_votealltalk");
16.68 + return Plugin_Handled;
16.69 + }
16.70 +
16.71 + DisplayVoteAllTalkMenu(client);
16.72 +
16.73 + return Plugin_Handled;
16.74 +}
16.75 \ No newline at end of file
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/plugins/basefunvotes/voteburn.sp Sat Oct 13 04:43:42 2007 +0000
17.3 @@ -0,0 +1,130 @@
17.4 +DisplayVoteBurnMenu(client,target,String:name[])
17.5 +{
17.6 + if (!IsPlayerAlive(target))
17.7 + {
17.8 + ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
17.9 + return;
17.10 + }
17.11 +
17.12 + g_voteClient[VOTE_CLIENTID] = target;
17.13 + GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
17.14 +
17.15 + LogAction(client, target, "\"%L\" initiated a burn vote against \"%L\"", client, target);
17.16 + ShowActivity(client, "%t", "Initiated Vote Burn", g_voteInfo[VOTE_NAME]);
17.17 +
17.18 + g_voteType = voteType:burn;
17.19 +
17.20 + g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
17.21 + SetMenuTitle(g_hVoteMenu, "Voteburn Player");
17.22 + AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
17.23 + AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
17.24 + SetMenuExitButton(g_hVoteMenu, false);
17.25 + VoteMenuToAll(g_hVoteMenu, 20);
17.26 +}
17.27 +
17.28 +DisplayBurnTargetMenu(client)
17.29 +{
17.30 + new Handle:menu = CreateMenu(MenuHandler_Burn);
17.31 +
17.32 + decl String:title[100];
17.33 + Format(title, sizeof(title), "%T:", "Vote Burn", client);
17.34 + SetMenuTitle(menu, title);
17.35 + SetMenuExitBackButton(menu, true);
17.36 +
17.37 + AddTargetsToMenu(menu, client, false);
17.38 +
17.39 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
17.40 +}
17.41 +
17.42 +public AdminMenu_VoteBurn(Handle:topmenu,
17.43 + TopMenuAction:action,
17.44 + TopMenuObject:object_id,
17.45 + param,
17.46 + String:buffer[],
17.47 + maxlength)
17.48 +{
17.49 + if (action == TopMenuAction_DisplayOption)
17.50 + {
17.51 + Format(buffer, maxlength, "%T", "Vote Burn", param);
17.52 + }
17.53 + else if (action == TopMenuAction_SelectOption)
17.54 + {
17.55 + DisplayBurnTargetMenu(param);
17.56 + }
17.57 + else if (action == TopMenuAction_DrawOption)
17.58 + {
17.59 + /* disable this option if a vote is already running */
17.60 + buffer[0] = IsVoteInProgress() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
17.61 + }
17.62 +}
17.63 +
17.64 +public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
17.65 +{
17.66 + if (action == MenuAction_End)
17.67 + {
17.68 + CloseHandle(menu);
17.69 + }
17.70 + else if (action == MenuAction_Cancel)
17.71 + {
17.72 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
17.73 + {
17.74 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
17.75 + }
17.76 + }
17.77 + else if (action == MenuAction_Select)
17.78 + {
17.79 + decl String:info[32], String:name[32];
17.80 + new userid, target;
17.81 +
17.82 + GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
17.83 + userid = StringToInt(info);
17.84 +
17.85 + if ((target = GetClientOfUserId(userid)) == 0)
17.86 + {
17.87 + PrintToChat(param1, "[SM] %t", "Player no longer available");
17.88 + }
17.89 + else if (!CanUserTarget(param1, target))
17.90 + {
17.91 + PrintToChat(param1, "[SM] %t", "Unable to target");
17.92 + }
17.93 + else
17.94 + {
17.95 + DisplayVoteBurnMenu(param1, target, name);
17.96 + }
17.97 + }
17.98 +}
17.99 +
17.100 +public Action:Command_VoteBurn(client, args)
17.101 +{
17.102 + if (args < 1)
17.103 + {
17.104 + ReplyToCommand(client, "[SM] Usage: sm_voteburn <player>");
17.105 + return Plugin_Handled;
17.106 + }
17.107 +
17.108 + if (IsVoteInProgress())
17.109 + {
17.110 + ReplyToCommand(client, "[SM] %t", "Vote in Progress");
17.111 + return Plugin_Handled;
17.112 + }
17.113 +
17.114 + if (!TestVoteDelay(client))
17.115 + {
17.116 + return Plugin_Handled;
17.117 + }
17.118 +
17.119 + decl String:text[256], String:arg[64];
17.120 + GetCmdArgString(text, sizeof(text));
17.121 +
17.122 + BreakString(text, arg, sizeof(arg));
17.123 +
17.124 + new target = FindTarget(client, arg);
17.125 + if (target == -1)
17.126 + {
17.127 + return Plugin_Handled;
17.128 + }
17.129 +
17.130 + DisplayVoteBurnMenu(client, target, arg);
17.131 +
17.132 + return Plugin_Handled;
17.133 +}
17.134 \ No newline at end of file
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
18.2 +++ b/plugins/basefunvotes/voteff.sp Sat Oct 13 04:43:42 2007 +0000
18.3 @@ -0,0 +1,70 @@
18.4 +DisplayVoteFFMenu(client)
18.5 +{
18.6 + if (IsVoteInProgress())
18.7 + {
18.8 + ReplyToCommand(client, "[SM] %t", "Vote in Progress");
18.9 + return;
18.10 + }
18.11 +
18.12 + if (!TestVoteDelay(client))
18.13 + {
18.14 + return;
18.15 + }
18.16 +
18.17 + LogAction(client, -1, "\"%L\" initiated a friendly fire vote.", client);
18.18 + ShowActivity(client, "%t", "Initiated Vote FF");
18.19 +
18.20 + g_voteType = voteType:ff;
18.21 + g_voteInfo[VOTE_NAME][0] = '\0';
18.22 +
18.23 + g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
18.24 +
18.25 + if (GetConVarBool(g_Cvar_Alltalk))
18.26 + {
18.27 + SetMenuTitle(g_hVoteMenu, "Voteff Off");
18.28 + }
18.29 + else
18.30 + {
18.31 + SetMenuTitle(g_hVoteMenu, "Voteff On");
18.32 + }
18.33 +
18.34 + AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
18.35 + AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
18.36 + SetMenuExitButton(g_hVoteMenu, false);
18.37 + VoteMenuToAll(g_hVoteMenu, 20);
18.38 +}
18.39 +
18.40 +public AdminMenu_VoteFF(Handle:topmenu,
18.41 + TopMenuAction:action,
18.42 + TopMenuObject:object_id,
18.43 + param,
18.44 + String:buffer[],
18.45 + maxlength)
18.46 +{
18.47 + if (action == TopMenuAction_DisplayOption)
18.48 + {
18.49 + Format(buffer, maxlength, "%T", "Vote FF", param);
18.50 + }
18.51 + else if (action == TopMenuAction_SelectOption)
18.52 + {
18.53 + DisplayVoteFFMenu(param);
18.54 + }
18.55 + else if (action == TopMenuAction_DrawOption)
18.56 + {
18.57 + /* disable this option if a vote is already running */
18.58 + buffer[0] = IsVoteInProgress() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
18.59 + }
18.60 +}
18.61 +
18.62 +public Action:Command_VoteFF(client, args)
18.63 +{
18.64 + if (args > 0)
18.65 + {
18.66 + ReplyToCommand(client, "[SM] Usage: sm_voteff");
18.67 + return Plugin_Handled;
18.68 + }
18.69 +
18.70 + DisplayVoteFFMenu(client);
18.71 +
18.72 + return Plugin_Handled;
18.73 +}
18.74 \ No newline at end of file
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
19.2 +++ b/plugins/basefunvotes/votegravity.sp Sat Oct 13 04:43:42 2007 +0000
19.3 @@ -0,0 +1,106 @@
19.4 +
19.5 +DisplayVoteGravityMenu(client,count,String:items[5][])
19.6 +{
19.7 + LogAction(client, -1, "\"%L\" initiated a gravity vote.", client);
19.8 + ShowActivity(client, "%t", "Initiated Vote Gravity");
19.9 +
19.10 + g_voteType = voteType:gravity;
19.11 +
19.12 + g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
19.13 +
19.14 + if (count == 1)
19.15 + {
19.16 + strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), items[0]);
19.17 +
19.18 + SetMenuTitle(g_hVoteMenu, "Change Gravity To");
19.19 + AddMenuItem(g_hVoteMenu, items[0], "Yes");
19.20 + AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
19.21 + }
19.22 + else
19.23 + {
19.24 + g_voteInfo[VOTE_NAME][0] = '\0';
19.25 +
19.26 + SetMenuTitle(g_hVoteMenu, "Gravity Vote");
19.27 + for (new i = 0; i < count; i++)
19.28 + {
19.29 + AddMenuItem(g_hVoteMenu, items[i], items[i]);
19.30 + }
19.31 + }
19.32 +
19.33 + SetMenuExitButton(g_hVoteMenu, false);
19.34 + VoteMenuToAll(g_hVoteMenu, 20);
19.35 +}
19.36 +
19.37 +public AdminMenu_VoteGravity(Handle:topmenu,
19.38 + TopMenuAction:action,
19.39 + TopMenuObject:object_id,
19.40 + param,
19.41 + String:buffer[],
19.42 + maxlength)
19.43 +{
19.44 + if (action == TopMenuAction_DisplayOption)
19.45 + {
19.46 + Format(buffer, maxlength, "%T", "Vote Gravity", param);
19.47 + }
19.48 + else if (action == TopMenuAction_SelectOption)
19.49 + {
19.50 + /* Might need a better way of selecting the list of pre-defined gravity choices */
19.51 + new String:items[5][5] ={"200","400","800","1600","3200"};
19.52 + DisplayVoteGravityMenu(param,5, items);
19.53 + }
19.54 + else if (action == TopMenuAction_DrawOption)
19.55 + {
19.56 + /* disable this option if a vote is already running */
19.57 + buffer[0] = IsVoteInProgress() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
19.58 + }
19.59 +}
19.60 +
19.61 +public Action:Command_VoteGravity(client, args)
19.62 +{
19.63 + if (args < 1)
19.64 + {
19.65 + ReplyToCommand(client, "[SM] Usage: sm_votegravity <amount> [amount2] ... [amount5]");
19.66 + return Plugin_Handled;
19.67 + }
19.68 +
19.69 + if (IsVoteInProgress())
19.70 + {
19.71 + ReplyToCommand(client, "[SM] %t", "Vote in Progress");
19.72 + return Plugin_Handled;
19.73 + }
19.74 +
19.75 + if (!TestVoteDelay(client))
19.76 + {
19.77 + return Plugin_Handled;
19.78 + }
19.79 +
19.80 + decl String:text[256];
19.81 + GetCmdArgString(text, sizeof(text));
19.82 +
19.83 + decl String:items[5][64];
19.84 + new count;
19.85 + new len, pos;
19.86 +
19.87 + while (pos != -1 && count < 5)
19.88 + {
19.89 + pos = BreakString(text[len], items[count], sizeof(items[]));
19.90 +
19.91 + decl Float:temp;
19.92 + if (StringToFloatEx(items[count], temp) == 0)
19.93 + {
19.94 + ReplyToCommand(client, "[SM] %t", "Invalid Amount");
19.95 + return Plugin_Handled;
19.96 + }
19.97 +
19.98 + count++;
19.99 +
19.100 + if (pos != -1)
19.101 + {
19.102 + len += pos;
19.103 + }
19.104 + }
19.105 +
19.106 + DisplayVoteGravityMenu(client, count, items);
19.107 +
19.108 + return Plugin_Handled;
19.109 +}
19.110 \ No newline at end of file
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
21.2 +++ b/plugins/basefunvotes/voteslay.sp Sat Oct 13 04:43:42 2007 +0000
21.3 @@ -0,0 +1,131 @@
21.4 +
21.5 +DisplayVoteSlayMenu(client,target,String:name[])
21.6 +{
21.7 + if (!IsPlayerAlive(target))
21.8 + {
21.9 + ReplyToCommand(client, "[SM] %t", "Cannot performed on dead", name);
21.10 + return;
21.11 + }
21.12 +
21.13 + g_voteClient[VOTE_CLIENTID] = target;
21.14 + GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
21.15 +
21.16 + LogAction(client, target, "\"%L\" initiated a slay vote against \"%L\"", client, target);
21.17 + ShowActivity(client, "%t", "Initiated Vote Slay", g_voteInfo[VOTE_NAME]);
21.18 +
21.19 + g_voteType = voteType:slay;
21.20 +
21.21 + g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
21.22 + SetMenuTitle(g_hVoteMenu, "Voteslay Player");
21.23 + AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
21.24 + AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
21.25 + SetMenuExitButton(g_hVoteMenu, false);
21.26 + VoteMenuToAll(g_hVoteMenu, 20);
21.27 +}
21.28 +
21.29 +DisplaySlayTargetMenu(client)
21.30 +{
21.31 + new Handle:menu = CreateMenu(MenuHandler_Slay);
21.32 +
21.33 + decl String:title[100];
21.34 + Format(title, sizeof(title), "%T:", "Vote Slay", client);
21.35 + SetMenuTitle(menu, title);
21.36 + SetMenuExitBackButton(menu, true);
21.37 +
21.38 + AddTargetsToMenu(menu, client, false);
21.39 +
21.40 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
21.41 +}
21.42 +
21.43 +public AdminMenu_VoteSlay(Handle:topmenu,
21.44 + TopMenuAction:action,
21.45 + TopMenuObject:object_id,
21.46 + param,
21.47 + String:buffer[],
21.48 + maxlength)
21.49 +{
21.50 + if (action == TopMenuAction_DisplayOption)
21.51 + {
21.52 + Format(buffer, maxlength, "%T", "Vote Slay", param);
21.53 + }
21.54 + else if (action == TopMenuAction_SelectOption)
21.55 + {
21.56 + DisplaySlayTargetMenu(param);
21.57 + }
21.58 + else if (action == TopMenuAction_DrawOption)
21.59 + {
21.60 + /* disable this option if a vote is already running */
21.61 + buffer[0] = IsVoteInProgress() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
21.62 + }
21.63 +}
21.64 +
21.65 +public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
21.66 +{
21.67 + if (action == MenuAction_End)
21.68 + {
21.69 + CloseHandle(menu);
21.70 + }
21.71 + else if (action == MenuAction_Cancel)
21.72 + {
21.73 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
21.74 + {
21.75 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
21.76 + }
21.77 + }
21.78 + else if (action == MenuAction_Select)
21.79 + {
21.80 + decl String:info[32], String:name[32];
21.81 + new userid, target;
21.82 +
21.83 + GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
21.84 + userid = StringToInt(info);
21.85 +
21.86 + if ((target = GetClientOfUserId(userid)) == 0)
21.87 + {
21.88 + PrintToChat(param1, "[SM] %t", "Player no longer available");
21.89 + }
21.90 + else if (!CanUserTarget(param1, target))
21.91 + {
21.92 + PrintToChat(param1, "[SM] %t", "Unable to target");
21.93 + }
21.94 + else
21.95 + {
21.96 + DisplayVoteSlayMenu(param1, target, name);
21.97 + }
21.98 + }
21.99 +}
21.100 +
21.101 +public Action:Command_VoteSlay(client, args)
21.102 +{
21.103 + if (args < 1)
21.104 + {
21.105 + ReplyToCommand(client, "[SM] Usage: sm_voteslay <player>");
21.106 + return Plugin_Handled;
21.107 + }
21.108 +
21.109 + if (IsVoteInProgress())
21.110 + {
21.111 + ReplyToCommand(client, "[SM] %t", "Vote in Progress");
21.112 + return Plugin_Handled;
21.113 + }
21.114 +
21.115 + if (!TestVoteDelay(client))
21.116 + {
21.117 + return Plugin_Handled;
21.118 + }
21.119 +
21.120 + decl String:text[256], String:arg[64];
21.121 + GetCmdArgString(text, sizeof(text));
21.122 +
21.123 + BreakString(text, arg, sizeof(arg));
21.124 +
21.125 + new target = FindTarget(client, arg);
21.126 + if (target == -1)
21.127 + {
21.128 + return Plugin_Handled;
21.129 + }
21.130 +
21.131 + DisplayVoteSlayMenu(client, target, arg);
21.132 +
21.133 + return Plugin_Handled;
21.134 +}
21.135 \ No newline at end of file
22.1 --- a/plugins/basevotes.sp Mon Oct 08 22:13:49 2007 +0000
22.2 +++ b/plugins/basevotes.sp Sat Oct 13 04:43:42 2007 +0000
22.3 @@ -34,6 +34,8 @@
22.4 #pragma semicolon 1
22.5
22.6 #include <sourcemod>
22.7 +#undef REQUIRE_PLUGIN
22.8 +#include <adminmenu>
22.9
22.10 public Plugin:myinfo =
22.11 {
22.12 @@ -79,6 +81,21 @@
22.13 new String:g_voteArg[256]; /* Used to hold ban/kick reasons or vote questions */
22.14
22.15
22.16 +new Handle:hTopMenu = INVALID_HANDLE;
22.17 +
22.18 +new Handle:g_MapList = INVALID_HANDLE;
22.19 +new g_mapFileTime;
22.20 +new g_mapCount;
22.21 +
22.22 +new Handle:g_SelectedMaps;
22.23 +new g_SelectedCount;
22.24 +
22.25 +new bool:g_VoteMapInUse;
22.26 +
22.27 +#include "basevotes/votekick.sp"
22.28 +#include "basevotes/voteban.sp"
22.29 +#include "basevotes/votemap.sp"
22.30 +
22.31 public OnPluginStart()
22.32 {
22.33 LoadTranslations("common.phrases");
22.34 @@ -102,82 +119,66 @@
22.35 g_Cvar_Limits[2] = CreateConVar("sm_vote_ban", "0.60", "percent required for successful ban vote.", 0, true, 0.05, true, 1.0);
22.36
22.37 g_hBanForward = CreateGlobalForward("OnClientBanned", ET_Ignore, Param_Cell, Param_Cell, Param_Cell, Param_String);
22.38 -}
22.39 -
22.40 -public Action:Command_Votemap(client, args)
22.41 -{
22.42 - if (args < 1)
22.43 +
22.44 + /* Account for late loading */
22.45 + new Handle:topmenu;
22.46 + if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
22.47 {
22.48 - ReplyToCommand(client, "[SM] Usage: sm_votemap <mapname> [mapname2] ... [mapname5]");
22.49 - return Plugin_Handled;
22.50 + OnAdminMenuReady(topmenu);
22.51 }
22.52
22.53 - if (IsVoteInProgress())
22.54 + g_SelectedMaps = CreateArray(33);
22.55 +
22.56 + g_MapList = CreateMenu(MenuHandler_Map);
22.57 + SetMenuTitle(g_MapList, "Please select a map");
22.58 + SetMenuExitBackButton(g_MapList, true);
22.59 +}
22.60 +
22.61 +public OnMapStart()
22.62 +{
22.63 + g_mapCount = LoadMaps(g_MapList);
22.64 +}
22.65 +
22.66 +public OnAdminMenuReady(Handle:topmenu)
22.67 +{
22.68 + /* Block us from being called twice */
22.69 + if (topmenu == hTopMenu)
22.70 {
22.71 - ReplyToCommand(client, "[SM] %t", "Vote in Progress");
22.72 - return Plugin_Handled;
22.73 - }
22.74 -
22.75 - if (!TestVoteDelay(client))
22.76 - {
22.77 - return Plugin_Handled;
22.78 + return;
22.79 }
22.80
22.81 - decl String:text[256];
22.82 - GetCmdArgString(text, sizeof(text));
22.83 -
22.84 - decl String:maps[5][64];
22.85 - new mapCount;
22.86 - new len, pos;
22.87 -
22.88 - while (pos != -1 && mapCount < 5)
22.89 - {
22.90 - pos = BreakString(text[len], maps[mapCount], sizeof(maps[]));
22.91 -
22.92 - if (!IsMapValid(maps[mapCount]))
22.93 - {
22.94 - ReplyToCommand(client, "[SM] %t", "Map was not found", maps[mapCount]);
22.95 - return Plugin_Handled;
22.96 - }
22.97 -
22.98 - mapCount++;
22.99 -
22.100 - if (pos != -1)
22.101 - {
22.102 - len += pos;
22.103 - }
22.104 - }
22.105 -
22.106 - LogAction(client, -1, "\"%L\" initiated a map vote.", client);
22.107 - ShowActivity(client, "%t", "Initiated Vote Map");
22.108 + /* Save the Handle */
22.109 + hTopMenu = topmenu;
22.110
22.111 - g_voteType = voteType:map;
22.112 -
22.113 - g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
22.114 -
22.115 - if (mapCount == 1)
22.116 - {
22.117 - strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), maps[0]);
22.118 -
22.119 - SetMenuTitle(g_hVoteMenu, "Change Map To");
22.120 - AddMenuItem(g_hVoteMenu, maps[0], "Yes");
22.121 - AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
22.122 - }
22.123 - else
22.124 + /* Build the "Voting Commands" category */
22.125 + new TopMenuObject:voting_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_VOTINGCOMMANDS);
22.126 +
22.127 + if (voting_commands != INVALID_TOPMENUOBJECT)
22.128 {
22.129 - g_voteInfo[VOTE_NAME][0] = '\0';
22.130 -
22.131 - SetMenuTitle(g_hVoteMenu, "Map Vote");
22.132 - for (new i = 0; i < mapCount; i++)
22.133 - {
22.134 - AddMenuItem(g_hVoteMenu, maps[i], maps[i]);
22.135 - }
22.136 + AddToTopMenu(hTopMenu,
22.137 + "Vote Kick",
22.138 + TopMenuObject_Item,
22.139 + AdminMenu_VoteKick,
22.140 + voting_commands,
22.141 + "sm_votekick",
22.142 + ADMFLAG_VOTE|ADMFLAG_KICK);
22.143 +
22.144 + AddToTopMenu(hTopMenu,
22.145 + "Vote Ban",
22.146 + TopMenuObject_Item,
22.147 + AdminMenu_VoteBan,
22.148 + voting_commands,
22.149 + "sm_voteban",
22.150 + ADMFLAG_VOTE|ADMFLAG_BAN);
22.151 +
22.152 + AddToTopMenu(hTopMenu,
22.153 + "Vote Map",
22.154 + TopMenuObject_Item,
22.155 + AdminMenu_VoteMap,
22.156 + voting_commands,
22.157 + "sm_votemap",
22.158 + ADMFLAG_VOTE|ADMFLAG_CHANGEMAP);
22.159 }
22.160 -
22.161 - SetMenuExitButton(g_hVoteMenu, false);
22.162 - VoteMenuToAll(g_hVoteMenu, 20);
22.163 -
22.164 - return Plugin_Handled;
22.165 }
22.166
22.167 public Action:Command_Vote(client, args)
22.168 @@ -245,126 +246,6 @@
22.169 return Plugin_Handled;
22.170 }
22.171
22.172 -public Action:Command_Votekick(client, args)
22.173 -{
22.174 - if (args < 1)
22.175 - {
22.176 - ReplyToCommand(client, "[SM] Usage: sm_votekick <player> [reason]");
22.177 - return Plugin_Handled;
22.178 - }
22.179 -
22.180 - if (IsVoteInProgress())
22.181 - {
22.182 - ReplyToCommand(client, "[SM] %t", "Vote in Progress");
22.183 - return Plugin_Handled;
22.184 - }
22.185 -
22.186 - if (!TestVoteDelay(client))
22.187 - {
22.188 - return Plugin_Handled;
22.189 - }
22.190 -
22.191 - decl String:text[256], String:arg[64];
22.192 - GetCmdArgString(text, sizeof(text));
22.193 -
22.194 - new len = BreakString(text, arg, sizeof(arg));
22.195 -
22.196 - new target = FindTarget(client, arg);
22.197 - if (target == -1)
22.198 - {
22.199 - return Plugin_Handled;
22.200 - }
22.201 -
22.202 - if (len != -1)
22.203 - {
22.204 - strcopy(g_voteArg, sizeof(g_voteArg), text[len]);
22.205 - }
22.206 - else
22.207 - {
22.208 - g_voteArg[0] = '\0';
22.209 - }
22.210 -
22.211 - g_voteClient[VOTE_CLIENTID] = target;
22.212 - g_voteClient[VOTE_USERID] = GetClientUserId(target);
22.213 -
22.214 - GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
22.215 -
22.216 - LogAction(client, target, "\"%L\" initiated a kick vote against \"%L\"", client, target);
22.217 - ShowActivity(client, "%t", "Initiated Vote Kick", g_voteInfo[VOTE_NAME]);
22.218 -
22.219 - g_voteType = voteType:kick;
22.220 -
22.221 - g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
22.222 - SetMenuTitle(g_hVoteMenu, "Votekick Player");
22.223 - AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
22.224 - AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
22.225 - SetMenuExitButton(g_hVoteMenu, false);
22.226 - VoteMenuToAll(g_hVoteMenu, 20);
22.227 -
22.228 - return Plugin_Handled;
22.229 -}
22.230 -
22.231 -public Action:Command_Voteban(client, args)
22.232 -{
22.233 - if (args < 1)
22.234 - {
22.235 - ReplyToCommand(client, "[SM] Usage: sm_voteban <player> [reason]");
22.236 - return Plugin_Handled;
22.237 - }
22.238 -
22.239 - if (IsVoteInProgress())
22.240 - {
22.241 - ReplyToCommand(client, "[SM] %t", "Vote in Progress");
22.242 - return Plugin_Handled;
22.243 - }
22.244 -
22.245 - if (!TestVoteDelay(client))
22.246 - {
22.247 - return Plugin_Handled;
22.248 - }
22.249 -
22.250 - decl String:text[256], String:arg[64];
22.251 - GetCmdArgString(text, sizeof(text));
22.252 -
22.253 - new len = BreakString(text, arg, sizeof(arg));
22.254 -
22.255 - new target = FindTarget(client, arg);
22.256 - if (target == -1)
22.257 - {
22.258 - return Plugin_Handled;
22.259 - }
22.260 -
22.261 - if (len != -1)
22.262 - {
22.263 - strcopy(g_voteArg, sizeof(g_voteArg), text[len]);
22.264 - }
22.265 - else
22.266 - {
22.267 - g_voteArg[0] = '\0';
22.268 - }
22.269 -
22.270 - g_voteClient[VOTE_CLIENTID] = target;
22.271 - g_voteClient[VOTE_USERID] = GetClientUserId(target);
22.272 -
22.273 - GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
22.274 - GetClientAuthString(target, g_voteInfo[VOTE_AUTHID], sizeof(g_voteInfo[]));
22.275 - GetClientIP(target, g_voteInfo[VOTE_IP], sizeof(g_voteInfo[]));
22.276 -
22.277 - LogAction(client, target, "\"%L\" initiated a ban vote against \"%L\"", client, target);
22.278 - ShowActivity(client, "%t", "Initiated Vote Ban", g_voteInfo[VOTE_NAME]);
22.279 -
22.280 - g_voteType = voteType:ban;
22.281 -
22.282 - g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
22.283 - SetMenuTitle(g_hVoteMenu, "Voteban Player");
22.284 - AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
22.285 - AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
22.286 - SetMenuExitButton(g_hVoteMenu, false);
22.287 - VoteMenuToAll(g_hVoteMenu, 20);
22.288 -
22.289 - return Plugin_Handled;
22.290 -}
22.291 -
22.292 public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
22.293 {
22.294 if (action == MenuAction_End)
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
23.2 +++ b/plugins/basevotes/voteban.sp Sat Oct 13 04:43:42 2007 +0000
23.3 @@ -0,0 +1,139 @@
23.4 +
23.5 +DisplayVoteBanMenu(client, target)
23.6 +{
23.7 + g_voteClient[VOTE_CLIENTID] = target;
23.8 + g_voteClient[VOTE_USERID] = GetClientUserId(target);
23.9 +
23.10 + GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
23.11 + GetClientAuthString(target, g_voteInfo[VOTE_AUTHID], sizeof(g_voteInfo[]));
23.12 + GetClientIP(target, g_voteInfo[VOTE_IP], sizeof(g_voteInfo[]));
23.13 +
23.14 + LogAction(client, target, "\"%L\" initiated a ban vote against \"%L\"", client, target);
23.15 + ShowActivity(client, "%t", "Initiated Vote Ban", g_voteInfo[VOTE_NAME]);
23.16 +
23.17 + g_voteType = voteType:ban;
23.18 +
23.19 + g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
23.20 + SetMenuTitle(g_hVoteMenu, "Voteban Player");
23.21 + AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
23.22 + AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
23.23 + SetMenuExitButton(g_hVoteMenu, false);
23.24 + VoteMenuToAll(g_hVoteMenu, 20);
23.25 +}
23.26 +
23.27 +DisplayBanTargetMenu(client)
23.28 +{
23.29 + new Handle:menu = CreateMenu(MenuHandler_Ban);
23.30 +
23.31 + decl String:title[100];
23.32 + Format(title, sizeof(title), "%T:", "Vote Ban", client);
23.33 + SetMenuTitle(menu, title);
23.34 + SetMenuExitBackButton(menu, true);
23.35 +
23.36 + AddTargetsToMenu(menu, client, false);
23.37 +
23.38 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
23.39 +}
23.40 +
23.41 +public AdminMenu_VoteBan(Handle:topmenu,
23.42 + TopMenuAction:action,
23.43 + TopMenuObject:object_id,
23.44 + param,
23.45 + String:buffer[],
23.46 + maxlength)
23.47 +{
23.48 + if (action == TopMenuAction_DisplayOption)
23.49 + {
23.50 + Format(buffer, maxlength, "%T", "Vote Ban", param);
23.51 + }
23.52 + else if (action == TopMenuAction_SelectOption)
23.53 + {
23.54 + DisplayBanTargetMenu(param);
23.55 + }
23.56 + else if (action == TopMenuAction_DrawOption)
23.57 + {
23.58 + /* disable this option if a vote is already running */
23.59 + buffer[0] = IsVoteInProgress() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
23.60 + }
23.61 +}
23.62 +
23.63 +public MenuHandler_Ban(Handle:menu, MenuAction:action, param1, param2)
23.64 +{
23.65 + if (action == MenuAction_End)
23.66 + {
23.67 + CloseHandle(menu);
23.68 + }
23.69 + else if (action == MenuAction_Cancel)
23.70 + {
23.71 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
23.72 + {
23.73 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
23.74 + }
23.75 + }
23.76 + else if (action == MenuAction_Select)
23.77 + {
23.78 + decl String:info[32], String:name[32];
23.79 + new userid, target;
23.80 +
23.81 + GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
23.82 + userid = StringToInt(info);
23.83 +
23.84 + if ((target = GetClientOfUserId(userid)) == 0)
23.85 + {
23.86 + PrintToChat(param1, "[SM] %t", "Player no longer available");
23.87 + }
23.88 + else if (!CanUserTarget(param1, target))
23.89 + {
23.90 + PrintToChat(param1, "[SM] %t", "Unable to target");
23.91 + }
23.92 + else
23.93 + {
23.94 + g_voteArg[0] = '\0';
23.95 + DisplayVoteBanMenu(param1, target);
23.96 + }
23.97 + }
23.98 +}
23.99 +
23.100 +public Action:Command_Voteban(client, args)
23.101 +{
23.102 + if (args < 1)
23.103 + {
23.104 + ReplyToCommand(client, "[SM] Usage: sm_voteban <player> [reason]");
23.105 + return Plugin_Handled;
23.106 + }
23.107 +
23.108 + if (IsVoteInProgress())
23.109 + {
23.110 + ReplyToCommand(client, "[SM] %t", "Vote in Progress");
23.111 + return Plugin_Handled;
23.112 + }
23.113 +
23.114 + if (!TestVoteDelay(client))
23.115 + {
23.116 + return Plugin_Handled;
23.117 + }
23.118 +
23.119 + decl String:text[256], String:arg[64];
23.120 + GetCmdArgString(text, sizeof(text));
23.121 +
23.122 + new len = BreakString(text, arg, sizeof(arg));
23.123 +
23.124 + new target = FindTarget(client, arg);
23.125 + if (target == -1)
23.126 + {
23.127 + return Plugin_Handled;
23.128 + }
23.129 +
23.130 + if (len != -1)
23.131 + {
23.132 + strcopy(g_voteArg, sizeof(g_voteArg), text[len]);
23.133 + }
23.134 + else
23.135 + {
23.136 + g_voteArg[0] = '\0';
23.137 + }
23.138 +
23.139 + DisplayVoteBanMenu(client, target);
23.140 +
23.141 + return Plugin_Handled;
23.142 +}
23.143 \ No newline at end of file
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
24.2 +++ b/plugins/basevotes/votekick.sp Sat Oct 13 04:43:42 2007 +0000
24.3 @@ -0,0 +1,138 @@
24.4 +
24.5 +DisplayVoteKickMenu(client, target)
24.6 +{
24.7 + g_voteClient[VOTE_CLIENTID] = target;
24.8 + g_voteClient[VOTE_USERID] = GetClientUserId(target);
24.9 +
24.10 + GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
24.11 +
24.12 + LogAction(client, target, "\"%L\" initiated a kick vote against \"%L\"", client, target);
24.13 + ShowActivity(client, "%t", "Initiated Vote Kick", g_voteInfo[VOTE_NAME]);
24.14 +
24.15 + g_voteType = voteType:kick;
24.16 +
24.17 + g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
24.18 + SetMenuTitle(g_hVoteMenu, "Votekick Player");
24.19 + AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
24.20 + AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
24.21 + SetMenuExitButton(g_hVoteMenu, false);
24.22 + VoteMenuToAll(g_hVoteMenu, 20);
24.23 +
24.24 +}
24.25 +
24.26 +DisplayKickTargetMenu(client)
24.27 +{
24.28 + new Handle:menu = CreateMenu(MenuHandler_Kick);
24.29 +
24.30 + decl String:title[100];
24.31 + Format(title, sizeof(title), "%T:", "Vote Kick", client);
24.32 + SetMenuTitle(menu, title);
24.33 + SetMenuExitBackButton(menu, true);
24.34 +
24.35 + AddTargetsToMenu(menu, client, false);
24.36 +
24.37 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
24.38 +}
24.39 +
24.40 +public AdminMenu_VoteKick(Handle:topmenu,
24.41 + TopMenuAction:action,
24.42 + TopMenuObject:object_id,
24.43 + param,
24.44 + String:buffer[],
24.45 + maxlength)
24.46 +{
24.47 + if (action == TopMenuAction_DisplayOption)
24.48 + {
24.49 + Format(buffer, maxlength, "%T", "Vote Kick", param);
24.50 + }
24.51 + else if (action == TopMenuAction_SelectOption)
24.52 + {
24.53 + DisplayKickTargetMenu(param);
24.54 + }
24.55 + else if (action == TopMenuAction_DrawOption)
24.56 + {
24.57 + /* disable this option if a vote is already running */
24.58 + buffer[0] = IsVoteInProgress() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
24.59 + }
24.60 +}
24.61 +
24.62 +public MenuHandler_Kick(Handle:menu, MenuAction:action, param1, param2)
24.63 +{
24.64 + if (action == MenuAction_End)
24.65 + {
24.66 + CloseHandle(menu);
24.67 + }
24.68 + else if (action == MenuAction_Cancel)
24.69 + {
24.70 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
24.71 + {
24.72 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
24.73 + }
24.74 + }
24.75 + else if (action == MenuAction_Select)
24.76 + {
24.77 + decl String:info[32], String:name[32];
24.78 + new userid, target;
24.79 +
24.80 + GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
24.81 + userid = StringToInt(info);
24.82 +
24.83 + if ((target = GetClientOfUserId(userid)) == 0)
24.84 + {
24.85 + PrintToChat(param1, "[SM] %t", "Player no longer available");
24.86 + }
24.87 + else if (!CanUserTarget(param1, target))
24.88 + {
24.89 + PrintToChat(param1, "[SM] %t", "Unable to target");
24.90 + }
24.91 + else
24.92 + {
24.93 + g_voteArg[0] = '\0';
24.94 + DisplayVoteKickMenu(param1, target);
24.95 + }
24.96 + }
24.97 +}
24.98 +
24.99 +public Action:Command_Votekick(client, args)
24.100 +{
24.101 + if (args < 1)
24.102 + {
24.103 + ReplyToCommand(client, "[SM] Usage: sm_votekick <player> [reason]");
24.104 + return Plugin_Handled;
24.105 + }
24.106 +
24.107 + if (IsVoteInProgress())
24.108 + {
24.109 + ReplyToCommand(client, "[SM] %t", "Vote in Progress");
24.110 + return Plugin_Handled;
24.111 + }
24.112 +
24.113 + if (!TestVoteDelay(client))
24.114 + {
24.115 + return Plugin_Handled;
24.116 + }
24.117 +
24.118 + decl String:text[256], String:arg[64];
24.119 + GetCmdArgString(text, sizeof(text));
24.120 +
24.121 + new len = BreakString(text, arg, sizeof(arg));
24.122 +
24.123 + new target = FindTarget(client, arg);
24.124 + if (target == -1)
24.125 + {
24.126 + return Plugin_Handled;
24.127 + }
24.128 +
24.129 + if (len != -1)
24.130 + {
24.131 + strcopy(g_voteArg, sizeof(g_voteArg), text[len]);
24.132 + }
24.133 + else
24.134 + {
24.135 + g_voteArg[0] = '\0';
24.136 + }
24.137 +
24.138 + DisplayVoteKickMenu(client, target);
24.139 +
24.140 + return Plugin_Handled;
24.141 +}
24.142 \ No newline at end of file
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
25.2 +++ b/plugins/basevotes/votemap.sp Sat Oct 13 04:43:42 2007 +0000
25.3 @@ -0,0 +1,262 @@
25.4 +
25.5 +DisplayVoteMapMenu(client, mapCount, String:maps[5][])
25.6 +{
25.7 + LogAction(client, -1, "\"%L\" initiated a map vote.", client);
25.8 + ShowActivity(client, "%t", "Initiated Vote Map");
25.9 +
25.10 + g_voteType = voteType:map;
25.11 +
25.12 + g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
25.13 +
25.14 + if (mapCount == 1)
25.15 + {
25.16 + strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), maps[0]);
25.17 +
25.18 + SetMenuTitle(g_hVoteMenu, "Change Map To");
25.19 + AddMenuItem(g_hVoteMenu, maps[0], "Yes");
25.20 + AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
25.21 + }
25.22 + else
25.23 + {
25.24 + g_voteInfo[VOTE_NAME][0] = '\0';
25.25 +
25.26 + SetMenuTitle(g_hVoteMenu, "Map Vote");
25.27 + for (new i = 0; i < mapCount; i++)
25.28 + {
25.29 + AddMenuItem(g_hVoteMenu, maps[i], maps[i]);
25.30 + }
25.31 + }
25.32 +
25.33 + SetMenuExitButton(g_hVoteMenu, false);
25.34 + VoteMenuToAll(g_hVoteMenu, 20);
25.35 +}
25.36 +
25.37 +ConfirmVote(client)
25.38 +{
25.39 + new Handle:menu = CreateMenu(MenuHandler_Confirm);
25.40 +
25.41 + decl String:title[100];
25.42 + Format(title, sizeof(title), "%T:", "Confirm Vote", client);
25.43 + SetMenuTitle(menu, title);
25.44 + SetMenuExitBackButton(menu, true);
25.45 +
25.46 + AddMenuItem(menu, "Confirm", "Start the Vote");
25.47 +
25.48 + DisplayMenu(menu, client, MENU_TIME_FOREVER);
25.49 +}
25.50 +
25.51 +public MenuHandler_Confirm(Handle:menu, MenuAction:action, param1, param2)
25.52 +{
25.53 + if (action == MenuAction_End)
25.54 + {
25.55 + CloseHandle(menu);
25.56 + }
25.57 + else if (action == MenuAction_Cancel)
25.58 + {
25.59 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
25.60 + {
25.61 + DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
25.62 + }
25.63 + }
25.64 + else if (action == MenuAction_Select)
25.65 + {
25.66 + decl String:maps[5][64];
25.67 + new selectedmaps = GetArraySize(g_SelectedMaps);
25.68 +
25.69 + for (new i=0; i<selectedmaps; i++)
25.70 + {
25.71 + GetArrayString(g_SelectedMaps, i, maps[i], sizeof(maps[]));
25.72 + }
25.73 +
25.74 + DisplayVoteMapMenu(param1, selectedmaps, maps);
25.75 +
25.76 + /* Re-enable the menu option */
25.77 + g_VoteMapInUse = false;
25.78 + }
25.79 +}
25.80 +
25.81 +public MenuHandler_Map(Handle:menu, MenuAction:action, param1, param2)
25.82 +{
25.83 + if (action == MenuAction_Cancel)
25.84 + {
25.85 + /* Add the removed maps back to the menu */
25.86 + new selectedmaps = GetArraySize(g_SelectedMaps);
25.87 + decl String:mapname[64];
25.88 +
25.89 + for (new i=0; i<selectedmaps; i++)
25.90 + {
25.91 + GetArrayString(g_SelectedMaps, i, mapname, sizeof(mapname)) ;
25.92 + AddMenuItem(menu, mapname, mapname);
25.93 + }
25.94 +
25.95 + if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
25.96 + {
25.97 + ConfirmVote(param1);
25.98 + }
25.99 + else // no action was selected.
25.100 + {
25.101 + /* Re-enable the menu option */
25.102 + g_VoteMapInUse = false;
25.103 + }
25.104 + }
25.105 + else if (action == MenuAction_Select)
25.106 + {
25.107 + decl String:info[32], String:name[32];
25.108 +
25.109 + GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
25.110 +
25.111 + /* Remove selected map from global menu and add it to the selected array */
25.112 + RemoveMenuItem(menu, param2);
25.113 + PushArrayString(g_SelectedMaps, info);
25.114 + g_SelectedCount++;
25.115 +
25.116 +
25.117 + /* Redisplay the list */
25.118 + if (g_SelectedCount < 5)
25.119 + {
25.120 + DisplayMenu(g_MapList, param1, MENU_TIME_FOREVER);
25.121 + }
25.122 + else
25.123 + {
25.124 + ConfirmVote(param1);
25.125 + }
25.126 + }
25.127 +}
25.128 +
25.129 +public AdminMenu_VoteMap(Handle:topmenu,
25.130 + TopMenuAction:action,
25.131 + TopMenuObject:object_id,
25.132 + param,
25.133 + String:buffer[],
25.134 + maxlength)
25.135 +{
25.136 + if (action == TopMenuAction_DisplayOption)
25.137 + {
25.138 + Format(buffer, maxlength, "%T", "Vote Map", param);
25.139 + }
25.140 + else if (action == TopMenuAction_SelectOption)
25.141 + {
25.142 + g_VoteMapInUse = true;
25.143 + ClearArray(g_SelectedMaps);
25.144 + g_SelectedCount = 0;
25.145 + DisplayMenu(g_MapList, param, MENU_TIME_FOREVER);
25.146 + }
25.147 + else if (action == TopMenuAction_DrawOption)
25.148 + {
25.149 + /* disable this option if a vote is already running, theres no maps listed or someone else has already acessed this menu */
25.150 + buffer[0] = (IsVoteInProgress() || g_mapCount < 1 || g_VoteMapInUse) ? ITEMDRAW_DISABLED : ITEMDRAW_DEFAULT;
25.151 + }
25.152 +}
25.153 +
25.154 +public Action:Command_Votemap(client, args)
25.155 +{
25.156 + if (args < 1)
25.157 + {
25.158 + ReplyToCommand(client, "[SM] Usage: sm_votemap <mapname> [mapname2] ... [mapname5]");
25.159 + return Plugin_Handled;
25.160 + }
25.161 +
25.162 + if (IsVoteInProgress())
25.163 + {
25.164 + ReplyToCommand(client, "[SM] %t", "Vote in Progress");
25.165 + return Plugin_Handled;
25.166 + }
25.167 +
25.168 + if (!TestVoteDelay(client))
25.169 + {
25.170 + return Plugin_Handled;
25.171 + }
25.172 +
25.173 + decl String:text[256];
25.174 + GetCmdArgString(text, sizeof(text));
25.175 +
25.176 + decl String:maps[5][64];
25.177 + new mapCount;
25.178 + new len, pos;
25.179 +
25.180 + while (pos != -1 && mapCount < 5)
25.181 + {
25.182 + pos = BreakString(text[len], maps[mapCount], sizeof(maps[]));
25.183 +
25.184 + if (!IsMapValid(maps[mapCount]))
25.185 + {
25.186 + ReplyToCommand(client, "[SM] %t", "Map was not found", maps[mapCount]);
25.187 + return Plugin_Handled;
25.188 + }
25.189 +
25.190 + mapCount++;
25.191 +
25.192 + if (pos != -1)
25.193 + {
25.194 + len += pos;
25.195 + }
25.196 + }
25.197 +
25.198 + DisplayVoteMapMenu(client, mapCount, maps);
25.199 +
25.200 + return Plugin_Handled;
25.201 +}
25.202 +
25.203 +LoadMaps(Handle:menu)
25.204 +{
25.205 + decl String:mapPath[256];
25.206 + BuildPath(Path_SM, mapPath, sizeof(mapPath), "configs/menu_maplist.ini");
25.207 +
25.208 + if (!FileExists(mapPath))
25.209 + {
25.210 + LogError("Unable to locate menu_maplist, no maps loaded.");
25.211 +
25.212 + if (g_MapList != INVALID_HANDLE)
25.213 + {
25.214 + RemoveAllMenuItems(menu);
25.215 + }
25.216 +
25.217 + return 0;
25.218 + }
25.219 +
25.220 + // If the file hasn't changed, there's no reason to reload
25.221 + // all of the maps.
25.222 + new fileTime = GetFileTime(mapPath, FileTime_LastChange);
25.223 + if (g_mapFileTime == fileTime)
25.224 + {
25.225 + return GetMenuItemCount(menu);
25.226 + }
25.227 +
25.228 + g_mapFileTime = fileTime;
25.229 +
25.230 + // Reset the array
25.231 + if (g_MapList != INVALID_HANDLE)
25.232 + {
25.233 + RemoveAllMenuItems(menu);
25.234 + }
25.235 +
25.236 + LogMessage("[SM] Loading menu map list file [%s]", mapPath);
25.237 +
25.238 + new Handle:file = OpenFile(mapPath, "rt");
25.239 + if (file == INVALID_HANDLE)
25.240 + {
25.241 + LogError("[SM] Could not open file: %s", mapPath);
25.242 + return 0;
25.243 + }
25.244 +
25.245 + decl String:buffer[64], len;
25.246 + while (!IsEndOfFile(file) && ReadFileLine(file, buffer, sizeof(buffer)))
25.247 + {
25.248 + TrimString(buffer);
25.249 +
25.250 + if ((len = StrContains(buffer, ".bsp", false)) != -1)
25.251 + {
25.252 + buffer[len] = '\0';
25.253 + }
25.254 +
25.255 + if (buffer[0] == '\0' || !IsValidConVarChar(buffer[0]) || !IsMapValid(buffer))
25.256 + {
25.257 + continue;
25.258 + }
25.259 +
25.260 + AddMenuItem(menu, buffer, buffer);
25.261 + }
25.262 +
25.263 + CloseHandle(file);
25.264 + return GetMenuItemCount(menu);
25.265 +}
25.266 \ No newline at end of file
26.1 --- a/translations/basecomm.phrases.txt Mon Oct 08 22:13:49 2007 +0000
26.2 +++ b/translations/basecomm.phrases.txt Sat Oct 13 04:43:42 2007 +0000
26.3 @@ -53,4 +53,12 @@
26.4 {
26.5 "en" "Target player is not silenced."
26.6 }
26.7 + "Gag/Mute Player"
26.8 + {
26.9 + "en" "Gag/Mute Player"
26.10 + }
26.11 + "Choose Type"
26.12 + {
26.13 + "en" "Choose Type"
26.14 + }
26.15 }
26.16 \ No newline at end of file
27.1 --- a/translations/basefunvotes.phrases.txt Mon Oct 08 22:13:49 2007 +0000
27.2 +++ b/translations/basefunvotes.phrases.txt Sat Oct 13 04:43:42 2007 +0000
27.3 @@ -74,5 +74,25 @@
27.4 "#format" "{1:s}"
27.5 "en" "Turn friendly fire on? {1}"
27.6 }
27.7 + "Vote Gravity"
27.8 + {
27.9 + "en" "Vote Gravity"
27.10 + }
27.11 + "Vote FF"
27.12 + {
27.13 + "en" "Vote FF"
27.14 + }
27.15 + "Vote Burn"
27.16 + {
27.17 + "en" "Vote Burn"
27.18 + }
27.19 + "Vote AllTalk"
27.20 + {
27.21 + "en" "Vote AllTalk"
27.22 + }
27.23 + "Vote Slay"
27.24 + {
27.25 + "en" "Vote Slay"
27.26 + }
27.27
27.28 }
27.29 \ No newline at end of file
28.1 --- a/translations/basevotes.phrases.txt Mon Oct 08 22:13:49 2007 +0000
28.2 +++ b/translations/basevotes.phrases.txt Sat Oct 13 04:43:42 2007 +0000
28.3 @@ -64,4 +64,20 @@
28.4 "#format" "{1:s},{2:s}"
28.5 "en" "The answer to {1} is: {2}."
28.6 }
28.7 + "Vote Kick"
28.8 + {
28.9 + "en" "Vote Kick"
28.10 + }
28.11 + "Vote Ban"
28.12 + {
28.13 + "en" "Vote Ban"
28.14 + }
28.15 + "Vote Map"
28.16 + {
28.17 + "en" "Vote Map"
28.18 + }
28.19 + "Confirm Vote"
28.20 + {
28.21 + "en" "Confirm Vote"
28.22 + }
28.23 }
29.1 --- a/translations/common.phrases.txt Mon Oct 08 22:13:49 2007 +0000
29.2 +++ b/translations/common.phrases.txt Sat Oct 13 04:43:42 2007 +0000
29.3 @@ -90,6 +90,10 @@
29.4 "#format" "{1:s}"
29.5 "en" "Slapped player '{1}'"
29.6 }
29.7 + "Slay player"
29.8 + {
29.9 + "en" "Slay player"
29.10 + }
29.11
29.12 "Slayed player"
29.13 {
29.14 @@ -276,5 +280,24 @@
29.15 {
29.16 "en" "Reload admins"
29.17 }
29.18 -}
29.19 -
29.20 + "Ban Player"
29.21 + {
29.22 + "en" "Ban Player"
29.23 + }
29.24 + "Ban Reason"
29.25 + {
29.26 + "en" "Ban Reason"
29.27 + }
29.28 + "Burn Player"
29.29 + {
29.30 + "en" "Burn Player"
29.31 + }
29.32 + "Slap Player"
29.33 + {
29.34 + "en" "Slap Player"
29.35 + }
29.36 + "Slap Damage"
29.37 + {
29.38 + "en" "Slap Damage"
29.39 + }
29.40 +}
29.41 \ No newline at end of file
30.1 --- a/translations/plugin.basecommands.txt Mon Oct 08 22:13:49 2007 +0000
30.2 +++ b/translations/plugin.basecommands.txt Sat Oct 13 04:43:42 2007 +0000
30.3 @@ -74,4 +74,16 @@
30.4 {
30.5 "en" "Admin cache has been refreshed."
30.6 }
30.7 + "Check player access"
30.8 + {
30.9 + "en" "Check player access"
30.10 + }
30.11 + "Choose Map"
30.12 + {
30.13 + "en" "Choose Map"
30.14 + }
30.15 + "Exec CFG"
30.16 + {
30.17 + "en" "Exec CFG"
30.18 + }
30.19 }