1.1 --- a/plugins/basefuncommands.sp Fri Feb 22 19:22:22 2008 +0000
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,407 +0,0 @@
1.4 -/**
1.5 - * vim: set ts=4 :
1.6 - * =============================================================================
1.7 - * SourceMod Basic Fun Commands Plugin
1.8 - * Implements basic punishment commands.
1.9 - *
1.10 - * SourceMod (C)2004-2007 AlliedModders LLC. All rights reserved.
1.11 - * =============================================================================
1.12 - *
1.13 - * This program is free software; you can redistribute it and/or modify it under
1.14 - * the terms of the GNU General Public License, version 3.0, as published by the
1.15 - * Free Software Foundation.
1.16 - *
1.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
1.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
1.19 - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
1.20 - * details.
1.21 - *
1.22 - * You should have received a copy of the GNU General Public License along with
1.23 - * this program. If not, see <http://www.gnu.org/licenses/>.
1.24 - *
1.25 - * As a special exception, AlliedModders LLC gives you permission to link the
1.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
1.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
1.28 - * by the Valve Corporation. You must obey the GNU General Public License in
1.29 - * all respects for all other code used. Additionally, AlliedModders LLC grants
1.30 - * this exception to all derivative works. AlliedModders LLC defines further
1.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
1.32 - * or <http://www.sourcemod.net/license.php>.
1.33 - *
1.34 - * Version: $Id$
1.35 - */
1.36 -
1.37 -#pragma semicolon 1
1.38 -
1.39 -#include <sourcemod>
1.40 -#include <sdktools>
1.41 -#undef REQUIRE_PLUGIN
1.42 -#include <adminmenu>
1.43 -
1.44 -public Plugin:myinfo =
1.45 -{
1.46 - name = "Basic Fun Commands",
1.47 - author = "AlliedModders LLC",
1.48 - description = "Basic Fun Commands",
1.49 - version = SOURCEMOD_VERSION,
1.50 - url = "http://www.sourcemod.net/"
1.51 -};
1.52 -
1.53 -// -------------------------------------------------------------------------------
1.54 -// Set any of these to 0 and recompile to completely disable those commands
1.55 -// -------------------------------------------------------------------------------
1.56 -#define BEACON 1
1.57 -#define TIMEBOMB 1
1.58 -#define FIRE 1
1.59 -#define ICE 1
1.60 -#define GRAVITY 1
1.61 -#define BLIND 1
1.62 -#define NOCLIP 1
1.63 -#define DRUG 1
1.64 -#define TELEPORT 1
1.65 -#define HEALTH 1
1.66 -#define COLORS 1
1.67 -#define CASH 1
1.68 -// -------------------------------------------------------------------------------
1.69 -
1.70 -new Handle:hTopMenu = INVALID_HANDLE;
1.71 -
1.72 -// Sounds
1.73 -#define SOUND_BLIP "buttons/blip1.wav"
1.74 -#define SOUND_BEEP "buttons/button17.wav"
1.75 -#define SOUND_FINAL "weapons/cguard/charging.wav"
1.76 -#define SOUND_BOOM "weapons/explode3.wav"
1.77 -#define SOUND_FREEZE "physics/glass/glass_impact_bullet4.wav"
1.78 -
1.79 -// Following are model indexes for temp entities
1.80 -new g_BeamSprite;
1.81 -new g_BeamSprite2;
1.82 -new g_HaloSprite;
1.83 -new g_GlowSprite;
1.84 -new g_ExplosionSprite;
1.85 -
1.86 -// Basic color arrays for temp entities
1.87 -new redColor[4] = {255, 75, 75, 255};
1.88 -new orangeColor[4] = {255, 128, 0, 255};
1.89 -new greenColor[4] = {75, 255, 75, 255};
1.90 -new blueColor[4] = {75, 75, 255, 255};
1.91 -new whiteColor[4] = {255, 255, 255, 255};
1.92 -new greyColor[4] = {128, 128, 128, 255};
1.93 -
1.94 -// UserMessageId for Fade.
1.95 -new UserMsg:g_FadeUserMsgId;
1.96 -
1.97 -// Include various commands and supporting functions
1.98 -#if BEACON
1.99 -#include "basefuncommands/beacon.sp"
1.100 -#endif
1.101 -#if TIMEBOMB
1.102 -#include "basefuncommands/timebomb.sp"
1.103 -#endif
1.104 -#if FIRE
1.105 -#include "basefuncommands/fire.sp"
1.106 -#endif
1.107 -#if ICE
1.108 -#include "basefuncommands/ice.sp"
1.109 -#endif
1.110 -#if GRAVITY
1.111 -#include "basefuncommands/gravity.sp"
1.112 -#endif
1.113 -#if BLIND
1.114 -#include "basefuncommands/blind.sp"
1.115 -#endif
1.116 -#if NOCLIP
1.117 -#include "basefuncommands/noclip.sp"
1.118 -#endif
1.119 -#if DRUG
1.120 -#include "basefuncommands/drug.sp"
1.121 -#endif
1.122 -
1.123 -public OnPluginStart()
1.124 -{
1.125 - LoadTranslations("common.phrases");
1.126 - LoadTranslations("basefuncommands.phrases");
1.127 -
1.128 - g_FadeUserMsgId = GetUserMessageId("Fade");
1.129 -
1.130 - RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> <filename>");
1.131 -
1.132 - HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
1.133 -
1.134 - #if BEACON
1.135 - SetupBeacon(); // sm_beacon
1.136 - #endif
1.137 -
1.138 - #if TIMEBOMB
1.139 - SetupTimeBomb(); // sm_timebomb
1.140 - #endif
1.141 -
1.142 - #if FIRE
1.143 - SetupFire(); // sm_burn and sm_firebomb
1.144 - #endif
1.145 -
1.146 - #if ICE
1.147 - SetupIce(); // sm_freeze and sm_freezebomb
1.148 - #endif
1.149 -
1.150 - #if GRAVITY
1.151 - SetupGravity(); // sm_gravity
1.152 - #endif
1.153 -
1.154 - #if BLIND
1.155 - SetupBlind(); // sm_blind
1.156 - #endif
1.157 -
1.158 - #if NOCLIP
1.159 - SetupNoClip(); // sm_noclip
1.160 - #endif
1.161 -
1.162 - #if DRUG
1.163 - SetupDrugs(); // sm_drug
1.164 - #endif
1.165 -
1.166 - AutoExecConfig(true, "funcommands");
1.167 -
1.168 - /* Account for late loading */
1.169 - new Handle:topmenu;
1.170 - if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
1.171 - {
1.172 - OnAdminMenuReady(topmenu);
1.173 - }
1.174 -}
1.175 -
1.176 -public OnMapStart()
1.177 -{
1.178 - PrecacheSound(SOUND_BLIP, true);
1.179 - PrecacheSound(SOUND_BEEP, true);
1.180 - PrecacheSound(SOUND_FINAL, true);
1.181 - PrecacheSound(SOUND_BOOM, true);
1.182 - PrecacheSound(SOUND_FREEZE, true);
1.183 -
1.184 - g_BeamSprite = PrecacheModel("materials/sprites/laser.vmt");
1.185 - g_BeamSprite2 = PrecacheModel("sprites/bluelight1.vmt");
1.186 - g_HaloSprite = PrecacheModel("materials/sprites/halo01.vmt");
1.187 - g_GlowSprite = PrecacheModel("sprites/blueglow2.vmt");
1.188 - g_ExplosionSprite = PrecacheModel("sprites/sprite_fire01.vmt");
1.189 -}
1.190 -
1.191 -public OnMapEnd()
1.192 -{
1.193 - #if BEACON
1.194 - KillAllBeacons();
1.195 - #endif
1.196 - #if TIMEBOMB
1.197 - KillAllTimeBombs();
1.198 - #endif
1.199 - #if FIRE
1.200 - KillAllFireBombs();
1.201 - #endif
1.202 - #if ICE
1.203 - KillAllFreezes();
1.204 - #endif
1.205 - #if DRUG
1.206 - KillAllDrugs();
1.207 - #endif
1.208 -}
1.209 -
1.210 -public Action:Event_RoundEnd(Handle:event,const String:name[],bool:dontBroadcast)
1.211 -{
1.212 - #if BEACON
1.213 - KillAllBeacons();
1.214 - #endif
1.215 - #if TIMEBOMB
1.216 - KillAllTimeBombs();
1.217 - #endif
1.218 - #if FIRE
1.219 - KillAllFireBombs();
1.220 - #endif
1.221 - #if ICE
1.222 - KillAllFreezes();
1.223 - #endif
1.224 - #if DRUG
1.225 - KillAllDrugs();
1.226 - #endif
1.227 -
1.228 - return Plugin_Handled;
1.229 -}
1.230 -
1.231 -public OnAdminMenuReady(Handle:topmenu)
1.232 -{
1.233 - /* Block us from being called twice */
1.234 - if (topmenu == hTopMenu)
1.235 - {
1.236 - return;
1.237 - }
1.238 -
1.239 - /* Save the Handle */
1.240 - hTopMenu = topmenu;
1.241 -
1.242 - /* Find the "Player Commands" category */
1.243 - new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
1.244 -
1.245 - if (player_commands != INVALID_TOPMENUOBJECT)
1.246 - {
1.247 - #if BEACON
1.248 - AddToTopMenu(hTopMenu,
1.249 - "sm_beacon",
1.250 - TopMenuObject_Item,
1.251 - AdminMenu_Beacon,
1.252 - player_commands,
1.253 - "sm_beacon",
1.254 - ADMFLAG_SLAY);
1.255 - #endif
1.256 -
1.257 - #if TIMEBOMB
1.258 - AddToTopMenu(hTopMenu,
1.259 - "sm_timebomb",
1.260 - TopMenuObject_Item,
1.261 - AdminMenu_TimeBomb,
1.262 - player_commands,
1.263 - "sm_timebomb",
1.264 - ADMFLAG_SLAY);
1.265 - #endif
1.266 -
1.267 - #if FIRE
1.268 - AddToTopMenu(hTopMenu,
1.269 - "sm_burn",
1.270 - TopMenuObject_Item,
1.271 - AdminMenu_Burn,
1.272 - player_commands,
1.273 - "sm_burn",
1.274 - ADMFLAG_SLAY);
1.275 -
1.276 - AddToTopMenu(hTopMenu,
1.277 - "sm_firebomb",
1.278 - TopMenuObject_Item,
1.279 - AdminMenu_FireBomb,
1.280 - player_commands,
1.281 - "sm_firebomb",
1.282 - ADMFLAG_SLAY);
1.283 - #endif
1.284 -
1.285 - #if ICE
1.286 - AddToTopMenu(hTopMenu,
1.287 - "sm_freeze",
1.288 - TopMenuObject_Item,
1.289 - AdminMenu_Freeze,
1.290 - player_commands,
1.291 - "sm_freeze",
1.292 - ADMFLAG_SLAY);
1.293 -
1.294 - AddToTopMenu(hTopMenu,
1.295 - "sm_freezebomb",
1.296 - TopMenuObject_Item,
1.297 - AdminMenu_FreezeBomb,
1.298 - player_commands,
1.299 - "sm_freezebomb",
1.300 - ADMFLAG_SLAY);
1.301 - #endif
1.302 -
1.303 - #if GRAVITY
1.304 - AddToTopMenu(hTopMenu,
1.305 - "sm_gravity",
1.306 - TopMenuObject_Item,
1.307 - AdminMenu_Gravity,
1.308 - player_commands,
1.309 - "sm_gravity",
1.310 - ADMFLAG_SLAY);
1.311 - #endif
1.312 -
1.313 - #if BLIND
1.314 - AddToTopMenu(hTopMenu,
1.315 - "sm_blind",
1.316 - TopMenuObject_Item,
1.317 - AdminMenu_Blind,
1.318 - player_commands,
1.319 - "sm_blind",
1.320 - ADMFLAG_SLAY);
1.321 - #endif
1.322 -
1.323 - #if NOCLIP
1.324 - AddToTopMenu(hTopMenu,
1.325 - "sm_noclip",
1.326 - TopMenuObject_Item,
1.327 - AdminMenu_NoClip,
1.328 - player_commands,
1.329 - "sm_noclip",
1.330 - ADMFLAG_SLAY);
1.331 - #endif
1.332 -
1.333 - #if DRUG
1.334 - AddToTopMenu(hTopMenu,
1.335 - "sm_drug",
1.336 - TopMenuObject_Item,
1.337 - AdminMenu_Drug,
1.338 - player_commands,
1.339 - "sm_drug",
1.340 - ADMFLAG_SLAY);
1.341 - #endif
1.342 - }
1.343 -}
1.344 -
1.345 -public Action:Command_Play(client, args)
1.346 -{
1.347 - if (args < 2)
1.348 - {
1.349 - ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
1.350 - }
1.351 -
1.352 - new String:Arguments[PLATFORM_MAX_PATH + 65];
1.353 - GetCmdArgString(Arguments, sizeof(Arguments));
1.354 -
1.355 - decl String:Arg[65];
1.356 - new len = BreakString(Arguments, Arg, sizeof(Arg));
1.357 -
1.358 - /* Make sure it does not go out of bound by doing "sm_play user "*/
1.359 - if (len == -1)
1.360 - {
1.361 - ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
1.362 - return Plugin_Handled;
1.363 - }
1.364 -
1.365 - /* Incase they put quotes and white spaces after the quotes */
1.366 - if (Arguments[len] == '"')
1.367 - {
1.368 - len++;
1.369 - new FileLen = TrimString(Arguments[len]) + len;
1.370 -
1.371 - if (Arguments[FileLen - 1] == '"')
1.372 - {
1.373 - Arguments[FileLen - 1] = '\0';
1.374 - }
1.375 - }
1.376 -
1.377 - decl String:target_name[MAX_TARGET_LENGTH];
1.378 - decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
1.379 -
1.380 - if ((target_count = ProcessTargetString(
1.381 - Arg,
1.382 - client,
1.383 - target_list,
1.384 - MAXPLAYERS,
1.385 - COMMAND_FILTER_NO_BOTS,
1.386 - target_name,
1.387 - sizeof(target_name),
1.388 - tn_is_ml)) <= 0)
1.389 - {
1.390 - ReplyToTargetError(client, target_count);
1.391 - return Plugin_Handled;
1.392 - }
1.393 -
1.394 - for (new i = 0; i < target_count; i++)
1.395 - {
1.396 - ClientCommand(target_list[i], "playgamesound \"%s\"", Arguments[len]);
1.397 - LogAction(client, target_list[i], "\"%L\" played sound on \"%L\" (file \"%s\")", client, target_list[i], Arguments[len]);
1.398 - }
1.399 -
1.400 - if (tn_is_ml)
1.401 - {
1.402 - ShowActivity2(client, "[SM] ", "%t", "Played sound to target", target_name);
1.403 - }
1.404 - else
1.405 - {
1.406 - ShowActivity2(client, "[SM] ", "%t", "Played sound to target", "_s", target_name);
1.407 - }
1.408 -
1.409 - return Plugin_Handled;
1.410 -}