deprecated LoadMaps() and its usage in three plugins
authorDavid Anderson <dvander@alliedmods.net>
Fri Feb 22 21:01:08 2008 +0000 (2008-02-22)
changeset 18895b4d6acc4d82
parent 1888 de5c3395ac24
child 1890 6e132696f6a6
deprecated LoadMaps() and its usage in three plugins
renamed basefun* to fun*
removed map file list cvars
configs/maplists.cfg
plugins/basefuncommands.sp
plugins/basefuncommands/beacon.sp
plugins/basefuncommands/blind.sp
plugins/basefuncommands/drug.sp
plugins/basefuncommands/fire.sp
plugins/basefuncommands/gravity.sp
plugins/basefuncommands/ice.sp
plugins/basefuncommands/noclip.sp
plugins/basefuncommands/timebomb.sp
plugins/basefunvotes.sp
plugins/basefunvotes/votealltalk.sp
plugins/basefunvotes/voteburn.sp
plugins/basefunvotes/voteff.sp
plugins/basefunvotes/votegravity.sp
plugins/basefunvotes/voteslay.sp
plugins/funcommands.sp
plugins/funcommands/beacon.sp
plugins/funcommands/blind.sp
plugins/funcommands/drug.sp
plugins/funcommands/fire.sp
plugins/funcommands/gravity.sp
plugins/funcommands/ice.sp
plugins/funcommands/noclip.sp
plugins/funcommands/timebomb.sp
plugins/funvotes.sp
plugins/funvotes/votealltalk.sp
plugins/funvotes/voteburn.sp
plugins/funvotes/voteff.sp
plugins/funvotes/votegravity.sp
plugins/funvotes/voteslay.sp
plugins/include/helpers.inc
plugins/mapchooser.sp
plugins/randomcycle.sp
plugins/rockthevote.sp
     1.1 --- a/configs/maplists.cfg	Fri Feb 22 19:22:22 2008 +0000
     1.2 +++ b/configs/maplists.cfg	Fri Feb 22 21:01:08 2008 +0000
     1.3 @@ -27,12 +27,33 @@
     1.4  		"target"		"mapcyclefile"
     1.5  	}
     1.6  	
     1.7 +	/* Admin menu, map menu */
     1.8  	"sm_map menu"
     1.9  	{
    1.10  		"file"			"addons/sourcemod/configs/adminmenu_maplist.ini"
    1.11  	}
    1.12 +	
    1.13 +	/* Admin menu, map voting menu */
    1.14  	"sm_votemap menu"
    1.15  	{
    1.16  		"file"			"addons/sourcemod/configs/adminmenu_maplist.ini"
    1.17  	}
    1.18 +	
    1.19 +	/* For the "randomcycle" plugin */
    1.20 +	"randomcycle"
    1.21 +	{
    1.22 +		"target"		"default"
    1.23 +	}
    1.24 +	
    1.25 +	/* For the "mapchooser" plugin */
    1.26 +	"mapchooser"
    1.27 +	{
    1.28 +		"target"		"default"
    1.29 +	}
    1.30 +	
    1.31 +	/* For the "randomcycle" plugin */
    1.32 +	"rockthevote"
    1.33 +	{
    1.34 +		"target"		"default"
    1.35 +	}
    1.36  }
     2.1 --- a/plugins/basefuncommands.sp	Fri Feb 22 19:22:22 2008 +0000
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,407 +0,0 @@
     2.4 -/**
     2.5 - * vim: set ts=4 :
     2.6 - * =============================================================================
     2.7 - * SourceMod Basic Fun Commands Plugin
     2.8 - * Implements basic punishment commands.
     2.9 - *
    2.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    2.11 - * =============================================================================
    2.12 - *
    2.13 - * This program is free software; you can redistribute it and/or modify it under
    2.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    2.15 - * Free Software Foundation.
    2.16 - * 
    2.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    2.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    2.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    2.20 - * details.
    2.21 - *
    2.22 - * You should have received a copy of the GNU General Public License along with
    2.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    2.24 - *
    2.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    2.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    2.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    2.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    2.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    2.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    2.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    2.32 - * or <http://www.sourcemod.net/license.php>.
    2.33 - *
    2.34 - * Version: $Id$
    2.35 - */
    2.36 -
    2.37 -#pragma semicolon 1
    2.38 -
    2.39 -#include <sourcemod>
    2.40 -#include <sdktools>
    2.41 -#undef REQUIRE_PLUGIN
    2.42 -#include <adminmenu>
    2.43 -
    2.44 -public Plugin:myinfo =
    2.45 -{
    2.46 -	name = "Basic Fun Commands",
    2.47 -	author = "AlliedModders LLC",
    2.48 -	description = "Basic Fun Commands",
    2.49 -	version = SOURCEMOD_VERSION,
    2.50 -	url = "http://www.sourcemod.net/"
    2.51 -};
    2.52 -
    2.53 -// -------------------------------------------------------------------------------
    2.54 -// Set any of these to 0 and recompile to completely disable those commands
    2.55 -// -------------------------------------------------------------------------------
    2.56 -#define BEACON		1
    2.57 -#define TIMEBOMB	1
    2.58 -#define FIRE		1
    2.59 -#define ICE		1
    2.60 -#define GRAVITY		1
    2.61 -#define BLIND		1
    2.62 -#define NOCLIP		1
    2.63 -#define DRUG		1
    2.64 -#define TELEPORT	1
    2.65 -#define HEALTH		1
    2.66 -#define COLORS		1
    2.67 -#define CASH		1
    2.68 -// -------------------------------------------------------------------------------
    2.69 -
    2.70 -new Handle:hTopMenu = INVALID_HANDLE;
    2.71 -
    2.72 -// Sounds
    2.73 -#define SOUND_BLIP		"buttons/blip1.wav"
    2.74 -#define SOUND_BEEP		"buttons/button17.wav"
    2.75 -#define SOUND_FINAL		"weapons/cguard/charging.wav"
    2.76 -#define SOUND_BOOM		"weapons/explode3.wav"
    2.77 -#define SOUND_FREEZE		"physics/glass/glass_impact_bullet4.wav"
    2.78 -
    2.79 -// Following are model indexes for temp entities
    2.80 -new g_BeamSprite;
    2.81 -new g_BeamSprite2;
    2.82 -new g_HaloSprite;
    2.83 -new g_GlowSprite;
    2.84 -new g_ExplosionSprite;
    2.85 -
    2.86 -// Basic color arrays for temp entities
    2.87 -new redColor[4] = {255, 75, 75, 255};
    2.88 -new orangeColor[4] = {255, 128, 0, 255};
    2.89 -new greenColor[4] = {75, 255, 75, 255};
    2.90 -new blueColor[4] = {75, 75, 255, 255};
    2.91 -new whiteColor[4] = {255, 255, 255, 255};
    2.92 -new greyColor[4] = {128, 128, 128, 255};
    2.93 -
    2.94 -// UserMessageId for Fade.
    2.95 -new UserMsg:g_FadeUserMsgId;
    2.96 -
    2.97 -// Include various commands and supporting functions
    2.98 -#if BEACON
    2.99 -#include "basefuncommands/beacon.sp"
   2.100 -#endif
   2.101 -#if TIMEBOMB
   2.102 -#include "basefuncommands/timebomb.sp"
   2.103 -#endif
   2.104 -#if FIRE
   2.105 -#include "basefuncommands/fire.sp"
   2.106 -#endif
   2.107 -#if ICE
   2.108 -#include "basefuncommands/ice.sp"
   2.109 -#endif
   2.110 -#if GRAVITY
   2.111 -#include "basefuncommands/gravity.sp"
   2.112 -#endif
   2.113 -#if BLIND
   2.114 -#include "basefuncommands/blind.sp"
   2.115 -#endif
   2.116 -#if NOCLIP
   2.117 -#include "basefuncommands/noclip.sp"
   2.118 -#endif
   2.119 -#if DRUG
   2.120 -#include "basefuncommands/drug.sp"
   2.121 -#endif
   2.122 -
   2.123 -public OnPluginStart()
   2.124 -{
   2.125 -	LoadTranslations("common.phrases");
   2.126 -	LoadTranslations("basefuncommands.phrases");
   2.127 -
   2.128 -	g_FadeUserMsgId = GetUserMessageId("Fade");
   2.129 -	
   2.130 -	RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> <filename>");
   2.131 -
   2.132 -	HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);	
   2.133 -
   2.134 -	#if BEACON
   2.135 -	SetupBeacon();		// sm_beacon
   2.136 -	#endif
   2.137 -	
   2.138 -	#if TIMEBOMB
   2.139 -	SetupTimeBomb();	// sm_timebomb
   2.140 -	#endif
   2.141 -	
   2.142 -	#if FIRE
   2.143 -	SetupFire();		// sm_burn and sm_firebomb
   2.144 -	#endif
   2.145 -	
   2.146 -	#if ICE
   2.147 -	SetupIce();			// sm_freeze and sm_freezebomb
   2.148 -	#endif
   2.149 -	
   2.150 -	#if GRAVITY
   2.151 -	SetupGravity();		// sm_gravity
   2.152 -	#endif
   2.153 -	
   2.154 -	#if BLIND
   2.155 -	SetupBlind();		// sm_blind
   2.156 -	#endif
   2.157 -	
   2.158 -	#if NOCLIP
   2.159 -	SetupNoClip();		// sm_noclip
   2.160 -	#endif
   2.161 -	
   2.162 -	#if DRUG
   2.163 -	SetupDrugs();		// sm_drug
   2.164 -	#endif
   2.165 -	
   2.166 -	AutoExecConfig(true, "funcommands");
   2.167 -	
   2.168 -	/* Account for late loading */
   2.169 -	new Handle:topmenu;
   2.170 -	if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
   2.171 -	{
   2.172 -		OnAdminMenuReady(topmenu);
   2.173 -	}
   2.174 -}
   2.175 -
   2.176 -public OnMapStart()
   2.177 -{
   2.178 -	PrecacheSound(SOUND_BLIP, true);
   2.179 -	PrecacheSound(SOUND_BEEP, true);
   2.180 -	PrecacheSound(SOUND_FINAL, true);
   2.181 -	PrecacheSound(SOUND_BOOM, true);
   2.182 -	PrecacheSound(SOUND_FREEZE, true);
   2.183 -
   2.184 -	g_BeamSprite = PrecacheModel("materials/sprites/laser.vmt");
   2.185 -	g_BeamSprite2 = PrecacheModel("sprites/bluelight1.vmt");
   2.186 -	g_HaloSprite = PrecacheModel("materials/sprites/halo01.vmt");	
   2.187 -	g_GlowSprite = PrecacheModel("sprites/blueglow2.vmt");
   2.188 -	g_ExplosionSprite = PrecacheModel("sprites/sprite_fire01.vmt");
   2.189 -}
   2.190 -
   2.191 -public OnMapEnd()
   2.192 -{
   2.193 -	#if BEACON
   2.194 -	KillAllBeacons();
   2.195 -	#endif
   2.196 -	#if TIMEBOMB
   2.197 -	KillAllTimeBombs();
   2.198 -	#endif
   2.199 -	#if FIRE
   2.200 -	KillAllFireBombs();
   2.201 -	#endif
   2.202 -	#if ICE
   2.203 -	KillAllFreezes();
   2.204 -	#endif
   2.205 -	#if DRUG
   2.206 -	KillAllDrugs();
   2.207 -	#endif
   2.208 -}
   2.209 -
   2.210 -public Action:Event_RoundEnd(Handle:event,const String:name[],bool:dontBroadcast)
   2.211 -{
   2.212 -	#if BEACON
   2.213 -	KillAllBeacons();
   2.214 -	#endif
   2.215 -	#if TIMEBOMB
   2.216 -	KillAllTimeBombs();
   2.217 -	#endif
   2.218 -	#if FIRE
   2.219 -	KillAllFireBombs();
   2.220 -	#endif
   2.221 -	#if ICE
   2.222 -	KillAllFreezes();
   2.223 -	#endif
   2.224 -	#if DRUG
   2.225 -	KillAllDrugs();
   2.226 -	#endif
   2.227 -	
   2.228 -	return Plugin_Handled;
   2.229 -}
   2.230 -
   2.231 -public OnAdminMenuReady(Handle:topmenu)
   2.232 -{
   2.233 -	/* Block us from being called twice */
   2.234 -	if (topmenu == hTopMenu)
   2.235 -	{
   2.236 -		return;
   2.237 -	}
   2.238 -	
   2.239 -	/* Save the Handle */
   2.240 -	hTopMenu = topmenu;
   2.241 -	
   2.242 -	/* Find the "Player Commands" category */
   2.243 -	new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
   2.244 -
   2.245 -	if (player_commands != INVALID_TOPMENUOBJECT)
   2.246 -	{
   2.247 -		#if BEACON
   2.248 -		AddToTopMenu(hTopMenu,
   2.249 -			"sm_beacon",
   2.250 -			TopMenuObject_Item,
   2.251 -			AdminMenu_Beacon,
   2.252 -			player_commands,
   2.253 -			"sm_beacon",
   2.254 -			ADMFLAG_SLAY);
   2.255 -		#endif
   2.256 -		
   2.257 -		#if TIMEBOMB
   2.258 -		AddToTopMenu(hTopMenu,
   2.259 -			"sm_timebomb",
   2.260 -			TopMenuObject_Item,
   2.261 -			AdminMenu_TimeBomb,
   2.262 -			player_commands,
   2.263 -			"sm_timebomb",
   2.264 -			ADMFLAG_SLAY);
   2.265 -		#endif
   2.266 -		
   2.267 -		#if FIRE
   2.268 -		AddToTopMenu(hTopMenu,
   2.269 -			"sm_burn",
   2.270 -			TopMenuObject_Item,
   2.271 -			AdminMenu_Burn,
   2.272 -			player_commands,
   2.273 -			"sm_burn",
   2.274 -			ADMFLAG_SLAY);
   2.275 -			
   2.276 -		AddToTopMenu(hTopMenu,
   2.277 -			"sm_firebomb",
   2.278 -			TopMenuObject_Item,
   2.279 -			AdminMenu_FireBomb,
   2.280 -			player_commands,
   2.281 -			"sm_firebomb",
   2.282 -			ADMFLAG_SLAY);
   2.283 -		#endif
   2.284 -		
   2.285 -		#if ICE
   2.286 -		AddToTopMenu(hTopMenu,
   2.287 -			"sm_freeze",
   2.288 -			TopMenuObject_Item,
   2.289 -			AdminMenu_Freeze,
   2.290 -			player_commands,
   2.291 -			"sm_freeze",
   2.292 -			ADMFLAG_SLAY);
   2.293 -			
   2.294 -		AddToTopMenu(hTopMenu,
   2.295 -			"sm_freezebomb",
   2.296 -			TopMenuObject_Item,
   2.297 -			AdminMenu_FreezeBomb,
   2.298 -			player_commands,
   2.299 -			"sm_freezebomb",
   2.300 -			ADMFLAG_SLAY);
   2.301 -		#endif
   2.302 -			
   2.303 -		#if GRAVITY
   2.304 -		AddToTopMenu(hTopMenu,
   2.305 -			"sm_gravity",
   2.306 -			TopMenuObject_Item,
   2.307 -			AdminMenu_Gravity,
   2.308 -			player_commands,
   2.309 -			"sm_gravity",
   2.310 -			ADMFLAG_SLAY);
   2.311 -		#endif
   2.312 -			
   2.313 -		#if BLIND
   2.314 -		AddToTopMenu(hTopMenu,
   2.315 -			"sm_blind",
   2.316 -			TopMenuObject_Item,
   2.317 -			AdminMenu_Blind,
   2.318 -			player_commands,
   2.319 -			"sm_blind",
   2.320 -			ADMFLAG_SLAY);
   2.321 -		#endif
   2.322 -		
   2.323 -		#if NOCLIP
   2.324 -		AddToTopMenu(hTopMenu,
   2.325 -			"sm_noclip",
   2.326 -			TopMenuObject_Item,
   2.327 -			AdminMenu_NoClip,
   2.328 -			player_commands,
   2.329 -			"sm_noclip",
   2.330 -			ADMFLAG_SLAY);
   2.331 -		#endif
   2.332 -		
   2.333 -		#if DRUG
   2.334 -		AddToTopMenu(hTopMenu,
   2.335 -			"sm_drug",
   2.336 -			TopMenuObject_Item,
   2.337 -			AdminMenu_Drug,
   2.338 -			player_commands,
   2.339 -			"sm_drug",
   2.340 -			ADMFLAG_SLAY);
   2.341 -		#endif		
   2.342 -	}
   2.343 -}
   2.344 -
   2.345 -public Action:Command_Play(client, args)
   2.346 -{
   2.347 -	if (args < 2)
   2.348 -	{
   2.349 -		ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
   2.350 -	}
   2.351 -
   2.352 -	new String:Arguments[PLATFORM_MAX_PATH + 65];
   2.353 -	GetCmdArgString(Arguments, sizeof(Arguments));
   2.354 -
   2.355 - 	decl String:Arg[65];
   2.356 -	new len = BreakString(Arguments, Arg, sizeof(Arg));
   2.357 -
   2.358 -	/* Make sure it does not go out of bound by doing "sm_play user  "*/
   2.359 -	if (len == -1)
   2.360 -	{
   2.361 -		ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
   2.362 -		return Plugin_Handled;
   2.363 -	}
   2.364 -
   2.365 -	/* Incase they put quotes and white spaces after the quotes */
   2.366 -	if (Arguments[len] == '"')
   2.367 -	{
   2.368 -		len++;
   2.369 -		new FileLen = TrimString(Arguments[len]) + len;
   2.370 -
   2.371 -		if (Arguments[FileLen - 1] == '"')
   2.372 -		{
   2.373 -			Arguments[FileLen - 1] = '\0';
   2.374 -		}
   2.375 -	}
   2.376 -	
   2.377 -	decl String:target_name[MAX_TARGET_LENGTH];
   2.378 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   2.379 -	
   2.380 -	if ((target_count = ProcessTargetString(
   2.381 -			Arg,
   2.382 -			client,
   2.383 -			target_list,
   2.384 -			MAXPLAYERS,
   2.385 -			COMMAND_FILTER_NO_BOTS,
   2.386 -			target_name,
   2.387 -			sizeof(target_name),
   2.388 -			tn_is_ml)) <= 0)
   2.389 -	{
   2.390 -		ReplyToTargetError(client, target_count);
   2.391 -		return Plugin_Handled;
   2.392 -	}
   2.393 -	
   2.394 -	for (new i = 0; i < target_count; i++)
   2.395 -	{
   2.396 -		ClientCommand(target_list[i], "playgamesound \"%s\"", Arguments[len]);
   2.397 -		LogAction(client, target_list[i], "\"%L\" played sound on \"%L\" (file \"%s\")", client, target_list[i], Arguments[len]);
   2.398 -	}
   2.399 -	
   2.400 -	if (tn_is_ml)
   2.401 -	{
   2.402 -		ShowActivity2(client, "[SM] ", "%t", "Played sound to target", target_name);
   2.403 -	}
   2.404 -	else
   2.405 -	{
   2.406 -		ShowActivity2(client, "[SM] ", "%t", "Played sound to target", "_s", target_name);
   2.407 -	}
   2.408 -
   2.409 -	return Plugin_Handled;
   2.410 -}
     3.1 --- a/plugins/basefuncommands/beacon.sp	Fri Feb 22 19:22:22 2008 +0000
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,280 +0,0 @@
     3.4 -/**
     3.5 - * vim: set ts=4 :
     3.6 - * =============================================================================
     3.7 - * SourceMod Basefuncommands Plugin
     3.8 - * Provides beacon functionality
     3.9 - *
    3.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    3.11 - * =============================================================================
    3.12 - *
    3.13 - * This program is free software; you can redistribute it and/or modify it under
    3.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    3.15 - * Free Software Foundation.
    3.16 - * 
    3.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    3.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    3.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    3.20 - * details.
    3.21 - *
    3.22 - * You should have received a copy of the GNU General Public License along with
    3.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    3.24 - *
    3.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    3.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    3.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    3.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    3.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    3.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    3.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    3.32 - * or <http://www.sourcemod.net/license.php>.
    3.33 - *
    3.34 - * Version: $Id$
    3.35 - */
    3.36 -
    3.37 -new Handle:g_BeaconTimers[MAXPLAYERS+1];
    3.38 -
    3.39 -new Handle:g_BeaconRadius = INVALID_HANDLE;
    3.40 -
    3.41 -SetupBeacon()
    3.42 -{
    3.43 -	RegAdminCmd("sm_beacon", Command_Beacon, ADMFLAG_SLAY, "sm_beacon <#userid|name> [0/1]");
    3.44 -	
    3.45 -	g_BeaconRadius = CreateConVar("sm_beacon_radius", "375", "Sets the radius for beacon's light rings.", 0, true, 50.0, true, 1500.0);
    3.46 -}
    3.47 -
    3.48 -CreateBeacon(client)
    3.49 -{
    3.50 -	g_BeaconTimers[client] = CreateTimer(2.0, Timer_Beacon, client, TIMER_REPEAT);	
    3.51 -}
    3.52 -
    3.53 -KillBeacon(client)
    3.54 -{
    3.55 -	KillTimer(g_BeaconTimers[client]);
    3.56 -	g_BeaconTimers[client] = INVALID_HANDLE;
    3.57 -}
    3.58 -
    3.59 -KillAllBeacons()
    3.60 -{
    3.61 -	new maxclients = GetMaxClients();
    3.62 -	for (new i = 1; i <= maxclients; i++)
    3.63 -	{
    3.64 -		if (g_BeaconTimers[i] != INVALID_HANDLE)
    3.65 -		{
    3.66 -			KillBeacon(i);
    3.67 -		}
    3.68 -	}
    3.69 -}
    3.70 -
    3.71 -PerformBeacon(client, target, toggle)
    3.72 -{
    3.73 -	switch (toggle)
    3.74 -	{
    3.75 -		case (2):
    3.76 -		{
    3.77 -			if (g_BeaconTimers[target] == INVALID_HANDLE)
    3.78 -			{
    3.79 -				CreateBeacon(target);
    3.80 -				LogAction(client, target, "\"%L\" set a beacon on \"%L\"", client, target);
    3.81 -			}
    3.82 -			else
    3.83 -			{
    3.84 -				KillBeacon(target);
    3.85 -				LogAction(client, target, "\"%L\" removed a beacon on \"%L\"", client, target);
    3.86 -			}			
    3.87 -		}
    3.88 -
    3.89 -		case (1):
    3.90 -		{
    3.91 -			if (g_BeaconTimers[target] == INVALID_HANDLE)
    3.92 -			{
    3.93 -				CreateBeacon(target);
    3.94 -				LogAction(client, target, "\"%L\" set a beacon on \"%L\"", client, target);
    3.95 -			}			
    3.96 -		}
    3.97 -		
    3.98 -		case (0):
    3.99 -		{
   3.100 -			if (g_BeaconTimers[target] != INVALID_HANDLE)
   3.101 -			{
   3.102 -				KillBeacon(target);
   3.103 -				LogAction(client, target, "\"%L\" removed a beacon on \"%L\"", client, target);
   3.104 -			}			
   3.105 -		}
   3.106 -	}
   3.107 -}
   3.108 -
   3.109 -public Action:Timer_Beacon(Handle:timer, any:client)
   3.110 -{
   3.111 -	if (!IsClientInGame(client) || !IsPlayerAlive(client))
   3.112 -	{
   3.113 -		KillBeacon(client);		
   3.114 -
   3.115 -		return Plugin_Handled;
   3.116 -	}
   3.117 -	
   3.118 -	new team = GetClientTeam(client);
   3.119 -
   3.120 -	new Float:vec[3];
   3.121 -	GetClientAbsOrigin(client, vec);
   3.122 -	vec[2] += 10;
   3.123 -
   3.124 -	TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_BeaconRadius), g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
   3.125 -	TE_SendToAll();
   3.126 -	
   3.127 -	if (team == 2)
   3.128 -	{
   3.129 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_BeaconRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, redColor, 10, 0);
   3.130 -	}
   3.131 -	else if (team == 3)
   3.132 -	{
   3.133 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_BeaconRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, blueColor, 10, 0);
   3.134 -	}
   3.135 -	else
   3.136 -	{
   3.137 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_BeaconRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, greenColor, 10, 0);
   3.138 -	}
   3.139 -	
   3.140 -	TE_SendToAll();
   3.141 -		
   3.142 -	GetClientEyePosition(client, vec);
   3.143 -	EmitAmbientSound(SOUND_BLIP, vec, client, SNDLEVEL_RAIDSIREN);	
   3.144 -		
   3.145 -	return Plugin_Handled;
   3.146 -}
   3.147 -
   3.148 -public AdminMenu_Beacon(Handle:topmenu, 
   3.149 -					  TopMenuAction:action,
   3.150 -					  TopMenuObject:object_id,
   3.151 -					  param,
   3.152 -					  String:buffer[],
   3.153 -					  maxlength)
   3.154 -{
   3.155 -	if (action == TopMenuAction_DisplayOption)
   3.156 -	{
   3.157 -		Format(buffer, maxlength, "%T", "Beacon player", param);
   3.158 -	}
   3.159 -	else if (action == TopMenuAction_SelectOption)
   3.160 -	{
   3.161 -		DisplayBeaconMenu(param);
   3.162 -	}
   3.163 -}
   3.164 -
   3.165 -DisplayBeaconMenu(client)
   3.166 -{
   3.167 -	new Handle:menu = CreateMenu(MenuHandler_Beacon);
   3.168 -	
   3.169 -	decl String:title[100];
   3.170 -	Format(title, sizeof(title), "%T:", "Beacon player", client);
   3.171 -	SetMenuTitle(menu, title);
   3.172 -	SetMenuExitBackButton(menu, true);
   3.173 -	
   3.174 -	AddTargetsToMenu(menu, client, true, true);
   3.175 -	
   3.176 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   3.177 -}
   3.178 -
   3.179 -public MenuHandler_Beacon(Handle:menu, MenuAction:action, param1, param2)
   3.180 -{
   3.181 -	if (action == MenuAction_End)
   3.182 -	{
   3.183 -		CloseHandle(menu);
   3.184 -	}
   3.185 -	else if (action == MenuAction_Cancel)
   3.186 -	{
   3.187 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   3.188 -		{
   3.189 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   3.190 -		}
   3.191 -	}
   3.192 -	else if (action == MenuAction_Select)
   3.193 -	{
   3.194 -		decl String:info[32];
   3.195 -		new userid, target;
   3.196 -		
   3.197 -		GetMenuItem(menu, param2, info, sizeof(info));
   3.198 -		userid = StringToInt(info);
   3.199 -
   3.200 -		if ((target = GetClientOfUserId(userid)) == 0)
   3.201 -		{
   3.202 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   3.203 -		}
   3.204 -		else if (!CanUserTarget(param1, target))
   3.205 -		{
   3.206 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   3.207 -		}
   3.208 -		else
   3.209 -		{
   3.210 -			new String:name[32];
   3.211 -			GetClientName(target, name, sizeof(name));
   3.212 -			
   3.213 -			PerformBeacon(param1, target, 2);
   3.214 -			ShowActivity2(param1, "[SM] ", "%t", "Toggled beacon on target", "_s", name);
   3.215 -		}
   3.216 -		
   3.217 -		/* Re-draw the menu if they're still valid */
   3.218 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   3.219 -		{
   3.220 -			DisplayBeaconMenu(param1);
   3.221 -		}
   3.222 -	}
   3.223 -}
   3.224 -
   3.225 -public Action:Command_Beacon(client, args)
   3.226 -{
   3.227 -	if (args < 1)
   3.228 -	{
   3.229 -		ReplyToCommand(client, "[SM] Usage: sm_beacon <#userid|name> [0/1]");
   3.230 -		return Plugin_Handled;
   3.231 -	}
   3.232 -
   3.233 -	decl String:arg[65];
   3.234 -	GetCmdArg(1, arg, sizeof(arg));
   3.235 -	
   3.236 -	new toggle = 2;
   3.237 -	if (args > 1)
   3.238 -	{
   3.239 -		decl String:arg2[2];
   3.240 -		GetCmdArg(2, arg2, sizeof(arg2));
   3.241 -		if (arg2[0])
   3.242 -		{
   3.243 -			toggle = 1;
   3.244 -		}
   3.245 -		else
   3.246 -		{
   3.247 -			toggle = 0;
   3.248 -		}
   3.249 -	}
   3.250 -
   3.251 -	decl String:target_name[MAX_TARGET_LENGTH];
   3.252 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   3.253 -	
   3.254 -	if ((target_count = ProcessTargetString(
   3.255 -			arg,
   3.256 -			client,
   3.257 -			target_list,
   3.258 -			MAXPLAYERS,
   3.259 -			COMMAND_FILTER_ALIVE,
   3.260 -			target_name,
   3.261 -			sizeof(target_name),
   3.262 -			tn_is_ml)) <= 0)
   3.263 -	{
   3.264 -		ReplyToTargetError(client, target_count);
   3.265 -		return Plugin_Handled;
   3.266 -	}
   3.267 -	
   3.268 -	for (new i = 0; i < target_count; i++)
   3.269 -	{
   3.270 -		PerformBeacon(client, target_list[i], toggle);
   3.271 -	}
   3.272 -	
   3.273 -	if (tn_is_ml)
   3.274 -	{
   3.275 -		ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", target_name);
   3.276 -	}
   3.277 -	else
   3.278 -	{
   3.279 -		ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", "_s", target_name);
   3.280 -	}
   3.281 -	
   3.282 -	return Plugin_Handled;
   3.283 -}
     4.1 --- a/plugins/basefuncommands/blind.sp	Fri Feb 22 19:22:22 2008 +0000
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,279 +0,0 @@
     4.4 -/**
     4.5 - * vim: set ts=4 :
     4.6 - * =============================================================================
     4.7 - * SourceMod Basefuncommands Plugin
     4.8 - * Provides blind functionality
     4.9 - *
    4.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    4.11 - * =============================================================================
    4.12 - *
    4.13 - * This program is free software; you can redistribute it and/or modify it under
    4.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    4.15 - * Free Software Foundation.
    4.16 - * 
    4.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    4.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    4.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    4.20 - * details.
    4.21 - *
    4.22 - * You should have received a copy of the GNU General Public License along with
    4.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    4.24 - *
    4.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    4.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    4.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    4.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    4.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    4.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    4.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    4.32 - * or <http://www.sourcemod.net/license.php>.
    4.33 - *
    4.34 - * Version: $Id$
    4.35 - */
    4.36 -
    4.37 -new g_BlindTarget[MAXPLAYERS+1];
    4.38 -
    4.39 -SetupBlind()
    4.40 -{
    4.41 -	RegAdminCmd("sm_blind", Command_Blind, ADMFLAG_SLAY, "sm_blind <#userid|name> [amount] - Leave amount off to reset.");
    4.42 -}
    4.43 -
    4.44 -PerformBlind(client, target, amount)
    4.45 -{
    4.46 -	new targets[2];
    4.47 -	targets[0] = target;
    4.48 -	
    4.49 -	new Handle:message = StartMessageEx(g_FadeUserMsgId, targets, 1);
    4.50 -	BfWriteShort(message, 1536);
    4.51 -	BfWriteShort(message, 1536);
    4.52 -	
    4.53 -	if (amount == 0)
    4.54 -	{
    4.55 -		BfWriteShort(message, (0x0001 | 0x0010));
    4.56 -	}
    4.57 -	else
    4.58 -	{
    4.59 -		BfWriteShort(message, (0x0002 | 0x0008));
    4.60 -	}
    4.61 -	
    4.62 -	BfWriteByte(message, 0);
    4.63 -	BfWriteByte(message, 0);
    4.64 -	BfWriteByte(message, 0);
    4.65 -	BfWriteByte(message, amount);
    4.66 -	
    4.67 -	EndMessage();
    4.68 -
    4.69 -	LogAction(client, target, "\"%L\" set blind on \"%L\", amount %d.", client, target, amount);
    4.70 -}
    4.71 -
    4.72 -public AdminMenu_Blind(Handle:topmenu, 
    4.73 -					  TopMenuAction:action,
    4.74 -					  TopMenuObject:object_id,
    4.75 -					  param,
    4.76 -					  String:buffer[],
    4.77 -					  maxlength)
    4.78 -{
    4.79 -	if (action == TopMenuAction_DisplayOption)
    4.80 -	{
    4.81 -		Format(buffer, maxlength, "%T", "Blind player", param);
    4.82 -	}
    4.83 -	else if (action == TopMenuAction_SelectOption)
    4.84 -	{
    4.85 -		DisplayBlindMenu(param);
    4.86 -	}
    4.87 -	else if (action == TopMenuAction_DrawOption)
    4.88 -	{	
    4.89 -		// Disable if we could not find the user message id for Fade.
    4.90 -		buffer[0] = ((g_FadeUserMsgId == INVALID_MESSAGE_ID) ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT);
    4.91 -	}	
    4.92 -}
    4.93 -
    4.94 -DisplayBlindMenu(client)
    4.95 -{
    4.96 -	new Handle:menu = CreateMenu(MenuHandler_Blind);
    4.97 -	
    4.98 -	decl String:title[100];
    4.99 -	Format(title, sizeof(title), "%T:", "Blind player", client);
   4.100 -	SetMenuTitle(menu, title);
   4.101 -	SetMenuExitBackButton(menu, true);
   4.102 -	
   4.103 -	AddTargetsToMenu(menu, client, true, true);
   4.104 -	
   4.105 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   4.106 -}
   4.107 -
   4.108 -DisplayAmountMenu(client)
   4.109 -{
   4.110 -	new Handle:menu = CreateMenu(MenuHandler_Amount);
   4.111 -	
   4.112 -	decl String:title[100];
   4.113 -	Format(title, sizeof(title), "%T:", "Blind amount", client);
   4.114 -	SetMenuTitle(menu, title);
   4.115 -	SetMenuExitBackButton(menu, true);
   4.116 -	
   4.117 -	AddMenuItem(menu, "255", "Fully blind");
   4.118 -	AddMenuItem(menu, "240", "Half blind");
   4.119 -	AddMenuItem(menu, "0", "No blind");
   4.120 -	
   4.121 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   4.122 -}
   4.123 -
   4.124 -public MenuHandler_Blind(Handle:menu, MenuAction:action, param1, param2)
   4.125 -{
   4.126 -	if (action == MenuAction_End)
   4.127 -	{
   4.128 -		CloseHandle(menu);
   4.129 -	}
   4.130 -	else if (action == MenuAction_Cancel)
   4.131 -	{
   4.132 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   4.133 -		{
   4.134 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   4.135 -		}
   4.136 -	}
   4.137 -	else if (action == MenuAction_Select)
   4.138 -	{
   4.139 -		decl String:info[32];
   4.140 -		new userid, target;
   4.141 -		
   4.142 -		GetMenuItem(menu, param2, info, sizeof(info));
   4.143 -		userid = StringToInt(info);
   4.144 -
   4.145 -		if ((target = GetClientOfUserId(userid)) == 0)
   4.146 -		{
   4.147 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   4.148 -		}
   4.149 -		else if (!CanUserTarget(param1, target))
   4.150 -		{
   4.151 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   4.152 -		}
   4.153 -		else
   4.154 -		{
   4.155 -			g_BlindTarget[param1] = userid;
   4.156 -			DisplayAmountMenu(param1);
   4.157 -			return;	// Return, because we went to a new menu and don't want the re-draw to occur.
   4.158 -		}
   4.159 -		
   4.160 -		/* Re-draw the menu if they're still valid */
   4.161 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   4.162 -		{
   4.163 -			DisplayBlindMenu(param1);
   4.164 -		}
   4.165 -	}
   4.166 -	
   4.167 -	return;
   4.168 -}
   4.169 -
   4.170 -public MenuHandler_Amount(Handle:menu, MenuAction:action, param1, param2)
   4.171 -{
   4.172 -	if (action == MenuAction_End)
   4.173 -	{
   4.174 -		CloseHandle(menu);
   4.175 -	}
   4.176 -	else if (action == MenuAction_Cancel)
   4.177 -	{
   4.178 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   4.179 -		{
   4.180 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   4.181 -		}
   4.182 -	}
   4.183 -	else if (action == MenuAction_Select)
   4.184 -	{
   4.185 -		decl String:info[32];
   4.186 -		new amount, target;
   4.187 -		
   4.188 -		GetMenuItem(menu, param2, info, sizeof(info));
   4.189 -		amount = StringToInt(info);
   4.190 -
   4.191 -		if ((target = GetClientOfUserId(g_BlindTarget[param1])) == 0)
   4.192 -		{
   4.193 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   4.194 -		}
   4.195 -		else if (!CanUserTarget(param1, target))
   4.196 -		{
   4.197 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   4.198 -		}
   4.199 -		else
   4.200 -		{
   4.201 -			new String:name[32];
   4.202 -			GetClientName(target, name, sizeof(name));
   4.203 -			
   4.204 -			PerformBlind(param1, target, amount);
   4.205 -			ShowActivity2(param1, "[SM] ", "%t", "Set blind on target", "_s", name, amount);
   4.206 -		}
   4.207 -		
   4.208 -		/* Re-draw the menu if they're still valid */
   4.209 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   4.210 -		{
   4.211 -			DisplayBlindMenu(param1);
   4.212 -		}
   4.213 -	}
   4.214 -}
   4.215 -
   4.216 -
   4.217 -public Action:Command_Blind(client, args)
   4.218 -{
   4.219 -	if (args < 1)
   4.220 -	{
   4.221 -		ReplyToCommand(client, "[SM] Usage: sm_blind <#userid|name> [amount]");
   4.222 -		return Plugin_Handled;
   4.223 -	}
   4.224 -
   4.225 -	decl String:arg[65];
   4.226 -	GetCmdArg(1, arg, sizeof(arg));
   4.227 -	
   4.228 -	new amount = 0;
   4.229 -	if (args > 1)
   4.230 -	{
   4.231 -		decl String:arg2[20];
   4.232 -		GetCmdArg(2, arg2, sizeof(arg2));
   4.233 -		if (StringToIntEx(arg2, amount) == 0)
   4.234 -		{
   4.235 -			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   4.236 -			return Plugin_Handled;
   4.237 -		}
   4.238 -		
   4.239 -		if (amount < 0)
   4.240 -		{
   4.241 -			amount = 0;
   4.242 -		}
   4.243 -		
   4.244 -		if (amount > 255)
   4.245 -		{
   4.246 -			amount = 255;
   4.247 -		}
   4.248 -	}
   4.249 -
   4.250 -	decl String:target_name[MAX_TARGET_LENGTH];
   4.251 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   4.252 -	
   4.253 -	if ((target_count = ProcessTargetString(
   4.254 -			arg,
   4.255 -			client,
   4.256 -			target_list,
   4.257 -			MAXPLAYERS,
   4.258 -			COMMAND_FILTER_ALIVE,
   4.259 -			target_name,
   4.260 -			sizeof(target_name),
   4.261 -			tn_is_ml)) <= 0)
   4.262 -	{
   4.263 -		ReplyToTargetError(client, target_count);
   4.264 -		return Plugin_Handled;
   4.265 -	}
   4.266 -	
   4.267 -	for (new i = 0; i < target_count; i++)
   4.268 -	{
   4.269 -		PerformBlind(client, target_list[i], amount);
   4.270 -	}
   4.271 -	
   4.272 -	if (tn_is_ml)
   4.273 -	{
   4.274 -		ShowActivity2(client, "[SM] ", "%t", "Set blind on target", target_name);
   4.275 -	}
   4.276 -	else
   4.277 -	{
   4.278 -		ShowActivity2(client, "[SM] ", "%t", "Set blind on target", "_s", target_name);
   4.279 -	}
   4.280 -	
   4.281 -	return Plugin_Handled;
   4.282 -}
     5.1 --- a/plugins/basefuncommands/drug.sp	Fri Feb 22 19:22:22 2008 +0000
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,315 +0,0 @@
     5.4 -/**
     5.5 - * vim: set ts=4 :
     5.6 - * =============================================================================
     5.7 - * SourceMod Basefuncommands Plugin
     5.8 - * Provides drug functionality
     5.9 - *
    5.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    5.11 - * =============================================================================
    5.12 - *
    5.13 - * This program is free software; you can redistribute it and/or modify it under
    5.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    5.15 - * Free Software Foundation.
    5.16 - * 
    5.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    5.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    5.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    5.20 - * details.
    5.21 - *
    5.22 - * You should have received a copy of the GNU General Public License along with
    5.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    5.24 - *
    5.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    5.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    5.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    5.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    5.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    5.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    5.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    5.32 - * or <http://www.sourcemod.net/license.php>.
    5.33 - *
    5.34 - * Version: $Id$
    5.35 - */
    5.36 -
    5.37 -new Handle:g_DrugTimers[MAXPLAYERS+1];
    5.38 -new Float:g_DrugAngles[20] = {0.0, 5.0, 10.0, 15.0, 20.0, 25.0, 20.0, 15.0, 10.0, 5.0, 0.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0};
    5.39 -
    5.40 -SetupDrugs()
    5.41 -{
    5.42 -	RegAdminCmd("sm_drug", Command_Drug, ADMFLAG_SLAY, "sm_drug <#userid|name> [0/1]");
    5.43 -}
    5.44 -
    5.45 -CreateDrug(client)
    5.46 -{
    5.47 -	g_DrugTimers[client] = CreateTimer(1.0, Timer_Drug, client, TIMER_REPEAT);	
    5.48 -}
    5.49 -
    5.50 -KillDrug(client)
    5.51 -{
    5.52 -	KillDrugTimer(client);
    5.53 -	
    5.54 -	new Float:pos[3];
    5.55 -	GetClientAbsOrigin(client, pos);
    5.56 -	new Float:angs[3];
    5.57 -	GetClientEyeAngles(client, angs);
    5.58 -	
    5.59 -	angs[2] = 0.0;
    5.60 -	
    5.61 -	TeleportEntity(client, pos, angs, NULL_VECTOR);	
    5.62 -	
    5.63 -	new clients[2];
    5.64 -	clients[0] = client;	
    5.65 -	
    5.66 -	new Handle:message = StartMessageEx(g_FadeUserMsgId, clients, 1);
    5.67 -	BfWriteShort(message, 1536);
    5.68 -	BfWriteShort(message, 1536);
    5.69 -	BfWriteShort(message, (0x0001 | 0x0010));
    5.70 -	BfWriteByte(message, 0);
    5.71 -	BfWriteByte(message, 0);
    5.72 -	BfWriteByte(message, 0);
    5.73 -	BfWriteByte(message, 0);
    5.74 -	EndMessage();	
    5.75 -}
    5.76 -
    5.77 -KillDrugTimer(client)
    5.78 -{
    5.79 -	KillTimer(g_DrugTimers[client]);
    5.80 -	g_DrugTimers[client] = INVALID_HANDLE;	
    5.81 -}
    5.82 -
    5.83 -KillAllDrugs()
    5.84 -{
    5.85 -	new maxclients = GetMaxClients();
    5.86 -	for (new i = 1; i <= maxclients; i++)
    5.87 -	{
    5.88 -		if (g_DrugTimers[i] != INVALID_HANDLE)
    5.89 -		{
    5.90 -			if(IsClientInGame(i))
    5.91 -			{
    5.92 -				KillDrug(i);
    5.93 -			}
    5.94 -			else
    5.95 -			{
    5.96 -				KillDrugTimer(i);
    5.97 -			}
    5.98 -		}
    5.99 -	}
   5.100 -}
   5.101 -
   5.102 -PerformDrug(client, target, toggle)
   5.103 -{
   5.104 -	switch (toggle)
   5.105 -	{
   5.106 -		case (2):
   5.107 -		{
   5.108 -			if (g_DrugTimers[target] == INVALID_HANDLE)
   5.109 -			{
   5.110 -				CreateDrug(target);
   5.111 -				LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
   5.112 -			}
   5.113 -			else
   5.114 -			{
   5.115 -				KillDrug(target);
   5.116 -				LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
   5.117 -			}			
   5.118 -		}
   5.119 -
   5.120 -		case (1):
   5.121 -		{
   5.122 -			if (g_DrugTimers[target] == INVALID_HANDLE)
   5.123 -			{
   5.124 -				CreateDrug(target);
   5.125 -				LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
   5.126 -			}			
   5.127 -		}
   5.128 -		
   5.129 -		case (0):
   5.130 -		{
   5.131 -			if (g_DrugTimers[target] != INVALID_HANDLE)
   5.132 -			{
   5.133 -				KillDrug(target);
   5.134 -				LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
   5.135 -			}			
   5.136 -		}
   5.137 -	}
   5.138 -}
   5.139 -
   5.140 -public Action:Timer_Drug(Handle:timer, any:client)
   5.141 -{
   5.142 -	if (!IsClientInGame(client))
   5.143 -	{
   5.144 -		KillDrugTimer(client);
   5.145 -
   5.146 -		return Plugin_Handled;
   5.147 -	}
   5.148 -	
   5.149 -	if (!IsPlayerAlive(client))
   5.150 -	{
   5.151 -		KillDrug(client);
   5.152 -		
   5.153 -		return Plugin_Handled;
   5.154 -	}
   5.155 -	
   5.156 -	new Float:pos[3];
   5.157 -	GetClientAbsOrigin(client, pos);
   5.158 -	
   5.159 -	new Float:angs[3];
   5.160 -	GetClientEyeAngles(client, angs);
   5.161 -	
   5.162 -	angs[2] = g_DrugAngles[GetRandomInt(0,100) % 20];
   5.163 -	
   5.164 -	TeleportEntity(client, pos, angs, NULL_VECTOR);
   5.165 -	
   5.166 -	new clients[2];
   5.167 -	clients[0] = client;	
   5.168 -	
   5.169 -	new Handle:message = StartMessageEx(g_FadeUserMsgId, clients, 1);
   5.170 -	BfWriteShort(message, 255);
   5.171 -	BfWriteShort(message, 255);
   5.172 -	BfWriteShort(message, (0x0002));
   5.173 -	BfWriteByte(message, GetRandomInt(0,255));
   5.174 -	BfWriteByte(message, GetRandomInt(0,255));
   5.175 -	BfWriteByte(message, GetRandomInt(0,255));
   5.176 -	BfWriteByte(message, 128);
   5.177 -	
   5.178 -	EndMessage();	
   5.179 -		
   5.180 -	return Plugin_Handled;
   5.181 -}
   5.182 -
   5.183 -public AdminMenu_Drug(Handle:topmenu, 
   5.184 -					  TopMenuAction:action,
   5.185 -					  TopMenuObject:object_id,
   5.186 -					  param,
   5.187 -					  String:buffer[],
   5.188 -					  maxlength)
   5.189 -{
   5.190 -	if (action == TopMenuAction_DisplayOption)
   5.191 -	{
   5.192 -		Format(buffer, maxlength, "%T", "Drug player", param);
   5.193 -	}
   5.194 -	else if (action == TopMenuAction_SelectOption)
   5.195 -	{
   5.196 -		DisplayDrugMenu(param);
   5.197 -	}
   5.198 -}
   5.199 -
   5.200 -DisplayDrugMenu(client)
   5.201 -{
   5.202 -	new Handle:menu = CreateMenu(MenuHandler_Drug);
   5.203 -	
   5.204 -	decl String:title[100];
   5.205 -	Format(title, sizeof(title), "%T:", "Drug player", client);
   5.206 -	SetMenuTitle(menu, title);
   5.207 -	SetMenuExitBackButton(menu, true);
   5.208 -	
   5.209 -	AddTargetsToMenu(menu, client, true, true);
   5.210 -	
   5.211 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   5.212 -}
   5.213 -
   5.214 -public MenuHandler_Drug(Handle:menu, MenuAction:action, param1, param2)
   5.215 -{
   5.216 -	if (action == MenuAction_End)
   5.217 -	{
   5.218 -		CloseHandle(menu);
   5.219 -	}
   5.220 -	else if (action == MenuAction_Cancel)
   5.221 -	{
   5.222 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   5.223 -		{
   5.224 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   5.225 -		}
   5.226 -	}
   5.227 -	else if (action == MenuAction_Select)
   5.228 -	{
   5.229 -		decl String:info[32];
   5.230 -		new userid, target;
   5.231 -		
   5.232 -		GetMenuItem(menu, param2, info, sizeof(info));
   5.233 -		userid = StringToInt(info);
   5.234 -
   5.235 -		if ((target = GetClientOfUserId(userid)) == 0)
   5.236 -		{
   5.237 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   5.238 -		}
   5.239 -		else if (!CanUserTarget(param1, target))
   5.240 -		{
   5.241 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   5.242 -		}
   5.243 -		else
   5.244 -		{
   5.245 -			new String:name[32];
   5.246 -			GetClientName(target, name, sizeof(name));
   5.247 -			
   5.248 -			PerformDrug(param1, target, 2);
   5.249 -			ShowActivity2(param1, "[SM] ", "%t", "Toggled drug on target", "_s", name);
   5.250 -		}
   5.251 -		
   5.252 -		/* Re-draw the menu if they're still valid */
   5.253 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   5.254 -		{
   5.255 -			DisplayDrugMenu(param1);
   5.256 -		}
   5.257 -	}
   5.258 -}
   5.259 -
   5.260 -public Action:Command_Drug(client, args)
   5.261 -{
   5.262 -	if (args < 1)
   5.263 -	{
   5.264 -		ReplyToCommand(client, "[SM] Usage: sm_drug <#userid|name> [0/1]");
   5.265 -		return Plugin_Handled;
   5.266 -	}
   5.267 -
   5.268 -	decl String:arg[65];
   5.269 -	GetCmdArg(1, arg, sizeof(arg));
   5.270 -	
   5.271 -	new toggle = 2;
   5.272 -	if (args > 1)
   5.273 -	{
   5.274 -		decl String:arg2[2];
   5.275 -		GetCmdArg(2, arg2, sizeof(arg2));
   5.276 -		if (arg2[0])
   5.277 -		{
   5.278 -			toggle = 1;
   5.279 -		}
   5.280 -		else
   5.281 -		{
   5.282 -			toggle = 0;
   5.283 -		}
   5.284 -	}
   5.285 -
   5.286 -	decl String:target_name[MAX_TARGET_LENGTH];
   5.287 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   5.288 -	
   5.289 -	if ((target_count = ProcessTargetString(
   5.290 -			arg,
   5.291 -			client,
   5.292 -			target_list,
   5.293 -			MAXPLAYERS,
   5.294 -			COMMAND_FILTER_ALIVE,
   5.295 -			target_name,
   5.296 -			sizeof(target_name),
   5.297 -			tn_is_ml)) <= 0)
   5.298 -	{
   5.299 -		ReplyToTargetError(client, target_count);
   5.300 -		return Plugin_Handled;
   5.301 -	}
   5.302 -	
   5.303 -	for (new i = 0; i < target_count; i++)
   5.304 -	{
   5.305 -		PerformDrug(client, target_list[i], toggle);
   5.306 -	}
   5.307 -	
   5.308 -	if (tn_is_ml)
   5.309 -	{
   5.310 -		ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", target_name);
   5.311 -	}
   5.312 -	else
   5.313 -	{
   5.314 -		ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", "_s", target_name);
   5.315 -	}
   5.316 -	
   5.317 -	return Plugin_Handled;
   5.318 -}
     6.1 --- a/plugins/basefuncommands/fire.sp	Fri Feb 22 19:22:22 2008 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,504 +0,0 @@
     6.4 -/**
     6.5 - * vim: set ts=4 :
     6.6 - * =============================================================================
     6.7 - * SourceMod Basefuncommands Plugin
     6.8 - * Provides FireBomb functionality
     6.9 - *
    6.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    6.11 - * =============================================================================
    6.12 - *
    6.13 - * This program is free software; you can redistribute it and/or modify it under
    6.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    6.15 - * Free Software Foundation.
    6.16 - * 
    6.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    6.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    6.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    6.20 - * details.
    6.21 - *
    6.22 - * You should have received a copy of the GNU General Public License along with
    6.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    6.24 - *
    6.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    6.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    6.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    6.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    6.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    6.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    6.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    6.32 - * or <http://www.sourcemod.net/license.php>.
    6.33 - *
    6.34 - * Version: $Id$
    6.35 - */
    6.36 -
    6.37 -new Handle:g_FireBombTimers[MAXPLAYERS+1];
    6.38 -new g_FireBombTracker[MAXPLAYERS+1];
    6.39 -
    6.40 -new Handle:g_BurnDuration = INVALID_HANDLE;
    6.41 -new Handle:g_FireBombTicks = INVALID_HANDLE;
    6.42 -new Handle:g_FireBombRadius = INVALID_HANDLE;
    6.43 -new Handle:g_FireBombMode = INVALID_HANDLE;
    6.44 -
    6.45 -SetupFire()
    6.46 -{
    6.47 -	RegAdminCmd("sm_burn", Command_Burn, ADMFLAG_SLAY, "sm_burn <#userid|name> [time]");
    6.48 -	RegAdminCmd("sm_firebomb", Command_FireBomb, ADMFLAG_SLAY, "sm_firebomb <#userid|name> [0/1]");	
    6.49 -	
    6.50 -	g_BurnDuration = CreateConVar("sm_burn_duration", "20", "Sets the default duration of sm_burn and firebomb victims.", 0, true, 0.5, true, 20.0);
    6.51 -	g_FireBombTicks = CreateConVar("sm_firebomb_ticks", "10", "Sets how long the FireBomb fuse is.", 0, true, 5.0, true, 120.0);
    6.52 -	g_FireBombRadius = CreateConVar("sm_firebomb_radius", "600", "Sets the bomb blast radius.", 0, true, 50.0, true, 3000.0);
    6.53 -	g_FireBombMode = CreateConVar("sm_firebomb_mode", "0", "Who is targetted by the FireBomb? 0 = Target only, 1 = Target's team, 2 = Everyone", 0, true, 0.0, true, 2.0);
    6.54 -}
    6.55 -
    6.56 -CreateFireBomb(client)
    6.57 -{
    6.58 -	g_FireBombTimers[client] = CreateTimer(1.0, Timer_FireBomb, client, TIMER_REPEAT);
    6.59 -	g_FireBombTracker[client] = GetConVarInt(g_FireBombTicks);
    6.60 -}
    6.61 -
    6.62 -KillFireBomb(client)
    6.63 -{
    6.64 -	KillTimer(g_FireBombTimers[client]);
    6.65 -	g_FireBombTimers[client] = INVALID_HANDLE;
    6.66 -}
    6.67 -
    6.68 -KillAllFireBombs()
    6.69 -{
    6.70 -	new maxclients = GetMaxClients();
    6.71 -	for (new i = 1; i <= maxclients; i++)
    6.72 -	{
    6.73 -		if (g_FireBombTimers[i] != INVALID_HANDLE)
    6.74 -		{
    6.75 -			KillFireBomb(i);
    6.76 -		}
    6.77 -	}
    6.78 -}
    6.79 -
    6.80 -PerformBurn(client, target, Float:seconds)
    6.81 -{
    6.82 -	LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
    6.83 -	IgniteEntity(target, seconds);
    6.84 -}
    6.85 -
    6.86 -PerformFireBomb(client, target, toggle)
    6.87 -{
    6.88 -	switch (toggle)
    6.89 -	{
    6.90 -		case (2):
    6.91 -		{
    6.92 -			if (g_FireBombTimers[target] == INVALID_HANDLE)
    6.93 -			{
    6.94 -				CreateFireBomb(target);
    6.95 -				LogAction(client, target, "\"%L\" set a FireBomb on \"%L\"", client, target);
    6.96 -			}
    6.97 -			else
    6.98 -			{
    6.99 -				KillFireBomb(target);
   6.100 -				SetEntityRenderColor(client, 255, 255, 255, 255);
   6.101 -				LogAction(client, target, "\"%L\" removed a FireBomb on \"%L\"", client, target);
   6.102 -			}			
   6.103 -		}
   6.104 -
   6.105 -		case (1):
   6.106 -		{
   6.107 -			if (g_FireBombTimers[target] == INVALID_HANDLE)
   6.108 -			{
   6.109 -				CreateFireBomb(target);
   6.110 -				LogAction(client, target, "\"%L\" set a FireBomb on \"%L\"", client, target);
   6.111 -			}			
   6.112 -		}
   6.113 -		
   6.114 -		case (0):
   6.115 -		{
   6.116 -			if (g_FireBombTimers[target] != INVALID_HANDLE)
   6.117 -			{
   6.118 -				KillFireBomb(target);
   6.119 -				SetEntityRenderColor(client, 255, 255, 255, 255);
   6.120 -				LogAction(client, target, "\"%L\" removed a FireBomb on \"%L\"", client, target);
   6.121 -			}			
   6.122 -		}
   6.123 -	}
   6.124 -}
   6.125 -
   6.126 -public Action:Timer_FireBomb(Handle:timer, any:client)
   6.127 -{
   6.128 -	if (!IsClientInGame(client) || !IsPlayerAlive(client))
   6.129 -	{
   6.130 -		KillFireBomb(client);		
   6.131 -
   6.132 -		return Plugin_Handled;
   6.133 -	}
   6.134 -	
   6.135 -	g_FireBombTracker[client]--;
   6.136 -	
   6.137 -	new Float:vec[3];
   6.138 -	GetClientEyePosition(client, vec);
   6.139 -	
   6.140 -	if (g_FireBombTracker[client] > 0)
   6.141 -	{
   6.142 -		new color;
   6.143 -		
   6.144 -		if (g_FireBombTracker[client] > 1)
   6.145 -		{
   6.146 -			color = RoundToFloor(g_FireBombTracker[client] * (255.0 / GetConVarFloat(g_FireBombTicks)));
   6.147 -			EmitAmbientSound(SOUND_BEEP, vec, client, SNDLEVEL_RAIDSIREN);	
   6.148 -		}
   6.149 -		else
   6.150 -		{
   6.151 -			color = 0;
   6.152 -			EmitAmbientSound(SOUND_FINAL, vec, client, SNDLEVEL_RAIDSIREN);
   6.153 -		}
   6.154 -		
   6.155 -		SetEntityRenderColor(client, 255, color, color, 255);
   6.156 -
   6.157 -		decl String:name[64];
   6.158 -		GetClientName(client, name, sizeof(name));
   6.159 -		PrintCenterTextAll("%t", "Till Explodes", name, g_FireBombTracker[client]);		
   6.160 -		
   6.161 -		GetClientAbsOrigin(client, vec);
   6.162 -		vec[2] += 10;
   6.163 -
   6.164 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_FireBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
   6.165 -		TE_SendToAll();
   6.166 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_FireBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
   6.167 -		TE_SendToAll();
   6.168 -	}
   6.169 -	else
   6.170 -	{
   6.171 -		TE_SetupExplosion(vec, g_ExplosionSprite, 0.1, 1, 0, GetConVarInt(g_FireBombRadius), 5000);
   6.172 -		TE_SendToAll();
   6.173 -		
   6.174 -		GetClientAbsOrigin(client, vec);
   6.175 -		vec[2] += 10;
   6.176 -		TE_SetupBeamRingPoint(vec, 50.0, GetConVarFloat(g_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.5, 30.0, 1.5, orangeColor, 5, 0);
   6.177 -		TE_SendToAll();
   6.178 -		vec[2] += 15;
   6.179 -		TE_SetupBeamRingPoint(vec, 40.0, GetConVarFloat(g_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 30.0, 1.5, orangeColor, 5, 0);
   6.180 -		TE_SendToAll();	
   6.181 -		vec[2] += 15;
   6.182 -		TE_SetupBeamRingPoint(vec, 30.0, GetConVarFloat(g_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.7, 30.0, 1.5, orangeColor, 5, 0);
   6.183 -		TE_SendToAll();
   6.184 -		vec[2] += 15;
   6.185 -		TE_SetupBeamRingPoint(vec, 20.0, GetConVarFloat(g_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.8, 30.0, 1.5, orangeColor, 5, 0);
   6.186 -		TE_SendToAll();		
   6.187 -		
   6.188 -		EmitAmbientSound(SOUND_BOOM, vec, client, SNDLEVEL_RAIDSIREN);
   6.189 -
   6.190 -		IgniteEntity(client, GetConVarFloat(g_BurnDuration));
   6.191 -		KillFireBomb(client);
   6.192 -		SetEntityRenderColor(client, 255, 255, 255, 255);
   6.193 -		
   6.194 -		if (GetConVarInt(g_FireBombMode) > 0)
   6.195 -		{
   6.196 -			new teamOnly = ((GetConVarInt(g_FireBombMode) == 1) ? true : false);
   6.197 -			new maxClients = GetMaxClients();
   6.198 -			
   6.199 -			for (new i = 1; i < maxClients; i++)
   6.200 -			{
   6.201 -				if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
   6.202 -				{
   6.203 -					continue;
   6.204 -				}
   6.205 -				
   6.206 -				if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
   6.207 -				{
   6.208 -					continue;
   6.209 -				}
   6.210 -				
   6.211 -				new Float:pos[3];
   6.212 -				GetClientAbsOrigin(i, pos);
   6.213 -				
   6.214 -				new Float:distance = GetVectorDistance(vec, pos);
   6.215 -				
   6.216 -				if (distance > GetConVarFloat(g_FireBombRadius))
   6.217 -				{
   6.218 -					continue;
   6.219 -				}
   6.220 -				
   6.221 -				new Float:duration = GetConVarFloat(g_BurnDuration);
   6.222 -				duration *= (GetConVarFloat(g_FireBombRadius) - distance) / GetConVarFloat(g_FireBombRadius);
   6.223 -
   6.224 -				IgniteEntity(i, duration);
   6.225 -			}		
   6.226 -		}
   6.227 -	}
   6.228 -			
   6.229 -	return Plugin_Handled;
   6.230 -}
   6.231 -
   6.232 -public AdminMenu_Burn(Handle:topmenu, 
   6.233 -					  TopMenuAction:action,
   6.234 -					  TopMenuObject:object_id,
   6.235 -					  param,
   6.236 -					  String:buffer[],
   6.237 -					  maxlength)
   6.238 -{
   6.239 -	if (action == TopMenuAction_DisplayOption)
   6.240 -	{
   6.241 -		Format(buffer, maxlength, "%T", "Burn player", param);
   6.242 -	}
   6.243 -	else if (action == TopMenuAction_SelectOption)
   6.244 -	{
   6.245 -		DisplayBurnMenu(param);
   6.246 -	}
   6.247 -}
   6.248 -
   6.249 -public AdminMenu_FireBomb(Handle:topmenu, 
   6.250 -					  TopMenuAction:action,
   6.251 -					  TopMenuObject:object_id,
   6.252 -					  param,
   6.253 -					  String:buffer[],
   6.254 -					  maxlength)
   6.255 -{
   6.256 -	if (action == TopMenuAction_DisplayOption)
   6.257 -	{
   6.258 -		Format(buffer, maxlength, "%T", "FireBomb player", param);
   6.259 -	}
   6.260 -	else if (action == TopMenuAction_SelectOption)
   6.261 -	{
   6.262 -		DisplayFireBombMenu(param);
   6.263 -	}
   6.264 -}
   6.265 -
   6.266 -DisplayBurnMenu(client)
   6.267 -{
   6.268 -	new Handle:menu = CreateMenu(MenuHandler_Burn);
   6.269 -	
   6.270 -	decl String:title[100];
   6.271 -	Format(title, sizeof(title), "%T:", "Burn player", client);
   6.272 -	SetMenuTitle(menu, title);
   6.273 -	SetMenuExitBackButton(menu, true);
   6.274 -	
   6.275 -	AddTargetsToMenu(menu, client, true, true);
   6.276 -	
   6.277 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   6.278 -}
   6.279 -
   6.280 -DisplayFireBombMenu(client)
   6.281 -{
   6.282 -	new Handle:menu = CreateMenu(MenuHandler_FireBomb);
   6.283 -	
   6.284 -	decl String:title[100];
   6.285 -	Format(title, sizeof(title), "%T:", "FireBomb player", client);
   6.286 -	SetMenuTitle(menu, title);
   6.287 -	SetMenuExitBackButton(menu, true);
   6.288 -	
   6.289 -	AddTargetsToMenu(menu, client, true, true);
   6.290 -	
   6.291 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   6.292 -}
   6.293 -
   6.294 -public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
   6.295 -{
   6.296 -	if (action == MenuAction_End)
   6.297 -	{
   6.298 -		CloseHandle(menu);
   6.299 -	}
   6.300 -	else if (action == MenuAction_Cancel)
   6.301 -	{
   6.302 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   6.303 -		{
   6.304 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   6.305 -		}
   6.306 -	}
   6.307 -	else if (action == MenuAction_Select)
   6.308 -	{
   6.309 -		decl String:info[32];
   6.310 -		new userid, target;
   6.311 -		
   6.312 -		GetMenuItem(menu, param2, info, sizeof(info));
   6.313 -		userid = StringToInt(info);
   6.314 -
   6.315 -		if ((target = GetClientOfUserId(userid)) == 0)
   6.316 -		{
   6.317 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   6.318 -		}
   6.319 -		else if (!CanUserTarget(param1, target))
   6.320 -		{
   6.321 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   6.322 -		}
   6.323 -		else
   6.324 -		{
   6.325 -			new String:name[32];
   6.326 -			GetClientName(target, name, sizeof(name));
   6.327 -			PerformBurn(param1, target, 20.0);
   6.328 -			ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
   6.329 -		}
   6.330 -		
   6.331 -		/* Re-draw the menu if they're still valid */
   6.332 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   6.333 -		{
   6.334 -			DisplayBurnMenu(param1);
   6.335 -		}
   6.336 -	}
   6.337 -}
   6.338 -
   6.339 -public MenuHandler_FireBomb(Handle:menu, MenuAction:action, param1, param2)
   6.340 -{
   6.341 -	if (action == MenuAction_End)
   6.342 -	{
   6.343 -		CloseHandle(menu);
   6.344 -	}
   6.345 -	else if (action == MenuAction_Cancel)
   6.346 -	{
   6.347 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   6.348 -		{
   6.349 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   6.350 -		}
   6.351 -	}
   6.352 -	else if (action == MenuAction_Select)
   6.353 -	{
   6.354 -		decl String:info[32];
   6.355 -		new userid, target;
   6.356 -		
   6.357 -		GetMenuItem(menu, param2, info, sizeof(info));
   6.358 -		userid = StringToInt(info);
   6.359 -
   6.360 -		if ((target = GetClientOfUserId(userid)) == 0)
   6.361 -		{
   6.362 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   6.363 -		}
   6.364 -		else if (!CanUserTarget(param1, target))
   6.365 -		{
   6.366 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   6.367 -		}
   6.368 -		else
   6.369 -		{
   6.370 -			new String:name[32];
   6.371 -			GetClientName(target, name, sizeof(name));
   6.372 -			
   6.373 -			PerformFireBomb(param1, target, 2);
   6.374 -			ShowActivity2(param1, "[SM] ", "%t", "Toggled FireBomb on target", "_s", name);
   6.375 -		}
   6.376 -		
   6.377 -		/* Re-draw the menu if they're still valid */
   6.378 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   6.379 -		{
   6.380 -			DisplayFireBombMenu(param1);
   6.381 -		}
   6.382 -	}
   6.383 -}
   6.384 -
   6.385 -public Action:Command_Burn(client, args)
   6.386 -{
   6.387 -	if (args < 1)
   6.388 -	{
   6.389 -		ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
   6.390 -		return Plugin_Handled;
   6.391 -	}
   6.392 -
   6.393 -	decl String:arg[65];
   6.394 -	GetCmdArg(1, arg, sizeof(arg));
   6.395 -
   6.396 -	new Float:seconds = GetConVarFloat(g_BurnDuration);
   6.397 -	
   6.398 -	if (args > 1)
   6.399 -	{
   6.400 -		decl String:time[20];
   6.401 -		GetCmdArg(2, time, sizeof(time));
   6.402 -		if (StringToFloatEx(time, seconds) == 0)
   6.403 -		{
   6.404 -			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   6.405 -			return Plugin_Handled;
   6.406 -		}
   6.407 -	}
   6.408 -	
   6.409 -	decl String:target_name[MAX_TARGET_LENGTH];
   6.410 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   6.411 -	
   6.412 -	if ((target_count = ProcessTargetString(
   6.413 -			arg,
   6.414 -			client,
   6.415 -			target_list,
   6.416 -			MAXPLAYERS,
   6.417 -			COMMAND_FILTER_ALIVE,
   6.418 -			target_name,
   6.419 -			sizeof(target_name),
   6.420 -			tn_is_ml)) <= 0)
   6.421 -	{
   6.422 -		ReplyToTargetError(client, target_count);
   6.423 -		return Plugin_Handled;
   6.424 -	}
   6.425 -	
   6.426 -	for (new i = 0; i < target_count; i++)
   6.427 -	{
   6.428 -		PerformBurn(client, target_list[i], seconds);
   6.429 -	}
   6.430 -	
   6.431 -	if (tn_is_ml)
   6.432 -	{
   6.433 -		ShowActivity2(client, "[SM] ", "%t", "Set target on fire", target_name);
   6.434 -	}
   6.435 -	else
   6.436 -	{
   6.437 -		ShowActivity2(client, "[SM] ", "%t", "Set target on fire", "_s", target_name);
   6.438 -	}
   6.439 -
   6.440 -	return Plugin_Handled;
   6.441 -}
   6.442 -
   6.443 -public Action:Command_FireBomb(client, args)
   6.444 -{
   6.445 -	if (args < 1)
   6.446 -	{
   6.447 -		ReplyToCommand(client, "[SM] Usage: sm_firebomb <#userid|name> [0/1]");
   6.448 -		return Plugin_Handled;
   6.449 -	}
   6.450 -
   6.451 -	decl String:arg[65];
   6.452 -	GetCmdArg(1, arg, sizeof(arg));
   6.453 -	
   6.454 -	new toggle = 2;
   6.455 -	if (args > 1)
   6.456 -	{
   6.457 -		decl String:arg2[2];
   6.458 -		GetCmdArg(2, arg2, sizeof(arg2));
   6.459 -		if (arg2[0])
   6.460 -		{
   6.461 -			toggle = 1;
   6.462 -		}
   6.463 -		else
   6.464 -		{
   6.465 -			toggle = 0;
   6.466 -		}
   6.467 -	}
   6.468 -
   6.469 -	decl String:target_name[MAX_TARGET_LENGTH];
   6.470 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   6.471 -	
   6.472 -	if ((target_count = ProcessTargetString(
   6.473 -			arg,
   6.474 -			client,
   6.475 -			target_list,
   6.476 -			MAXPLAYERS,
   6.477 -			COMMAND_FILTER_ALIVE,
   6.478 -			target_name,
   6.479 -			sizeof(target_name),
   6.480 -			tn_is_ml)) <= 0)
   6.481 -	{
   6.482 -		ReplyToTargetError(client, target_count);
   6.483 -		return Plugin_Handled;
   6.484 -	}
   6.485 -	
   6.486 -	for (new i = 0; i < target_count; i++)
   6.487 -	{
   6.488 -		PerformFireBomb(client, target_list[i], toggle);
   6.489 -	}
   6.490 -	
   6.491 -	if (tn_is_ml)
   6.492 -	{
   6.493 -		ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", target_name);
   6.494 -	}
   6.495 -	else
   6.496 -	{
   6.497 -		ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", "_s", target_name);
   6.498 -	}
   6.499 -	
   6.500 -	return Plugin_Handled;
   6.501 -}
   6.502 -
   6.503 -
   6.504 -
   6.505 -
   6.506 -
   6.507 -
     7.1 --- a/plugins/basefuncommands/gravity.sp	Fri Feb 22 19:22:22 2008 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,252 +0,0 @@
     7.4 -/**
     7.5 - * vim: set ts=4 :
     7.6 - * =============================================================================
     7.7 - * SourceMod Basefuncommands Plugin
     7.8 - * Provides gravity functionality
     7.9 - *
    7.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    7.11 - * =============================================================================
    7.12 - *
    7.13 - * This program is free software; you can redistribute it and/or modify it under
    7.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    7.15 - * Free Software Foundation.
    7.16 - * 
    7.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    7.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    7.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    7.20 - * details.
    7.21 - *
    7.22 - * You should have received a copy of the GNU General Public License along with
    7.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    7.24 - *
    7.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    7.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    7.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    7.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    7.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    7.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    7.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    7.32 - * or <http://www.sourcemod.net/license.php>.
    7.33 - *
    7.34 - * Version: $Id$
    7.35 - */
    7.36 -
    7.37 -new g_GravityTarget[MAXPLAYERS+1];
    7.38 -
    7.39 -SetupGravity()
    7.40 -{
    7.41 -	RegAdminCmd("sm_gravity", Command_Gravity, ADMFLAG_SLAY, "sm_gravity <#userid|name> [amount] - Leave amount off to reset. Amount is 0.0 through 5.0");
    7.42 -}
    7.43 -
    7.44 -PerformGravity(client, target, Float:amount)
    7.45 -{
    7.46 -	new offset = FindDataMapOffs(client, "m_flGravity");
    7.47 -	new Float:temp = GetEntDataFloat(client, offset);
    7.48 -	PrintToChatAll("Gravity check %f", temp);
    7.49 -	
    7.50 -	SetEntityGravity(target, amount);
    7.51 -	LogAction(client, target, "\"%L\" set gravity on \"%L\" to %d.", client, target, amount);
    7.52 -}
    7.53 -
    7.54 -public AdminMenu_Gravity(Handle:topmenu, 
    7.55 -					  TopMenuAction:action,
    7.56 -					  TopMenuObject:object_id,
    7.57 -					  param,
    7.58 -					  String:buffer[],
    7.59 -					  maxlength)
    7.60 -{
    7.61 -	if (action == TopMenuAction_DisplayOption)
    7.62 -	{
    7.63 -		Format(buffer, maxlength, "%T", "Gravity player", param);
    7.64 -	}
    7.65 -	else if (action == TopMenuAction_SelectOption)
    7.66 -	{
    7.67 -		DisplayGravityMenu(param);
    7.68 -	}
    7.69 -}
    7.70 -
    7.71 -DisplayGravityMenu(client)
    7.72 -{
    7.73 -	new Handle:menu = CreateMenu(MenuHandler_Gravity);
    7.74 -	
    7.75 -	decl String:title[100];
    7.76 -	Format(title, sizeof(title), "%T:", "Gravity player", client);
    7.77 -	SetMenuTitle(menu, title);
    7.78 -	SetMenuExitBackButton(menu, true);
    7.79 -	
    7.80 -	AddTargetsToMenu(menu, client, true, true);
    7.81 -	
    7.82 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    7.83 -}
    7.84 -
    7.85 -DisplayGravityAmountMenu(client)
    7.86 -{
    7.87 -	new Handle:menu = CreateMenu(MenuHandler_GravityAmount);
    7.88 -	
    7.89 -	decl String:title[100];
    7.90 -	Format(title, sizeof(title), "%T:", "Gravity amount", client);
    7.91 -	SetMenuTitle(menu, title);
    7.92 -	SetMenuExitBackButton(menu, true);
    7.93 -	
    7.94 -	AddMenuItem(menu, "4.0", "Gravity Very High");
    7.95 -	AddMenuItem(menu, "2.0", "Gravity High");
    7.96 -	AddMenuItem(menu, "1.0", "Gravity Normal");
    7.97 -	AddMenuItem(menu, "0.5", "Gravity Low");
    7.98 -	AddMenuItem(menu, "0.1", "Gravity Very Low");
    7.99 -	
   7.100 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   7.101 -}
   7.102 -
   7.103 -public MenuHandler_Gravity(Handle:menu, MenuAction:action, param1, param2)
   7.104 -{
   7.105 -	if (action == MenuAction_End)
   7.106 -	{
   7.107 -		CloseHandle(menu);
   7.108 -	}
   7.109 -	else if (action == MenuAction_Cancel)
   7.110 -	{
   7.111 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   7.112 -		{
   7.113 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   7.114 -		}
   7.115 -	}
   7.116 -	else if (action == MenuAction_Select)
   7.117 -	{
   7.118 -		decl String:info[32];
   7.119 -		new userid, target;
   7.120 -		
   7.121 -		GetMenuItem(menu, param2, info, sizeof(info));
   7.122 -		userid = StringToInt(info);
   7.123 -
   7.124 -		if ((target = GetClientOfUserId(userid)) == 0)
   7.125 -		{
   7.126 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   7.127 -		}
   7.128 -		else if (!CanUserTarget(param1, target))
   7.129 -		{
   7.130 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   7.131 -		}
   7.132 -		else
   7.133 -		{
   7.134 -			g_GravityTarget[param1] = userid;
   7.135 -			DisplayGravityAmountMenu(param1);
   7.136 -			return;	// Return, because we went to a new menu and don't want the re-draw to occur.
   7.137 -		}
   7.138 -		
   7.139 -		/* Re-draw the menu if they're still valid */
   7.140 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   7.141 -		{
   7.142 -			DisplayGravityMenu(param1);
   7.143 -		}
   7.144 -	}
   7.145 -	
   7.146 -	return;
   7.147 -}
   7.148 -
   7.149 -public MenuHandler_GravityAmount(Handle:menu, MenuAction:action, param1, param2)
   7.150 -{
   7.151 -	if (action == MenuAction_End)
   7.152 -	{
   7.153 -		CloseHandle(menu);
   7.154 -	}
   7.155 -	else if (action == MenuAction_Cancel)
   7.156 -	{
   7.157 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   7.158 -		{
   7.159 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   7.160 -		}
   7.161 -	}
   7.162 -	else if (action == MenuAction_Select)
   7.163 -	{
   7.164 -		decl String:info[32];
   7.165 -		new Float:amount, target;
   7.166 -		
   7.167 -		GetMenuItem(menu, param2, info, sizeof(info));
   7.168 -		amount = StringToFloat(info);
   7.169 -
   7.170 -		if ((target = GetClientOfUserId(g_GravityTarget[param1])) == 0)
   7.171 -		{
   7.172 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   7.173 -		}
   7.174 -		else if (!CanUserTarget(param1, target))
   7.175 -		{
   7.176 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   7.177 -		}
   7.178 -		else
   7.179 -		{
   7.180 -			new String:name[32];
   7.181 -			GetClientName(target, name, sizeof(name));
   7.182 -			
   7.183 -			PerformGravity(param1, target, amount);
   7.184 -			ShowActivity2(param1, "[SM] ", "%t", "Set gravity on target", "_s", name, amount);
   7.185 -		}
   7.186 -		
   7.187 -		/* Re-draw the menu if they're still valid */
   7.188 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   7.189 -		{
   7.190 -			DisplayGravityMenu(param1);
   7.191 -		}
   7.192 -	}
   7.193 -}
   7.194 -
   7.195 -public Action:Command_Gravity(client, args)
   7.196 -{
   7.197 -	if (args < 1)
   7.198 -	{
   7.199 -		ReplyToCommand(client, "[SM] Usage: sm_gravity <#userid|name> [amount]");
   7.200 -		return Plugin_Handled;
   7.201 -	}
   7.202 -
   7.203 -	decl String:arg[65];
   7.204 -	GetCmdArg(1, arg, sizeof(arg));
   7.205 -	
   7.206 -	new Float:amount = 1.0;
   7.207 -	if (args > 1)
   7.208 -	{
   7.209 -		decl String:arg2[20];
   7.210 -		GetCmdArg(2, arg2, sizeof(arg2));
   7.211 -		if (StringToFloatEx(arg2, amount) == 0)
   7.212 -		{
   7.213 -			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   7.214 -			return Plugin_Handled;
   7.215 -		}
   7.216 -		
   7.217 -		if (amount < 0.0)
   7.218 -		{
   7.219 -			amount = 0.0;
   7.220 -		}
   7.221 -	}
   7.222 -
   7.223 -	decl String:target_name[MAX_TARGET_LENGTH];
   7.224 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   7.225 -	
   7.226 -	if ((target_count = ProcessTargetString(
   7.227 -			arg,
   7.228 -			client,
   7.229 -			target_list,
   7.230 -			MAXPLAYERS,
   7.231 -			COMMAND_FILTER_ALIVE,
   7.232 -			target_name,
   7.233 -			sizeof(target_name),
   7.234 -			tn_is_ml)) <= 0)
   7.235 -	{
   7.236 -		ReplyToTargetError(client, target_count);
   7.237 -		return Plugin_Handled;
   7.238 -	}
   7.239 -	
   7.240 -	for (new i = 0; i < target_count; i++)
   7.241 -	{
   7.242 -		PerformGravity(client, target_list[i], amount);
   7.243 -	}
   7.244 -	
   7.245 -	if (tn_is_ml)
   7.246 -	{
   7.247 -		ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", target_name);
   7.248 -	}
   7.249 -	else
   7.250 -	{
   7.251 -		ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", "_s", target_name);
   7.252 -	}
   7.253 -	
   7.254 -	return Plugin_Handled;
   7.255 -}
     8.1 --- a/plugins/basefuncommands/ice.sp	Fri Feb 22 19:22:22 2008 +0000
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,573 +0,0 @@
     8.4 -/**
     8.5 - * vim: set ts=4 :
     8.6 - * =============================================================================
     8.7 - * SourceMod Basefuncommands Plugin
     8.8 - * Provides freeze and freezebomb functionality
     8.9 - *
    8.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    8.11 - * =============================================================================
    8.12 - *
    8.13 - * This program is free software; you can redistribute it and/or modify it under
    8.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    8.15 - * Free Software Foundation.
    8.16 - * 
    8.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    8.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    8.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    8.20 - * details.
    8.21 - *
    8.22 - * You should have received a copy of the GNU General Public License along with
    8.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    8.24 - *
    8.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    8.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    8.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    8.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    8.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    8.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    8.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    8.32 - * or <http://www.sourcemod.net/license.php>.
    8.33 - *
    8.34 - * Version: $Id$
    8.35 - */
    8.36 -
    8.37 -new Handle:g_FreezeTimers[MAXPLAYERS+1];
    8.38 -new Handle:g_FreezeBombTimers[MAXPLAYERS+1];
    8.39 -new g_FreezeTracker[MAXPLAYERS+1];
    8.40 -new g_FreezeBombTracker[MAXPLAYERS+1];
    8.41 -
    8.42 -new Handle:g_FreezeDuration = INVALID_HANDLE;
    8.43 -new Handle:g_FreezeBombTicks = INVALID_HANDLE;
    8.44 -new Handle:g_FreezeBombRadius = INVALID_HANDLE;
    8.45 -new Handle:g_FreezeBombMode = INVALID_HANDLE;
    8.46 -
    8.47 -SetupIce()
    8.48 -{
    8.49 -	RegAdminCmd("sm_freeze", Command_Freeze, ADMFLAG_SLAY, "sm_freeze <#userid|name> [time]");
    8.50 -	RegAdminCmd("sm_freezebomb", Command_FreezeBomb, ADMFLAG_SLAY, "sm_freezebomb <#userid|name> [0/1]");
    8.51 -
    8.52 -	g_FreezeDuration = CreateConVar("sm_freeze_duration", "10.0", "Sets the default duration for sm_freeze and freezebomb victims", 0, true, 1.0, true, 120.0);	
    8.53 -	g_FreezeBombTicks = CreateConVar("sm_freezebomb_ticks", "10", "Sets how long the freezebomb fuse is.", 0, true, 5.0, true, 120.0);
    8.54 -	g_FreezeBombRadius = CreateConVar("sm_freezebomb_radius", "600", "Sets the freezebomb blast radius.", 0, true, 50.0, true, 3000.0);
    8.55 -	g_FreezeBombMode = CreateConVar("sm_freezebomb_mode", "0", "Who is targetted by the freezebomb? 0 = Target only, 1 = Target's team, 2 = Everyone", 0, true, 0.0, true, 2.0);
    8.56 -}
    8.57 -
    8.58 -FreezeClient(client, time)
    8.59 -{
    8.60 -	if (g_FreezeTimers[client] != INVALID_HANDLE)
    8.61 -	{
    8.62 -		UnfreezeClient(client);
    8.63 -	}
    8.64 -	
    8.65 -	SetEntityMoveType(client, MOVETYPE_NONE);
    8.66 -	SetEntityRenderColor(client, 0, 128, 255, 192);
    8.67 -	
    8.68 -	new Float:vec[3];
    8.69 -	GetClientEyePosition(client, vec);
    8.70 -	EmitAmbientSound(SOUND_FREEZE, vec, client, SNDLEVEL_RAIDSIREN);
    8.71 -
    8.72 -	g_FreezeTimers[client] = CreateTimer(1.0, Timer_Freeze, client, TIMER_REPEAT);
    8.73 -	g_FreezeTracker[client] = time;
    8.74 -}
    8.75 -
    8.76 -UnfreezeClient(client)
    8.77 -{
    8.78 -	KillFreezeTimer(client);
    8.79 -
    8.80 -	new Float:vec[3];
    8.81 -	GetClientAbsOrigin(client, vec);
    8.82 -	vec[2] += 10;	
    8.83 -	
    8.84 -	GetClientEyePosition(client, vec);
    8.85 -	EmitAmbientSound(SOUND_FREEZE, vec, client, SNDLEVEL_RAIDSIREN);
    8.86 -
    8.87 -	SetEntityMoveType(client, MOVETYPE_WALK);
    8.88 -	SetEntityRenderColor(client, 255, 255, 255, 255);	
    8.89 -}
    8.90 -
    8.91 -KillFreezeTimer(client)
    8.92 -{
    8.93 -	KillTimer(g_FreezeTimers[client]);
    8.94 -	g_FreezeTimers[client] = INVALID_HANDLE;
    8.95 -}
    8.96 -
    8.97 -CreateFreezeBomb(client)
    8.98 -{
    8.99 -	g_FreezeBombTimers[client] = CreateTimer(1.0, Timer_FreezeBomb, client, TIMER_REPEAT);
   8.100 -	g_FreezeBombTracker[client] = GetConVarInt(g_FreezeBombTicks);
   8.101 -}
   8.102 -
   8.103 -KillFreezeBomb(client)
   8.104 -{
   8.105 -	KillTimer(g_FreezeBombTimers[client]);
   8.106 -	g_FreezeBombTimers[client] = INVALID_HANDLE;
   8.107 -	
   8.108 -	SetEntityRenderColor(client, 255, 255, 255, 255);
   8.109 -}
   8.110 -
   8.111 -KillAllFreezes()
   8.112 -{
   8.113 -	new maxclients = GetMaxClients();
   8.114 -	for (new i = 1; i <= maxclients; i++)
   8.115 -	{
   8.116 -		if (g_FreezeTimers[i] != INVALID_HANDLE)
   8.117 -		{
   8.118 -			if(IsClientInGame(i))
   8.119 -			{
   8.120 -				UnfreezeClient(i);
   8.121 -			}
   8.122 -			else
   8.123 -			{
   8.124 -				KillFreezeTimer(i);
   8.125 -			}			
   8.126 -		}		
   8.127 -		
   8.128 -		if (g_FreezeBombTimers[i] != INVALID_HANDLE)
   8.129 -		{
   8.130 -			KillFreezeBomb(i);
   8.131 -		}
   8.132 -	}
   8.133 -}
   8.134 -
   8.135 -PerformFreeze(client, target, time)
   8.136 -{
   8.137 -	FreezeClient(target, time);
   8.138 -	LogAction(client, target, "\"%L\" froze \"%L\"", client, target);
   8.139 -}
   8.140 -
   8.141 -PerformFreezeBomb(client, target, toggle)
   8.142 -{
   8.143 -	switch (toggle)
   8.144 -	{
   8.145 -		case (2):
   8.146 -		{
   8.147 -			if (g_FreezeBombTimers[target] == INVALID_HANDLE)
   8.148 -			{
   8.149 -				CreateFreezeBomb(target);
   8.150 -				LogAction(client, target, "\"%L\" set a FreezeBomb on \"%L\"", client, target);
   8.151 -			}
   8.152 -			else
   8.153 -			{
   8.154 -				KillFreezeBomb(target);
   8.155 -				LogAction(client, target, "\"%L\" removed a FreezeBomb on \"%L\"", client, target);
   8.156 -			}
   8.157 -		}
   8.158 -
   8.159 -		case (1):
   8.160 -		{
   8.161 -			if (g_FreezeBombTimers[target] == INVALID_HANDLE)
   8.162 -			{
   8.163 -				CreateFreezeBomb(target);
   8.164 -				LogAction(client, target, "\"%L\" set a FreezeBomb on \"%L\"", client, target);
   8.165 -			}
   8.166 -		}
   8.167 -		
   8.168 -		case (0):
   8.169 -		{
   8.170 -			if (g_FreezeBombTimers[target] != INVALID_HANDLE)
   8.171 -			{
   8.172 -				KillFreezeBomb(target);
   8.173 -				LogAction(client, target, "\"%L\" removed a FreezeBomb on \"%L\"", client, target);
   8.174 -			}
   8.175 -		}
   8.176 -	}
   8.177 -}
   8.178 -
   8.179 -public Action:Timer_Freeze(Handle:timer, any:client)
   8.180 -{
   8.181 -	if (!IsClientInGame(client))
   8.182 -	{
   8.183 -		KillFreezeTimer(client);
   8.184 -
   8.185 -		return Plugin_Handled;
   8.186 -	}
   8.187 -	
   8.188 -	if (!IsPlayerAlive(client))
   8.189 -	{
   8.190 -		UnfreezeClient(client);
   8.191 -		
   8.192 -		return Plugin_Handled;
   8.193 -	}		
   8.194 -	
   8.195 -	g_FreezeTracker[client]--;
   8.196 -	
   8.197 -	SetEntityMoveType(client, MOVETYPE_NONE);
   8.198 -	SetEntityRenderColor(client, 0, 128, 255, 135);
   8.199 -	
   8.200 -	new Float:vec[3];
   8.201 -	GetClientAbsOrigin(client, vec);
   8.202 -	vec[2] += 10;
   8.203 -	
   8.204 -	TE_SetupGlowSprite(vec, g_GlowSprite, 0.95, 1.5, 50);
   8.205 -	TE_SendToAll();	
   8.206 -
   8.207 -	if (g_FreezeTracker[client] == 0)
   8.208 -	{
   8.209 -		UnfreezeClient(client);
   8.210 -	}
   8.211 -
   8.212 -	return Plugin_Handled;
   8.213 -}
   8.214 -
   8.215 -public Action:Timer_FreezeBomb(Handle:timer, any:client)
   8.216 -{
   8.217 -	if (!IsClientInGame(client) || !IsPlayerAlive(client))
   8.218 -	{
   8.219 -		KillFreezeBomb(client);
   8.220 -
   8.221 -		return Plugin_Handled;
   8.222 -	}
   8.223 -	
   8.224 -	g_FreezeBombTracker[client]--;
   8.225 -	
   8.226 -	new Float:vec[3];
   8.227 -	GetClientEyePosition(client, vec);
   8.228 -	
   8.229 -	if (g_FreezeBombTracker[client] > 0)
   8.230 -	{
   8.231 -		new color;
   8.232 -		
   8.233 -		if (g_FreezeBombTracker[client] > 1)
   8.234 -		{
   8.235 -			color = RoundToFloor(g_FreezeBombTracker[client] * (255.0 / GetConVarFloat(g_FreezeBombTicks)));
   8.236 -			EmitAmbientSound(SOUND_BEEP, vec, client, SNDLEVEL_RAIDSIREN);	
   8.237 -		}
   8.238 -		else
   8.239 -		{
   8.240 -			color = 0;
   8.241 -			EmitAmbientSound(SOUND_FINAL, vec, client, SNDLEVEL_RAIDSIREN);
   8.242 -		}
   8.243 -		
   8.244 -		SetEntityRenderColor(client, color, color, 255, 255);
   8.245 -
   8.246 -		decl String:name[64];
   8.247 -		GetClientName(client, name, sizeof(name));
   8.248 -		PrintCenterTextAll("%t", "Till Explodes", name, g_FreezeBombTracker[client]);
   8.249 -		
   8.250 -		GetClientAbsOrigin(client, vec);
   8.251 -		vec[2] += 10;
   8.252 -
   8.253 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_FreezeBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
   8.254 -		TE_SendToAll();
   8.255 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_FreezeBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
   8.256 -		TE_SendToAll();
   8.257 -	}
   8.258 -	else
   8.259 -	{
   8.260 -		TE_SetupExplosion(vec, g_ExplosionSprite, 5.0, 1, 0, GetConVarInt(g_FreezeBombRadius), 5000);
   8.261 -		TE_SendToAll();
   8.262 -
   8.263 -		EmitAmbientSound(SOUND_BOOM, vec, client, SNDLEVEL_RAIDSIREN);
   8.264 -
   8.265 -		KillFreezeBomb(client);
   8.266 -		FreezeClient(client, GetConVarInt(g_FreezeDuration));
   8.267 -		
   8.268 -		if (GetConVarInt(g_FreezeBombMode) > 0)
   8.269 -		{
   8.270 -			new teamOnly = ((GetConVarInt(g_FreezeBombMode) == 1) ? true : false);
   8.271 -			new maxClients = GetMaxClients();
   8.272 -			
   8.273 -			for (new i = 1; i < maxClients; i++)
   8.274 -			{
   8.275 -				if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
   8.276 -				{
   8.277 -					continue;
   8.278 -				}
   8.279 -				
   8.280 -				if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
   8.281 -				{
   8.282 -					continue;
   8.283 -				}
   8.284 -				
   8.285 -				new Float:pos[3];
   8.286 -				GetClientEyePosition(i, pos);
   8.287 -				
   8.288 -				new Float:distance = GetVectorDistance(vec, pos);
   8.289 -				
   8.290 -				if (distance > GetConVarFloat(g_FreezeBombRadius))
   8.291 -				{
   8.292 -					continue;
   8.293 -				}
   8.294 -				
   8.295 -				TE_SetupBeamPoints(vec, pos, g_BeamSprite2, g_HaloSprite, 0, 1, 0.7, 20.0, 50.0, 1, 1.5, blueColor, 10);
   8.296 -				TE_SendToAll();
   8.297 -				
   8.298 -				FreezeClient(i, GetConVarInt(g_FreezeDuration));
   8.299 -			}		
   8.300 -		}
   8.301 -	}
   8.302 -			
   8.303 -	return Plugin_Handled;
   8.304 -}
   8.305 -
   8.306 -public AdminMenu_Freeze(Handle:topmenu, 
   8.307 -					  TopMenuAction:action,
   8.308 -					  TopMenuObject:object_id,
   8.309 -					  param,
   8.310 -					  String:buffer[],
   8.311 -					  maxlength)
   8.312 -{
   8.313 -	if (action == TopMenuAction_DisplayOption)
   8.314 -	{
   8.315 -		Format(buffer, maxlength, "%T", "Freeze player", param);
   8.316 -	}
   8.317 -	else if (action == TopMenuAction_SelectOption)
   8.318 -	{
   8.319 -		DisplayFreezeMenu(param);
   8.320 -	}
   8.321 -}
   8.322 -
   8.323 -public AdminMenu_FreezeBomb(Handle:topmenu, 
   8.324 -					  TopMenuAction:action,
   8.325 -					  TopMenuObject:object_id,
   8.326 -					  param,
   8.327 -					  String:buffer[],
   8.328 -					  maxlength)
   8.329 -{
   8.330 -	if (action == TopMenuAction_DisplayOption)
   8.331 -	{
   8.332 -		Format(buffer, maxlength, "%T", "FreezeBomb player", param);
   8.333 -	}
   8.334 -	else if (action == TopMenuAction_SelectOption)
   8.335 -	{
   8.336 -		DisplayFreezeBombMenu(param);
   8.337 -	}
   8.338 -}
   8.339 -
   8.340 -DisplayFreezeMenu(client)
   8.341 -{
   8.342 -	new Handle:menu = CreateMenu(MenuHandler_Freeze);
   8.343 -	
   8.344 -	decl String:title[100];
   8.345 -	Format(title, sizeof(title), "%T:", "Freeze player", client);
   8.346 -	SetMenuTitle(menu, title);
   8.347 -	SetMenuExitBackButton(menu, true);
   8.348 -	
   8.349 -	AddTargetsToMenu(menu, client, true, true);
   8.350 -	
   8.351 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   8.352 -}
   8.353 -
   8.354 -DisplayFreezeBombMenu(client)
   8.355 -{
   8.356 -	new Handle:menu = CreateMenu(MenuHandler_FreezeBomb);
   8.357 -	
   8.358 -	decl String:title[100];
   8.359 -	Format(title, sizeof(title), "%T:", "FreezeBomb player", client);
   8.360 -	SetMenuTitle(menu, title);
   8.361 -	SetMenuExitBackButton(menu, true);
   8.362 -	
   8.363 -	AddTargetsToMenu(menu, client, true, true);
   8.364 -	
   8.365 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   8.366 -}
   8.367 -
   8.368 -public MenuHandler_Freeze(Handle:menu, MenuAction:action, param1, param2)
   8.369 -{
   8.370 -	if (action == MenuAction_End)
   8.371 -	{
   8.372 -		CloseHandle(menu);
   8.373 -	}
   8.374 -	else if (action == MenuAction_Cancel)
   8.375 -	{
   8.376 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   8.377 -		{
   8.378 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   8.379 -		}
   8.380 -	}
   8.381 -	else if (action == MenuAction_Select)
   8.382 -	{
   8.383 -		decl String:info[32];
   8.384 -		new userid, target;
   8.385 -		
   8.386 -		GetMenuItem(menu, param2, info, sizeof(info));
   8.387 -		userid = StringToInt(info);
   8.388 -
   8.389 -		if ((target = GetClientOfUserId(userid)) == 0)
   8.390 -		{
   8.391 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   8.392 -		}
   8.393 -		else if (!CanUserTarget(param1, target))
   8.394 -		{
   8.395 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   8.396 -		}
   8.397 -		else
   8.398 -		{
   8.399 -			new String:name[32];
   8.400 -			GetClientName(target, name, sizeof(name));
   8.401 -			
   8.402 -			PerformFreeze(param1, target, GetConVarInt(g_FreezeDuration));
   8.403 -			ShowActivity2(param1, "[SM] ", "%t", "Froze target", "_s", name);
   8.404 -		}
   8.405 -		
   8.406 -		/* Re-draw the menu if they're still valid */
   8.407 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   8.408 -		{
   8.409 -			DisplayFreezeMenu(param1);
   8.410 -		}
   8.411 -	}
   8.412 -}
   8.413 -
   8.414 -public MenuHandler_FreezeBomb(Handle:menu, MenuAction:action, param1, param2)
   8.415 -{
   8.416 -	if (action == MenuAction_End)
   8.417 -	{
   8.418 -		CloseHandle(menu);
   8.419 -	}
   8.420 -	else if (action == MenuAction_Cancel)
   8.421 -	{
   8.422 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   8.423 -		{
   8.424 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   8.425 -		}
   8.426 -	}
   8.427 -	else if (action == MenuAction_Select)
   8.428 -	{
   8.429 -		decl String:info[32];
   8.430 -		new userid, target;
   8.431 -		
   8.432 -		GetMenuItem(menu, param2, info, sizeof(info));
   8.433 -		userid = StringToInt(info);
   8.434 -
   8.435 -		if ((target = GetClientOfUserId(userid)) == 0)
   8.436 -		{
   8.437 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   8.438 -		}
   8.439 -		else if (!CanUserTarget(param1, target))
   8.440 -		{
   8.441 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   8.442 -		}
   8.443 -		else
   8.444 -		{
   8.445 -			new String:name[32];
   8.446 -			GetClientName(target, name, sizeof(name));
   8.447 -			
   8.448 -			PerformFreezeBomb(param1, target, 2);
   8.449 -			ShowActivity2(param1, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", name);
   8.450 -		}
   8.451 -		
   8.452 -		/* Re-draw the menu if they're still valid */
   8.453 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   8.454 -		{
   8.455 -			DisplayFreezeBombMenu(param1);
   8.456 -		}
   8.457 -	}
   8.458 -}
   8.459 -
   8.460 -public Action:Command_Freeze(client, args)
   8.461 -{
   8.462 -	if (args < 1)
   8.463 -	{
   8.464 -		ReplyToCommand(client, "[SM] Usage: sm_freeze <#userid|name> [time]");
   8.465 -		return Plugin_Handled;
   8.466 -	}
   8.467 -
   8.468 -	decl String:arg[65];
   8.469 -	GetCmdArg(1, arg, sizeof(arg));
   8.470 -	
   8.471 -	new seconds = GetConVarInt(g_FreezeDuration);
   8.472 -	
   8.473 -	if (args > 1)
   8.474 -	{
   8.475 -		decl String:time[20];
   8.476 -		GetCmdArg(2, time, sizeof(time));
   8.477 -		if (StringToIntEx(time, seconds) == 0)
   8.478 -		{
   8.479 -			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   8.480 -			return Plugin_Handled;
   8.481 -		}
   8.482 -	}	
   8.483 -
   8.484 -	decl String:target_name[MAX_TARGET_LENGTH];
   8.485 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   8.486 -	
   8.487 -	if ((target_count = ProcessTargetString(
   8.488 -			arg,
   8.489 -			client,
   8.490 -			target_list,
   8.491 -			MAXPLAYERS,
   8.492 -			COMMAND_FILTER_ALIVE,
   8.493 -			target_name,
   8.494 -			sizeof(target_name),
   8.495 -			tn_is_ml)) <= 0)
   8.496 -	{
   8.497 -		ReplyToTargetError(client, target_count);
   8.498 -		return Plugin_Handled;
   8.499 -	}
   8.500 -	
   8.501 -	for (new i = 0; i < target_count; i++)
   8.502 -	{
   8.503 -		PerformFreeze(client, target_list[i], seconds);
   8.504 -	}
   8.505 -	
   8.506 -	if (tn_is_ml)
   8.507 -	{
   8.508 -		ShowActivity2(client, "[SM] ", "%t", "Froze target", target_name);
   8.509 -	}
   8.510 -	else
   8.511 -	{
   8.512 -		ShowActivity2(client, "[SM] ", "%t", "Froze target", "_s", target_name);
   8.513 -	}
   8.514 -	
   8.515 -	return Plugin_Handled;
   8.516 -}
   8.517 -
   8.518 -public Action:Command_FreezeBomb(client, args)
   8.519 -{
   8.520 -	if (args < 1)
   8.521 -	{
   8.522 -		ReplyToCommand(client, "[SM] Usage: sm_freezebomb <#userid|name> [0/1]");
   8.523 -		return Plugin_Handled;
   8.524 -	}
   8.525 -
   8.526 -	decl String:arg[65];
   8.527 -	GetCmdArg(1, arg, sizeof(arg));
   8.528 -	
   8.529 -	new toggle = 2;
   8.530 -	if (args > 1)
   8.531 -	{
   8.532 -		decl String:arg2[2];
   8.533 -		GetCmdArg(2, arg2, sizeof(arg2));
   8.534 -		if (arg2[0])
   8.535 -		{
   8.536 -			toggle = 1;
   8.537 -		}
   8.538 -		else
   8.539 -		{
   8.540 -			toggle = 0;
   8.541 -		}
   8.542 -	}
   8.543 -
   8.544 -	decl String:target_name[MAX_TARGET_LENGTH];
   8.545 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   8.546 -	
   8.547 -	if ((target_count = ProcessTargetString(
   8.548 -			arg,
   8.549 -			client,
   8.550 -			target_list,
   8.551 -			MAXPLAYERS,
   8.552 -			COMMAND_FILTER_ALIVE,
   8.553 -			target_name,
   8.554 -			sizeof(target_name),
   8.555 -			tn_is_ml)) <= 0)
   8.556 -	{
   8.557 -		ReplyToTargetError(client, target_count);
   8.558 -		return Plugin_Handled;
   8.559 -	}
   8.560 -	
   8.561 -	for (new i = 0; i < target_count; i++)
   8.562 -	{
   8.563 -		PerformFreezeBomb(client, target_list[i], toggle);
   8.564 -	}
   8.565 -	
   8.566 -	if (tn_is_ml)
   8.567 -	{
   8.568 -		ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", target_name);
   8.569 -	}
   8.570 -	else
   8.571 -	{
   8.572 -		ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", target_name);
   8.573 -	}
   8.574 -	
   8.575 -	return Plugin_Handled;
   8.576 -}
     9.1 --- a/plugins/basefuncommands/noclip.sp	Fri Feb 22 19:22:22 2008 +0000
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,175 +0,0 @@
     9.4 -/**
     9.5 - * vim: set ts=4 :
     9.6 - * =============================================================================
     9.7 - * SourceMod Basefuncommands Plugin
     9.8 - * Provides noclip functionality
     9.9 - *
    9.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
    9.11 - * =============================================================================
    9.12 - *
    9.13 - * This program is free software; you can redistribute it and/or modify it under
    9.14 - * the terms of the GNU General Public License, version 3.0, as published by the
    9.15 - * Free Software Foundation.
    9.16 - * 
    9.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
    9.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    9.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
    9.20 - * details.
    9.21 - *
    9.22 - * You should have received a copy of the GNU General Public License along with
    9.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
    9.24 - *
    9.25 - * As a special exception, AlliedModders LLC gives you permission to link the
    9.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
    9.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
    9.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
    9.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
    9.30 - * this exception to all derivative works.  AlliedModders LLC defines further
    9.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    9.32 - * or <http://www.sourcemod.net/license.php>.
    9.33 - *
    9.34 - * Version: $Id$
    9.35 - */
    9.36 - 
    9.37 -SetupNoClip()
    9.38 -{
    9.39 -	RegAdminCmd("sm_noclip", Command_NoClip, ADMFLAG_SLAY|ADMFLAG_CHEATS, "sm_noclip <#userid|name>");
    9.40 -}
    9.41 -
    9.42 -PerformNoClip(client, target)
    9.43 -{
    9.44 -	new MoveType:movetype = GetEntityMoveType(target);
    9.45 -
    9.46 -	if (movetype != MOVETYPE_NOCLIP)
    9.47 -	{
    9.48 -		SetEntityMoveType(target, MOVETYPE_NOCLIP);
    9.49 -	}
    9.50 -	else
    9.51 -	{
    9.52 -		SetEntityMoveType(target, MOVETYPE_WALK);
    9.53 -	}
    9.54 -	
    9.55 -	LogAction(client, target, "\"%L\" toggled noclip on \"%L\"", client, target);
    9.56 -}
    9.57 -
    9.58 -public AdminMenu_NoClip(Handle:topmenu, 
    9.59 -					  TopMenuAction:action,
    9.60 -					  TopMenuObject:object_id,
    9.61 -					  param,
    9.62 -					  String:buffer[],
    9.63 -					  maxlength)
    9.64 -{
    9.65 -	if (action == TopMenuAction_DisplayOption)
    9.66 -	{
    9.67 -		Format(buffer, maxlength, "%T", "NoClip player", param);
    9.68 -	}
    9.69 -	else if (action == TopMenuAction_SelectOption)
    9.70 -	{
    9.71 -		DisplayNoClipMenu(param);
    9.72 -	}
    9.73 -}
    9.74 -
    9.75 -DisplayNoClipMenu(client)
    9.76 -{
    9.77 -	new Handle:menu = CreateMenu(MenuHandler_NoClip);
    9.78 -	
    9.79 -	decl String:title[100];
    9.80 -	Format(title, sizeof(title), "%T:", "NoClip player", client);
    9.81 -	SetMenuTitle(menu, title);
    9.82 -	SetMenuExitBackButton(menu, true);
    9.83 -	
    9.84 -	AddTargetsToMenu(menu, client, true, true);
    9.85 -	
    9.86 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    9.87 -}
    9.88 -
    9.89 -public MenuHandler_NoClip(Handle:menu, MenuAction:action, param1, param2)
    9.90 -{
    9.91 -	if (action == MenuAction_End)
    9.92 -	{
    9.93 -		CloseHandle(menu);
    9.94 -	}
    9.95 -	else if (action == MenuAction_Cancel)
    9.96 -	{
    9.97 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
    9.98 -		{
    9.99 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   9.100 -		}
   9.101 -	}
   9.102 -	else if (action == MenuAction_Select)
   9.103 -	{
   9.104 -		decl String:info[32];
   9.105 -		new userid, target;
   9.106 -		
   9.107 -		GetMenuItem(menu, param2, info, sizeof(info));
   9.108 -		userid = StringToInt(info);
   9.109 -
   9.110 -		if ((target = GetClientOfUserId(userid)) == 0)
   9.111 -		{
   9.112 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
   9.113 -		}
   9.114 -		else if (!CanUserTarget(param1, target))
   9.115 -		{
   9.116 -			PrintToChat(param1, "[SM] %t", "Unable to target");
   9.117 -		}
   9.118 -		else
   9.119 -		{
   9.120 -			new String:name[32];
   9.121 -			GetClientName(target, name, sizeof(name));
   9.122 -			
   9.123 -			PerformNoClip(param1, target);
   9.124 -			ShowActivity2(param1, "[SM] ", "%t", "Toggled noclip on target", "_s", name);
   9.125 -		}
   9.126 -		
   9.127 -		/* Re-draw the menu if they're still valid */
   9.128 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   9.129 -		{
   9.130 -			DisplayNoClipMenu(param1);
   9.131 -		}
   9.132 -	}
   9.133 -}
   9.134 -
   9.135 -public Action:Command_NoClip(client, args)
   9.136 -{
   9.137 -	if (args < 1)
   9.138 -	{
   9.139 -		ReplyToCommand(client, "[SM] Usage: sm_noclip <#userid|name>");
   9.140 -		return Plugin_Handled;
   9.141 -	}
   9.142 -
   9.143 -	decl String:arg[65];
   9.144 -	GetCmdArg(1, arg, sizeof(arg));
   9.145 -	
   9.146 -	decl String:target_name[MAX_TARGET_LENGTH];
   9.147 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   9.148 -	
   9.149 -	if ((target_count = ProcessTargetString(
   9.150 -			arg,
   9.151 -			client,
   9.152 -			target_list,
   9.153 -			MAXPLAYERS,
   9.154 -			COMMAND_FILTER_ALIVE,
   9.155 -			target_name,
   9.156 -			sizeof(target_name),
   9.157 -			tn_is_ml)) <= 0)
   9.158 -	{
   9.159 -		ReplyToTargetError(client, target_count);
   9.160 -		return Plugin_Handled;
   9.161 -	}
   9.162 -	
   9.163 -	for (new i = 0; i < target_count; i++)
   9.164 -	{
   9.165 -		PerformNoClip(client, target_list[i]);
   9.166 -	}
   9.167 -	
   9.168 -	if (tn_is_ml)
   9.169 -	{
   9.170 -		ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", target_name);
   9.171 -	}
   9.172 -	else
   9.173 -	{
   9.174 -		ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", "_s", target_name);
   9.175 -	}
   9.176 -	
   9.177 -	return Plugin_Handled;
   9.178 -}
    10.1 --- a/plugins/basefuncommands/timebomb.sp	Fri Feb 22 19:22:22 2008 +0000
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,365 +0,0 @@
    10.4 -/**
    10.5 - * vim: set ts=4 :
    10.6 - * =============================================================================
    10.7 - * SourceMod Basefuncommands Plugin
    10.8 - * Provides TimeBomb functionality
    10.9 - *
   10.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   10.11 - * =============================================================================
   10.12 - *
   10.13 - * This program is free software; you can redistribute it and/or modify it under
   10.14 - * the terms of the GNU General Public License, version 3.0, as published by the
   10.15 - * Free Software Foundation.
   10.16 - * 
   10.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
   10.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   10.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   10.20 - * details.
   10.21 - *
   10.22 - * You should have received a copy of the GNU General Public License along with
   10.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
   10.24 - *
   10.25 - * As a special exception, AlliedModders LLC gives you permission to link the
   10.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
   10.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   10.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
   10.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
   10.30 - * this exception to all derivative works.  AlliedModders LLC defines further
   10.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   10.32 - * or <http://www.sourcemod.net/license.php>.
   10.33 - *
   10.34 - * Version: $Id$
   10.35 - */
   10.36 -
   10.37 -new Handle:g_TimeBombTimers[MAXPLAYERS+1];
   10.38 -new g_TimeBombTracker[MAXPLAYERS+1];
   10.39 -
   10.40 -new Handle:g_TimeBombTicks = INVALID_HANDLE;
   10.41 -new Handle:g_TimeBombRadius = INVALID_HANDLE;
   10.42 -new Handle:g_TimeBombMode = INVALID_HANDLE;
   10.43 -
   10.44 -SetupTimeBomb()
   10.45 -{
   10.46 -	RegAdminCmd("sm_timebomb", Command_TimeBomb, ADMFLAG_SLAY, "sm_timebomb <#userid|name> [0/1]");	
   10.47 -	
   10.48 -	g_TimeBombTicks = CreateConVar("sm_timebomb_ticks", "10", "Sets how long the timebomb fuse is.", 0, true, 5.0, true, 120.0);
   10.49 -	g_TimeBombRadius = CreateConVar("sm_timebomb_radius", "600", "Sets the bomb blast radius.", 0, true, 50.0, true, 3000.0);
   10.50 -	g_TimeBombMode = CreateConVar("sm_timebomb_mode", "0", "Who is killed by the timebomb? 0 = Target only, 1 = Target's team, 2 = Everyone", 0, true, 0.0, true, 2.0);
   10.51 -}
   10.52 -
   10.53 -CreateTimeBomb(client)
   10.54 -{
   10.55 -	g_TimeBombTimers[client] = CreateTimer(1.0, Timer_TimeBomb, client, TIMER_REPEAT);
   10.56 -	g_TimeBombTracker[client] = GetConVarInt(g_TimeBombTicks);
   10.57 -}
   10.58 -
   10.59 -KillTimeBomb(client)
   10.60 -{
   10.61 -	KillTimer(g_TimeBombTimers[client]);
   10.62 -	g_TimeBombTimers[client] = INVALID_HANDLE;
   10.63 -}
   10.64 -
   10.65 -KillAllTimeBombs()
   10.66 -{
   10.67 -	new maxclients = GetMaxClients();
   10.68 -	for (new i = 1; i <= maxclients; i++)
   10.69 -	{
   10.70 -		if (g_TimeBombTimers[i] != INVALID_HANDLE)
   10.71 -		{
   10.72 -			KillTimeBomb(i);
   10.73 -		}
   10.74 -	}
   10.75 -}
   10.76 -
   10.77 -PerformTimeBomb(client, target, toggle)
   10.78 -{
   10.79 -	switch (toggle)
   10.80 -	{
   10.81 -		case (2):
   10.82 -		{
   10.83 -			if (g_TimeBombTimers[target] == INVALID_HANDLE)
   10.84 -			{
   10.85 -				CreateTimeBomb(target);
   10.86 -				LogAction(client, target, "\"%L\" set a TimeBomb on \"%L\"", client, target);
   10.87 -			}
   10.88 -			else
   10.89 -			{
   10.90 -				KillTimeBomb(target);
   10.91 -				SetEntityRenderColor(client, 255, 255, 255, 255);
   10.92 -				LogAction(client, target, "\"%L\" removed a TimeBomb on \"%L\"", client, target);
   10.93 -			}			
   10.94 -		}
   10.95 -
   10.96 -		case (1):
   10.97 -		{
   10.98 -			if (g_TimeBombTimers[target] == INVALID_HANDLE)
   10.99 -			{
  10.100 -				CreateTimeBomb(target);
  10.101 -				LogAction(client, target, "\"%L\" set a TimeBomb on \"%L\"", client, target);
  10.102 -			}			
  10.103 -		}
  10.104 -		
  10.105 -		case (0):
  10.106 -		{
  10.107 -			if (g_TimeBombTimers[target] != INVALID_HANDLE)
  10.108 -			{
  10.109 -				KillTimeBomb(target);
  10.110 -				SetEntityRenderColor(client, 255, 255, 255, 255);
  10.111 -				LogAction(client, target, "\"%L\" removed a TimeBomb on \"%L\"", client, target);
  10.112 -			}			
  10.113 -		}
  10.114 -	}
  10.115 -}
  10.116 -
  10.117 -public Action:Timer_TimeBomb(Handle:timer, any:client)
  10.118 -{
  10.119 -	if (!IsClientInGame(client) || !IsPlayerAlive(client))
  10.120 -	{
  10.121 -		KillTimeBomb(client);		
  10.122 -
  10.123 -		return Plugin_Handled;
  10.124 -	}
  10.125 -	
  10.126 -	g_TimeBombTracker[client]--;
  10.127 -	
  10.128 -	new Float:vec[3];
  10.129 -	GetClientEyePosition(client, vec);
  10.130 -	
  10.131 -	if (g_TimeBombTracker[client] > 0)
  10.132 -	{
  10.133 -		new color;
  10.134 -		
  10.135 -		if (g_TimeBombTracker[client] > 1)
  10.136 -		{
  10.137 -			color = RoundToFloor(g_TimeBombTracker[client] * (128.0 / GetConVarFloat(g_TimeBombTicks)));
  10.138 -			EmitAmbientSound(SOUND_BEEP, vec, client, SNDLEVEL_RAIDSIREN);	
  10.139 -		}
  10.140 -		else
  10.141 -		{
  10.142 -			color = 0;
  10.143 -			EmitAmbientSound(SOUND_FINAL, vec, client, SNDLEVEL_RAIDSIREN);
  10.144 -		}
  10.145 -		
  10.146 -		SetEntityRenderColor(client, 255, 128, color, 255);
  10.147 -
  10.148 -		decl String:name[64];
  10.149 -		GetClientName(client, name, sizeof(name));
  10.150 -		PrintCenterTextAll("%t", "Till Explodes", name, g_TimeBombTracker[client]);
  10.151 -		
  10.152 -		GetClientAbsOrigin(client, vec);
  10.153 -		vec[2] += 10;
  10.154 -
  10.155 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_TimeBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
  10.156 -		TE_SendToAll();
  10.157 -		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_TimeBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
  10.158 -		TE_SendToAll();
  10.159 -	}
  10.160 -	else
  10.161 -	{
  10.162 -		TE_SetupExplosion(vec, g_ExplosionSprite, 5.0, 1, 0, GetConVarInt(g_TimeBombRadius), 5000);
  10.163 -		TE_SendToAll();
  10.164 -
  10.165 -		EmitAmbientSound(SOUND_BOOM, vec, client, SNDLEVEL_RAIDSIREN);
  10.166 -
  10.167 -		ForcePlayerSuicide(client);
  10.168 -		KillTimeBomb(client);
  10.169 -		SetEntityRenderColor(client, 255, 255, 255, 255);
  10.170 -		
  10.171 -		if (GetConVarInt(g_TimeBombMode) > 0)
  10.172 -		{
  10.173 -			new teamOnly = ((GetConVarInt(g_TimeBombMode) == 1) ? true : false);
  10.174 -			new maxClients = GetMaxClients();
  10.175 -			
  10.176 -			//g_FilteredEntity = client;
  10.177 -			
  10.178 -			for (new i = 1; i < maxClients; i++)
  10.179 -			{
  10.180 -				if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
  10.181 -				{
  10.182 -					continue;
  10.183 -				}
  10.184 -				
  10.185 -				if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
  10.186 -				{
  10.187 -					continue;
  10.188 -				}
  10.189 -				
  10.190 -				new Float:pos[3];
  10.191 -				GetClientEyePosition(i, pos);
  10.192 -				
  10.193 -				new Float:distance = GetVectorDistance(vec, pos);
  10.194 -				
  10.195 -				if (distance > GetConVarFloat(g_TimeBombRadius))
  10.196 -				{
  10.197 -					continue;
  10.198 -				}
  10.199 -				
  10.200 -				new damage = 220;
  10.201 -				damage = RoundToFloor(damage * ((GetConVarFloat(g_TimeBombRadius) - distance) / GetConVarFloat(g_TimeBombRadius)));
  10.202 -					
  10.203 -				SlapPlayer(i, damage, false);
  10.204 -				TE_SetupExplosion(pos, g_ExplosionSprite, 0.05, 1, 0, 1, 1);
  10.205 -				TE_SendToAll();				
  10.206 -				
  10.207 -				/*
  10.208 -				new Float:dir[3];
  10.209 -				SubtractVectors(vec, pos, dir);
  10.210 -				TR_TraceRayFilter(vec, dir, MASK_SOLID, RayType_Infinite, TR_Filter_Client);
  10.211 -
  10.212 -				if (i == TR_GetEntityIndex())
  10.213 -				{
  10.214 -					new damage = 100;
  10.215 -					new radius = GetConVarInt(g_TimeBombRadius) / 2;
  10.216 -					
  10.217 -					if (distance > radius)
  10.218 -					{
  10.219 -						distance -= radius;
  10.220 -						damage = RoundToFloor(damage * ((radius - distance) / radius));
  10.221 -					}
  10.222 -					
  10.223 -					SlapPlayer(i, damage, false);
  10.224 -				}
  10.225 -				*/
  10.226 -			}		
  10.227 -		}
  10.228 -	}
  10.229 -			
  10.230 -	return Plugin_Handled;
  10.231 -}
  10.232 -
  10.233 -public AdminMenu_TimeBomb(Handle:topmenu, 
  10.234 -					  TopMenuAction:action,
  10.235 -					  TopMenuObject:object_id,
  10.236 -					  param,
  10.237 -					  String:buffer[],
  10.238 -					  maxlength)
  10.239 -{
  10.240 -	if (action == TopMenuAction_DisplayOption)
  10.241 -	{
  10.242 -		Format(buffer, maxlength, "%T", "TimeBomb player", param);
  10.243 -	}
  10.244 -	else if (action == TopMenuAction_SelectOption)
  10.245 -	{
  10.246 -		DisplayTimeBombMenu(param);
  10.247 -	}
  10.248 -}
  10.249 -
  10.250 -DisplayTimeBombMenu(client)
  10.251 -{
  10.252 -	new Handle:menu = CreateMenu(MenuHandler_TimeBomb);
  10.253 -	
  10.254 -	decl String:title[100];
  10.255 -	Format(title, sizeof(title), "%T:", "TimeBomb player", client);
  10.256 -	SetMenuTitle(menu, title);
  10.257 -	SetMenuExitBackButton(menu, true);
  10.258 -	
  10.259 -	AddTargetsToMenu(menu, client, true, true);
  10.260 -	
  10.261 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  10.262 -}
  10.263 -
  10.264 -public MenuHandler_TimeBomb(Handle:menu, MenuAction:action, param1, param2)
  10.265 -{
  10.266 -	if (action == MenuAction_End)
  10.267 -	{
  10.268 -		CloseHandle(menu);
  10.269 -	}
  10.270 -	else if (action == MenuAction_Cancel)
  10.271 -	{
  10.272 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  10.273 -		{
  10.274 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  10.275 -		}
  10.276 -	}
  10.277 -	else if (action == MenuAction_Select)
  10.278 -	{
  10.279 -		decl String:info[32];
  10.280 -		new userid, target;
  10.281 -		
  10.282 -		GetMenuItem(menu, param2, info, sizeof(info));
  10.283 -		userid = StringToInt(info);
  10.284 -
  10.285 -		if ((target = GetClientOfUserId(userid)) == 0)
  10.286 -		{
  10.287 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
  10.288 -		}
  10.289 -		else if (!CanUserTarget(param1, target))
  10.290 -		{
  10.291 -			PrintToChat(param1, "[SM] %t", "Unable to target");
  10.292 -		}
  10.293 -		else
  10.294 -		{
  10.295 -			new String:name[32];
  10.296 -			GetClientName(target, name, sizeof(name));
  10.297 -			
  10.298 -			PerformTimeBomb(param1, target, 2);
  10.299 -			ShowActivity2(param1, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", name);
  10.300 -		}
  10.301 -		
  10.302 -		/* Re-draw the menu if they're still valid */
  10.303 -		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  10.304 -		{
  10.305 -			DisplayTimeBombMenu(param1);
  10.306 -		}
  10.307 -	}
  10.308 -}
  10.309 -
  10.310 -public Action:Command_TimeBomb(client, args)
  10.311 -{
  10.312 -	if (args < 1)
  10.313 -	{
  10.314 -		ReplyToCommand(client, "[SM] Usage: sm_timebomb <#userid|name> [0/1]");
  10.315 -		return Plugin_Handled;
  10.316 -	}
  10.317 -
  10.318 -	decl String:arg[65];
  10.319 -	GetCmdArg(1, arg, sizeof(arg));
  10.320 -	
  10.321 -	new toggle = 2;
  10.322 -	if (args > 1)
  10.323 -	{
  10.324 -		decl String:arg2[2];
  10.325 -		GetCmdArg(2, arg2, sizeof(arg2));
  10.326 -		if (arg2[0])
  10.327 -		{
  10.328 -			toggle = 1;
  10.329 -		}
  10.330 -		else
  10.331 -		{
  10.332 -			toggle = 0;
  10.333 -		}
  10.334 -	}
  10.335 -
  10.336 -	decl String:target_name[MAX_TARGET_LENGTH];
  10.337 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  10.338 -	
  10.339 -	if ((target_count = ProcessTargetString(
  10.340 -			arg,
  10.341 -			client,
  10.342 -			target_list,
  10.343 -			MAXPLAYERS,
  10.344 -			COMMAND_FILTER_ALIVE,
  10.345 -			target_name,
  10.346 -			sizeof(target_name),
  10.347 -			tn_is_ml)) <= 0)
  10.348 -	{
  10.349 -		ReplyToTargetError(client, target_count);
  10.350 -		return Plugin_Handled;
  10.351 -	}
  10.352 -	
  10.353 -	for (new i = 0; i < target_count; i++)
  10.354 -	{
  10.355 -		PerformTimeBomb(client, target_list[i], toggle);
  10.356 -	}
  10.357 -	
  10.358 -	if (tn_is_ml)
  10.359 -	{
  10.360 -		ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", target_name);
  10.361 -	}
  10.362 -	else
  10.363 -	{
  10.364 -		ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", target_name);
  10.365 -	}
  10.366 -	
  10.367 -	return Plugin_Handled;
  10.368 -}
    11.1 --- a/plugins/basefunvotes.sp	Fri Feb 22 19:22:22 2008 +0000
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,350 +0,0 @@
    11.4 -/**
    11.5 - * vim: set ts=4 :
    11.6 - * =============================================================================
    11.7 - * SourceMod Fun Votes Plugin
    11.8 - * Implements extra fun vote commands.
    11.9 - *
   11.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   11.11 - * =============================================================================
   11.12 - *
   11.13 - * This program is free software; you can redistribute it and/or modify it under
   11.14 - * the terms of the GNU General Public License, version 3.0, as published by the
   11.15 - * Free Software Foundation.
   11.16 - * 
   11.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
   11.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   11.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   11.20 - * details.
   11.21 - *
   11.22 - * You should have received a copy of the GNU General Public License along with
   11.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
   11.24 - *
   11.25 - * As a special exception, AlliedModders LLC gives you permission to link the
   11.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
   11.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   11.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
   11.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
   11.30 - * this exception to all derivative works.  AlliedModders LLC defines further
   11.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   11.32 - * or <http://www.sourcemod.net/license.php>.
   11.33 - *
   11.34 - * Version: $Id$
   11.35 - */
   11.36 -
   11.37 -#pragma semicolon 1
   11.38 -
   11.39 -#include <sourcemod>
   11.40 -#include <sdktools>
   11.41 -
   11.42 -#undef REQUIRE_PLUGIN
   11.43 -#include <adminmenu>
   11.44 -
   11.45 -public Plugin:myinfo =
   11.46 -{
   11.47 -	name = "Basic Fun Votes",
   11.48 -	author = "AlliedModders LLC",
   11.49 -	description = "Fun Vote Commands",
   11.50 -	version = SOURCEMOD_VERSION,
   11.51 -	url = "http://www.sourcemod.net/"
   11.52 -};
   11.53 -
   11.54 -#define VOTE_NO "###no###"
   11.55 -#define VOTE_YES "###yes###"
   11.56 -
   11.57 -new Handle:g_hVoteMenu = INVALID_HANDLE;
   11.58 -
   11.59 -new Handle:g_Cvar_Limits[5] = {INVALID_HANDLE, ...};
   11.60 -new Handle:g_Cvar_Gravity = INVALID_HANDLE;
   11.61 -new Handle:g_Cvar_Alltalk = INVALID_HANDLE;
   11.62 -new Handle:g_Cvar_FF = INVALID_HANDLE;
   11.63 -
   11.64 -// new Handle:g_Cvar_Show = INVALID_HANDLE;
   11.65 -
   11.66 -enum voteType
   11.67 -{
   11.68 -	gravity = 0,
   11.69 -	burn,
   11.70 -	slay,
   11.71 -	alltalk,
   11.72 -	ff
   11.73 -};
   11.74 -
   11.75 -new voteType:g_voteType = voteType:gravity;
   11.76 -
   11.77 -// Menu API does not provide us with a way to pass multiple peices of data with a single
   11.78 -// choice, so some globals are used to hold stuff.
   11.79 -//
   11.80 -#define VOTE_CLIENTID	0
   11.81 -#define VOTE_USERID	1
   11.82 -new g_voteClient[2];		/* Holds the target's client id and user id */
   11.83 -
   11.84 -#define VOTE_NAME	0
   11.85 -#define VOTE_AUTHID	1
   11.86 -#define	VOTE_IP		2
   11.87 -new String:g_voteInfo[3][65];	/* Holds the target's name, authid, and IP */
   11.88 -
   11.89 -new Handle:hTopMenu = INVALID_HANDLE;
   11.90 -
   11.91 -#include "basefunvotes/votegravity.sp"
   11.92 -#include "basefunvotes/voteburn.sp"
   11.93 -#include "basefunvotes/voteslay.sp"
   11.94 -#include "basefunvotes/votealltalk.sp"
   11.95 -#include "basefunvotes/voteff.sp"
   11.96 -
   11.97 -public OnPluginStart()
   11.98 -{
   11.99 -	LoadTranslations("common.phrases");
  11.100 -	LoadTranslations("basevotes.phrases");
  11.101 -	LoadTranslations("basefunvotes.phrases");
  11.102 -	LoadTranslations("basefuncommands.phrases");
  11.103 -	
  11.104 -	RegAdminCmd("sm_votegravity", Command_VoteGravity, ADMFLAG_VOTE, "sm_votegravity <amount> [amount2] ... [amount5]");
  11.105 -	RegAdminCmd("sm_voteburn", Command_VoteBurn, ADMFLAG_VOTE|ADMFLAG_SLAY, "sm_voteburn <player>");
  11.106 -	RegAdminCmd("sm_voteslay", Command_VoteSlay, ADMFLAG_VOTE|ADMFLAG_SLAY, "sm_voteslay <player>");
  11.107 -	RegAdminCmd("sm_votealltalk", Command_VoteAlltalk, ADMFLAG_VOTE, "sm_votealltalk");
  11.108 -	RegAdminCmd("sm_voteff", Command_VoteFF, ADMFLAG_VOTE, "sm_voteff");
  11.109 -
  11.110 -	g_Cvar_Limits[0] = CreateConVar("sm_vote_gravity", "0.60", "percent required for successful gravity vote.", 0, true, 0.05, true, 1.0);
  11.111 -	g_Cvar_Limits[1] = CreateConVar("sm_vote_burn", "0.60", "percent required for successful burn vote.", 0, true, 0.05, true, 1.0);
  11.112 -	g_Cvar_Limits[2] = CreateConVar("sm_vote_slay", "0.60", "percent required for successful slay vote.", 0, true, 0.05, true, 1.0);
  11.113 -	g_Cvar_Limits[3] = CreateConVar("sm_vote_alltalk", "0.60", "percent required for successful alltalk vote.", 0, true, 0.05, true, 1.0);
  11.114 -	g_Cvar_Limits[4] = CreateConVar("sm_vote_ff", "0.60", "percent required for successful friendly fire vote.", 0, true, 0.05, true, 1.0);
  11.115 -	
  11.116 -	g_Cvar_Gravity = FindConVar("sv_gravity");
  11.117 -	g_Cvar_Alltalk = FindConVar("sv_alltalk");
  11.118 -	g_Cvar_FF = FindConVar("mp_friendlyfire");
  11.119 -	
  11.120 -	/*
  11.121 -	g_Cvar_Show = FindConVar("sm_vote_show");
  11.122 -	if (g_Cvar_Show == INVALID_HANDLE)
  11.123 -	{
  11.124 -		g_Cvar_Show = CreateConVar("sm_vote_show", "1", "Show player's votes? Default on.", 0, true, 0.0, true, 1.0);
  11.125 -	}
  11.126 -	*/
  11.127 -	
  11.128 -	/* Account for late loading */
  11.129 -	new Handle:topmenu;
  11.130 -	if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
  11.131 -	{
  11.132 -		OnAdminMenuReady(topmenu);
  11.133 -	}
  11.134 -}
  11.135 -
  11.136 -public OnAdminMenuReady(Handle:topmenu)
  11.137 -{
  11.138 -	/* Block us from being called twice */
  11.139 -	if (topmenu == hTopMenu)
  11.140 -	{
  11.141 -		return;
  11.142 -	}
  11.143 -	
  11.144 -	/* Save the Handle */
  11.145 -	hTopMenu = topmenu;
  11.146 -	
  11.147 -	/* Build the "Voting Commands" category */
  11.148 -	new TopMenuObject:voting_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_VOTINGCOMMANDS);
  11.149 -
  11.150 -	if (voting_commands != INVALID_TOPMENUOBJECT)
  11.151 -	{
  11.152 -		AddToTopMenu(hTopMenu,
  11.153 -			"sm_votegravity",
  11.154 -			TopMenuObject_Item,
  11.155 -			AdminMenu_VoteGravity,
  11.156 -			voting_commands,
  11.157 -			"sm_votegravity",
  11.158 -			ADMFLAG_VOTE);
  11.159 -			
  11.160 -		AddToTopMenu(hTopMenu,
  11.161 -			"sm_voteburn",
  11.162 -			TopMenuObject_Item,
  11.163 -			AdminMenu_VoteBurn,
  11.164 -			voting_commands,
  11.165 -			"sm_voteburn",
  11.166 -			ADMFLAG_VOTE|ADMFLAG_SLAY);
  11.167 -			
  11.168 -		AddToTopMenu(hTopMenu,
  11.169 -			"sm_voteslay",
  11.170 -			TopMenuObject_Item,
  11.171 -			AdminMenu_VoteSlay,
  11.172 -			voting_commands,
  11.173 -			"sm_voteslay",
  11.174 -			ADMFLAG_VOTE|ADMFLAG_SLAY);
  11.175 -			
  11.176 -		AddToTopMenu(hTopMenu,
  11.177 -			"sm_votealltalk",
  11.178 -			TopMenuObject_Item,
  11.179 -			AdminMenu_VoteAllTalk,
  11.180 -			voting_commands,
  11.181 -			"sm_votealltalk",
  11.182 -			ADMFLAG_VOTE);
  11.183 -			
  11.184 -		AddToTopMenu(hTopMenu,
  11.185 -			"sm_voteff",
  11.186 -			TopMenuObject_Item,
  11.187 -			AdminMenu_VoteFF,
  11.188 -			voting_commands,
  11.189 -			"sm_voteff",
  11.190 -			ADMFLAG_VOTE);
  11.191 -	}
  11.192 -}
  11.193 -
  11.194 -public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
  11.195 -{
  11.196 -	if (action == MenuAction_End)
  11.197 -	{
  11.198 -		VoteMenuClose();
  11.199 -	}
  11.200 -	else if (action == MenuAction_Display)
  11.201 -	{
  11.202 -	 	decl String:title[64];
  11.203 -		GetMenuTitle(menu, title, sizeof(title));
  11.204 -
  11.205 -	 	decl String:buffer[255];
  11.206 -		Format(buffer, sizeof(buffer), "%T", title, param1, g_voteInfo[VOTE_NAME]);
  11.207 -
  11.208 -		new Handle:panel = Handle:param2;
  11.209 -		SetPanelTitle(panel, buffer);
  11.210 -	}
  11.211 -	else if (action == MenuAction_DisplayItem)
  11.212 -	{
  11.213 -		decl String:display[64];
  11.214 -		GetMenuItem(menu, param2, "", 0, _, display, sizeof(display));
  11.215 -	 
  11.216 -	 	if (strcmp(display, VOTE_NO) == 0 || strcmp(display, VOTE_YES) == 0)
  11.217 -	 	{
  11.218 -			decl String:buffer[255];
  11.219 -			Format(buffer, sizeof(buffer), "%T", display, param1);
  11.220 -
  11.221 -			return RedrawMenuItem(buffer);
  11.222 -		}
  11.223 -	}
  11.224 -	/* else if (action == MenuAction_Select)
  11.225 -	{
  11.226 -		VoteSelect(menu, param1, param2);
  11.227 -	}*/
  11.228 -	else if (action == MenuAction_VoteCancel && param1 == VoteCancel_NoVotes)
  11.229 -	{
  11.230 -		PrintToChatAll("[SM] %t", "No Votes Cast");
  11.231 -	}
  11.232 -	else if (action == MenuAction_VoteEnd)
  11.233 -	{
  11.234 -		decl String:item[64];
  11.235 -		new Float:percent, Float:limit, votes, totalVotes;
  11.236 -
  11.237 -		GetMenuVoteInfo(param2, votes, totalVotes);
  11.238 -		GetMenuItem(menu, param1, item, sizeof(item));
  11.239 -		
  11.240 -		if (strcmp(item, VOTE_NO) == 0 && param1 == 1)
  11.241 -		{
  11.242 -			votes = totalVotes - votes; // Reverse the votes to be in relation to the Yes option.
  11.243 -		}
  11.244 -		
  11.245 -		percent = GetVotePercent(votes, totalVotes);
  11.246 -		
  11.247 -		limit = GetConVarFloat(g_Cvar_Limits[g_voteType]);
  11.248 -		
  11.249 -		/* :TODO: g_voteClient[userid] needs to be checked.
  11.250 -		 */
  11.251 -
  11.252 -		// A multi-argument vote is "always successful", but have to check if its a Yes/No vote.
  11.253 -		if ((strcmp(item, VOTE_YES) == 0 && FloatCompare(percent,limit) < 0 && param1 == 0) || (strcmp(item, VOTE_NO) == 0 && param1 == 1))
  11.254 -		{
  11.255 -			/* :TODO: g_voteClient[userid] should be used here and set to -1 if not applicable.
  11.256 -			 */
  11.257 -			LogAction(-1, -1, "Vote failed.");
  11.258 -			PrintToChatAll("[SM] %t", "Vote Failed", RoundToNearest(100.0*limit), RoundToNearest(100.0*percent), totalVotes);
  11.259 -		}
  11.260 -		else
  11.261 -		{
  11.262 -			PrintToChatAll("[SM] %t", "Vote Successful", RoundToNearest(100.0*percent), totalVotes);
  11.263 -			
  11.264 -			switch (g_voteType)
  11.265 -			{
  11.266 -				case (voteType:gravity):
  11.267 -				{
  11.268 -					PrintToChatAll("[SM] %t", "Cvar changed", "sv_gravity", item);					
  11.269 -					LogAction(-1, -1, "Changing gravity to %s due to vote.", item);
  11.270 -					SetConVarInt(g_Cvar_Gravity, StringToInt(item));
  11.271 -				}
  11.272 -				
  11.273 -				case (voteType:burn):
  11.274 -				{
  11.275 -					PrintToChatAll("[SM] %t", "Set target on fire", "_s", g_voteInfo[VOTE_NAME]);					
  11.276 -					LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote burn successful, igniting \"%L\"", g_voteClient[VOTE_CLIENTID]);
  11.277 -					
  11.278 -					IgniteEntity(g_voteClient[VOTE_CLIENTID], 19.8);	
  11.279 -				}
  11.280 -				
  11.281 -				case (voteType:slay):
  11.282 -				{
  11.283 -					PrintToChatAll("[SM] %t", "Slayed player", g_voteInfo[VOTE_NAME]);					
  11.284 -					LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote slay successful, slaying \"%L\"", g_voteClient[VOTE_CLIENTID]);
  11.285 -					
  11.286 -					ExtinguishEntity(g_voteClient[VOTE_CLIENTID]);
  11.287 -					ForcePlayerSuicide(g_voteClient[VOTE_CLIENTID]);
  11.288 -				}
  11.289 -				
  11.290 -				case (voteType:alltalk):
  11.291 -				{
  11.292 -					PrintToChatAll("[SM] %t", "Cvar changed", "sv_alltalk", (GetConVarBool(g_Cvar_Alltalk) ? "0" : "1"));
  11.293 -					LogAction(-1, -1, "Changing alltalk to %s due to vote.", (GetConVarBool(g_Cvar_Alltalk) ? "0" : "1"));
  11.294 -					SetConVarBool(g_Cvar_Alltalk, !GetConVarBool(g_Cvar_Alltalk));
  11.295 -				}
  11.296 -				
  11.297 -				case (voteType:ff):
  11.298 -				{
  11.299 -					PrintToChatAll("[SM] %t", "Cvar changed", "mp_friendlyfire", (GetConVarBool(g_Cvar_FF) ? "0" : "1"));
  11.300 -					LogAction(-1, -1, "Changing friendly fire to %s due to vote.", (GetConVarBool(g_Cvar_FF) ? "0" : "1"));
  11.301 -					SetConVarBool(g_Cvar_FF, !GetConVarBool(g_Cvar_FF));
  11.302 -				}				
  11.303 -			}
  11.304 -		}
  11.305 -	}
  11.306 -	
  11.307 -	return 0;
  11.308 -}
  11.309 -
  11.310 -/*
  11.311 -VoteSelect(Handle:menu, param1, param2 = 0)
  11.312 -{
  11.313 -	if (GetConVarInt(g_Cvar_VoteShow) == 1)
  11.314 -	{
  11.315 -		decl String:voter[64], String:junk[64], String:choice[64];
  11.316 -		GetClientName(param1, voter, sizeof(voter));
  11.317 -		GetMenuItem(menu, param2, junk, sizeof(junk), _, choice, sizeof(choice));
  11.318 -		PrintToChatAll("[SM] %T", "Vote Select", LANG_SERVER, voter, choice);
  11.319 -	}
  11.320 -}
  11.321 -*/
  11.322 -
  11.323 -VoteMenuClose()
  11.324 -{
  11.325 -	CloseHandle(g_hVoteMenu);
  11.326 -	g_hVoteMenu = INVALID_HANDLE;
  11.327 -}
  11.328 -
  11.329 -Float:GetVotePercent(votes, totalVotes)
  11.330 -{
  11.331 -	return FloatDiv(float(votes),float(totalVotes));
  11.332 -}
  11.333 -
  11.334 -bool:TestVoteDelay(client)
  11.335 -{
  11.336 - 	new delay = CheckVoteDelay();
  11.337 - 	
  11.338 - 	if (delay > 0)
  11.339 - 	{
  11.340 - 		if (delay > 60)
  11.341 - 		{
  11.342 - 			ReplyToCommand(client, "[SM] %t", "Vote Delay Minutes", delay % 60);
  11.343 - 		}
  11.344 - 		else
  11.345 - 		{
  11.346 - 			ReplyToCommand(client, "[SM] %t", "Vote Delay Seconds", delay);
  11.347 - 		}
  11.348 - 		
  11.349 - 		return false;
  11.350 - 	}
  11.351 - 	
  11.352 -	return true;
  11.353 -}
    12.1 --- a/plugins/basefunvotes/votealltalk.sp	Fri Feb 22 19:22:22 2008 +0000
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,104 +0,0 @@
    12.4 -/**
    12.5 - * vim: set ts=4 :
    12.6 - * =============================================================================
    12.7 - * SourceMod Basefunvotes Plugin
    12.8 - * Provides votealltalk functionality
    12.9 - *
   12.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   12.11 - * =============================================================================
   12.12 - *
   12.13 - * This program is free software; you can redistribute it and/or modify it under
   12.14 - * the terms of the GNU General Public License, version 3.0, as published by the
   12.15 - * Free Software Foundation.
   12.16 - * 
   12.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
   12.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   12.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   12.20 - * details.
   12.21 - *
   12.22 - * You should have received a copy of the GNU General Public License along with
   12.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
   12.24 - *
   12.25 - * As a special exception, AlliedModders LLC gives you permission to link the
   12.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
   12.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   12.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
   12.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
   12.30 - * this exception to all derivative works.  AlliedModders LLC defines further
   12.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   12.32 - * or <http://www.sourcemod.net/license.php>.
   12.33 - *
   12.34 - * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   12.35 - */
   12.36 -
   12.37 -DisplayVoteAllTalkMenu(client)
   12.38 -{
   12.39 -	if (IsVoteInProgress())
   12.40 -	{
   12.41 -		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
   12.42 -		return;
   12.43 -	}	
   12.44 -	
   12.45 -	if (!TestVoteDelay(client))
   12.46 -	{
   12.47 -		return;
   12.48 -	}
   12.49 -	
   12.50 -	LogAction(client, -1, "\"%L\" initiated an alltalk vote.", client);
   12.51 -	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Alltalk");
   12.52 -	
   12.53 -	g_voteType = voteType:alltalk;
   12.54 -	g_voteInfo[VOTE_NAME][0] = '\0';
   12.55 -
   12.56 -	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   12.57 -	
   12.58 -	if (GetConVarBool(g_Cvar_Alltalk))
   12.59 -	{
   12.60 -		SetMenuTitle(g_hVoteMenu, "Votealltalk Off");
   12.61 -	}
   12.62 -	else
   12.63 -	{
   12.64 -		SetMenuTitle(g_hVoteMenu, "Votealltalk On");
   12.65 -	}
   12.66 -	
   12.67 -	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
   12.68 -	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   12.69 -	SetMenuExitButton(g_hVoteMenu, false);
   12.70 -	VoteMenuToAll(g_hVoteMenu, 20);
   12.71 -}
   12.72 -
   12.73 -
   12.74 -public AdminMenu_VoteAllTalk(Handle:topmenu, 
   12.75 -							  TopMenuAction:action,
   12.76 -							  TopMenuObject:object_id,
   12.77 -							  param,
   12.78 -							  String:buffer[],
   12.79 -							  maxlength)
   12.80 -{
   12.81 -	if (action == TopMenuAction_DisplayOption)
   12.82 -	{
   12.83 -		Format(buffer, maxlength, "%T", "Alltalk vote", param);
   12.84 -	}
   12.85 -	else if (action == TopMenuAction_SelectOption)
   12.86 -	{
   12.87 -		DisplayVoteAllTalkMenu(param);
   12.88 -	}
   12.89 -	else if (action == TopMenuAction_DrawOption)
   12.90 -	{	
   12.91 -		/* disable this option if a vote is already running */
   12.92 -		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   12.93 -	}
   12.94 -}
   12.95 -
   12.96 -public Action:Command_VoteAlltalk(client, args)
   12.97 -{
   12.98 -	if (args > 0)
   12.99 -	{
  12.100 -		ReplyToCommand(client, "[SM] Usage: sm_votealltalk");
  12.101 -		return Plugin_Handled;	
  12.102 -	}
  12.103 -	
  12.104 -	DisplayVoteAllTalkMenu(client);
  12.105 -	
  12.106 -	return Plugin_Handled;
  12.107 -}
  12.108 \ No newline at end of file
    13.1 --- a/plugins/basefunvotes/voteburn.sp	Fri Feb 22 19:22:22 2008 +0000
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,178 +0,0 @@
    13.4 -/**
    13.5 - * vim: set ts=4 :
    13.6 - * =============================================================================
    13.7 - * SourceMod Basefunvotes Plugin
    13.8 - * Provides voteburn functionality
    13.9 - *
   13.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   13.11 - * =============================================================================
   13.12 - *
   13.13 - * This program is free software; you can redistribute it and/or modify it under
   13.14 - * the terms of the GNU General Public License, version 3.0, as published by the
   13.15 - * Free Software Foundation.
   13.16 - * 
   13.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
   13.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   13.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   13.20 - * details.
   13.21 - *
   13.22 - * You should have received a copy of the GNU General Public License along with
   13.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
   13.24 - *
   13.25 - * As a special exception, AlliedModders LLC gives you permission to link the
   13.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
   13.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   13.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
   13.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
   13.30 - * this exception to all derivative works.  AlliedModders LLC defines further
   13.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   13.32 - * or <http://www.sourcemod.net/license.php>.
   13.33 - *
   13.34 - * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   13.35 - */
   13.36 -
   13.37 -DisplayVoteBurnMenu(client, target, String:name[])
   13.38 -{
   13.39 -	if (!IsPlayerAlive(target))
   13.40 -	{
   13.41 -		ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
   13.42 -		return;
   13.43 -	}
   13.44 -	
   13.45 -	g_voteClient[VOTE_CLIENTID] = target;
   13.46 -	GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
   13.47 -
   13.48 -	LogAction(client, target, "\"%L\" initiated a burn vote against \"%L\"", client, target);
   13.49 -	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Burn", g_voteInfo[VOTE_NAME]);
   13.50 -	
   13.51 -	g_voteType = voteType:burn;
   13.52 -	
   13.53 -	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   13.54 -	SetMenuTitle(g_hVoteMenu, "Voteburn player");
   13.55 -	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
   13.56 -	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   13.57 -	SetMenuExitButton(g_hVoteMenu, false);
   13.58 -	VoteMenuToAll(g_hVoteMenu, 20);
   13.59 -}
   13.60 -
   13.61 -DisplayBurnTargetMenu(client)
   13.62 -{
   13.63 -	new Handle:menu = CreateMenu(MenuHandler_Burn);
   13.64 -	
   13.65 -	decl String:title[100];
   13.66 -	Format(title, sizeof(title), "%T:", "Burn vote", client);
   13.67 -	SetMenuTitle(menu, title);
   13.68 -	SetMenuExitBackButton(menu, true);
   13.69 -	
   13.70 -	AddTargetsToMenu(menu, client, true, true);
   13.71 -	
   13.72 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   13.73 -}
   13.74 -
   13.75 -public AdminMenu_VoteBurn(Handle:topmenu, 
   13.76 -							  TopMenuAction:action,
   13.77 -							  TopMenuObject:object_id,
   13.78 -							  param,
   13.79 -							  String:buffer[],
   13.80 -							  maxlength)
   13.81 -{
   13.82 -	if (action == TopMenuAction_DisplayOption)
   13.83 -	{
   13.84 -		Format(buffer, maxlength, "%T", "Burn vote", param);
   13.85 -	}
   13.86 -	else if (action == TopMenuAction_SelectOption)
   13.87 -	{
   13.88 -		DisplayBurnTargetMenu(param);
   13.89 -	}
   13.90 -	else if (action == TopMenuAction_DrawOption)
   13.91 -	{	
   13.92 -		/* disable this option if a vote is already running */
   13.93 -		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   13.94 -	}
   13.95 -}
   13.96 -
   13.97 -public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
   13.98 -{
   13.99 -	if (action == MenuAction_End)
  13.100 -	{
  13.101 -		CloseHandle(menu);
  13.102 -	}
  13.103 -	else if (action == MenuAction_Cancel)
  13.104 -	{
  13.105 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  13.106 -		{
  13.107 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  13.108 -		}
  13.109 -	}
  13.110 -	else if (action == MenuAction_Select)
  13.111 -	{
  13.112 -		decl String:info[32], String:name[32];
  13.113 -		new userid, target;
  13.114 -		
  13.115 -		GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
  13.116 -		userid = StringToInt(info);
  13.117 -
  13.118 -		if ((target = GetClientOfUserId(userid)) == 0)
  13.119 -		{
  13.120 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
  13.121 -		}
  13.122 -		else if (!CanUserTarget(param1, target))
  13.123 -		{
  13.124 -			PrintToChat(param1, "[SM] %t", "Unable to target");
  13.125 -		}
  13.126 -		else if (!IsPlayerAlive(target))
  13.127 -		{
  13.128 -			PrintToChat(param1, "[SM] %t", "Player has since died");
  13.129 -		}
  13.130 -		else
  13.131 -		{
  13.132 -			DisplayVoteBurnMenu(param1, target, name);
  13.133 -		}
  13.134 -	}
  13.135 -}
  13.136 -
  13.137 -public Action:Command_VoteBurn(client, args)
  13.138 -{
  13.139 -	if (args < 1)
  13.140 -	{
  13.141 -		ReplyToCommand(client, "[SM] Usage: sm_voteburn <player>");
  13.142 -		return Plugin_Handled;	
  13.143 -	}
  13.144 -	
  13.145 -	if (IsVoteInProgress())
  13.146 -	{
  13.147 -		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
  13.148 -		return Plugin_Handled;
  13.149 -	}	
  13.150 -	
  13.151 -	if (!TestVoteDelay(client))
  13.152 -	{
  13.153 -		return Plugin_Handled;
  13.154 -	}
  13.155 -	
  13.156 -	decl String:text[256], String:arg[64];
  13.157 -	GetCmdArgString(text, sizeof(text));
  13.158 -	
  13.159 -	BreakString(text, arg, sizeof(arg));
  13.160 -	
  13.161 -	decl String:target_name[MAX_TARGET_LENGTH];
  13.162 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  13.163 -	
  13.164 -	if ((target_count = ProcessTargetString(
  13.165 -			arg,
  13.166 -			client,
  13.167 -			target_list,
  13.168 -			MAXPLAYERS,
  13.169 -			COMMAND_FILTER_NO_MULTI,
  13.170 -			target_name,
  13.171 -			sizeof(target_name),
  13.172 -			tn_is_ml)) <= 0)
  13.173 -	{
  13.174 -		ReplyToTargetError(client, target_count);
  13.175 -		return Plugin_Handled;
  13.176 -	}
  13.177 -
  13.178 -	DisplayVoteBurnMenu(client, target_list[0], arg);
  13.179 -	
  13.180 -	return Plugin_Handled;
  13.181 -}
    14.1 --- a/plugins/basefunvotes/voteff.sp	Fri Feb 22 19:22:22 2008 +0000
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,103 +0,0 @@
    14.4 -/**
    14.5 - * vim: set ts=4 :
    14.6 - * =============================================================================
    14.7 - * SourceMod Basefunvotes Plugin
    14.8 - * Provides vote ff functionality
    14.9 - *
   14.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   14.11 - * =============================================================================
   14.12 - *
   14.13 - * This program is free software; you can redistribute it and/or modify it under
   14.14 - * the terms of the GNU General Public License, version 3.0, as published by the
   14.15 - * Free Software Foundation.
   14.16 - * 
   14.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
   14.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   14.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   14.20 - * details.
   14.21 - *
   14.22 - * You should have received a copy of the GNU General Public License along with
   14.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
   14.24 - *
   14.25 - * As a special exception, AlliedModders LLC gives you permission to link the
   14.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
   14.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   14.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
   14.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
   14.30 - * this exception to all derivative works.  AlliedModders LLC defines further
   14.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   14.32 - * or <http://www.sourcemod.net/license.php>.
   14.33 - *
   14.34 - * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   14.35 - */
   14.36 -
   14.37 -DisplayVoteFFMenu(client)
   14.38 -{
   14.39 -	if (IsVoteInProgress())
   14.40 -	{
   14.41 -		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
   14.42 -		return;
   14.43 -	}	
   14.44 -	
   14.45 -	if (!TestVoteDelay(client))
   14.46 -	{
   14.47 -		return;
   14.48 -	}
   14.49 -	
   14.50 -	LogAction(client, -1, "\"%L\" initiated a friendly fire vote.", client);
   14.51 -	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote FF");
   14.52 -	
   14.53 -	g_voteType = voteType:ff;
   14.54 -	g_voteInfo[VOTE_NAME][0] = '\0';
   14.55 -	
   14.56 -	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   14.57 -	
   14.58 -	if (GetConVarBool(g_Cvar_Alltalk))
   14.59 -	{
   14.60 -		SetMenuTitle(g_hVoteMenu, "Voteff Off");
   14.61 -	}
   14.62 -	else
   14.63 -	{
   14.64 -		SetMenuTitle(g_hVoteMenu, "Voteff On");
   14.65 -	}
   14.66 -	
   14.67 -	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
   14.68 -	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   14.69 -	SetMenuExitButton(g_hVoteMenu, false);
   14.70 -	VoteMenuToAll(g_hVoteMenu, 20);
   14.71 -}
   14.72 -
   14.73 -public AdminMenu_VoteFF(Handle:topmenu, 
   14.74 -							  TopMenuAction:action,
   14.75 -							  TopMenuObject:object_id,
   14.76 -							  param,
   14.77 -							  String:buffer[],
   14.78 -							  maxlength)
   14.79 -{
   14.80 -	if (action == TopMenuAction_DisplayOption)
   14.81 -	{
   14.82 -		Format(buffer, maxlength, "%T", "Vote FF", param);
   14.83 -	}
   14.84 -	else if (action == TopMenuAction_SelectOption)
   14.85 -	{
   14.86 -		DisplayVoteFFMenu(param);
   14.87 -	}
   14.88 -	else if (action == TopMenuAction_DrawOption)
   14.89 -	{	
   14.90 -		/* disable this option if a vote is already running */
   14.91 -		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   14.92 -	}
   14.93 -}
   14.94 -
   14.95 -public Action:Command_VoteFF(client, args)
   14.96 -{
   14.97 -	if (args > 0)
   14.98 -	{
   14.99 -		ReplyToCommand(client, "[SM] Usage: sm_voteff");
  14.100 -		return Plugin_Handled;	
  14.101 -	}
  14.102 -	
  14.103 -	DisplayVoteFFMenu(client);
  14.104 -	
  14.105 -	return Plugin_Handled;
  14.106 -}
  14.107 \ No newline at end of file
    15.1 --- a/plugins/basefunvotes/votegravity.sp	Fri Feb 22 19:22:22 2008 +0000
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,139 +0,0 @@
    15.4 -/**
    15.5 - * vim: set ts=4 :
    15.6 - * =============================================================================
    15.7 - * SourceMod Basefunvotes Plugin
    15.8 - * Provides votegravity functionality
    15.9 - *
   15.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   15.11 - * =============================================================================
   15.12 - *
   15.13 - * This program is free software; you can redistribute it and/or modify it under
   15.14 - * the terms of the GNU General Public License, version 3.0, as published by the
   15.15 - * Free Software Foundation.
   15.16 - * 
   15.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
   15.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   15.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   15.20 - * details.
   15.21 - *
   15.22 - * You should have received a copy of the GNU General Public License along with
   15.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
   15.24 - *
   15.25 - * As a special exception, AlliedModders LLC gives you permission to link the
   15.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
   15.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   15.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
   15.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
   15.30 - * this exception to all derivative works.  AlliedModders LLC defines further
   15.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   15.32 - * or <http://www.sourcemod.net/license.php>.
   15.33 - *
   15.34 - * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   15.35 - */
   15.36 -
   15.37 -
   15.38 -DisplayVoteGravityMenu(client,count,String:items[5][])
   15.39 -{
   15.40 -	LogAction(client, -1, "\"%L\" initiated a gravity vote.", client);
   15.41 -	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Gravity");
   15.42 -	
   15.43 -	g_voteType = voteType:gravity;
   15.44 -	
   15.45 -	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   15.46 -	
   15.47 -	if (count == 1)
   15.48 -	{
   15.49 -		strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), items[0]);
   15.50 -			
   15.51 -		SetMenuTitle(g_hVoteMenu, "Change Gravity To");
   15.52 -		AddMenuItem(g_hVoteMenu, items[0], "Yes");
   15.53 -		AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   15.54 -	}
   15.55 -	else
   15.56 -	{
   15.57 -		g_voteInfo[VOTE_NAME][0] = '\0';
   15.58 -		
   15.59 -		SetMenuTitle(g_hVoteMenu, "Gravity Vote");
   15.60 -		for (new i = 0; i < count; i++)
   15.61 -		{
   15.62 -			AddMenuItem(g_hVoteMenu, items[i], items[i]);
   15.63 -		}	
   15.64 -	}
   15.65 -	
   15.66 -	SetMenuExitButton(g_hVoteMenu, false);
   15.67 -	VoteMenuToAll(g_hVoteMenu, 20);
   15.68 -}
   15.69 -
   15.70 -public AdminMenu_VoteGravity(Handle:topmenu, 
   15.71 -							  TopMenuAction:action,
   15.72 -							  TopMenuObject:object_id,
   15.73 -							  param,
   15.74 -							  String:buffer[],
   15.75 -							  maxlength)
   15.76 -{
   15.77 -	if (action == TopMenuAction_DisplayOption)
   15.78 -	{
   15.79 -		Format(buffer, maxlength, "%T", "Gravity vote", param);
   15.80 -	}
   15.81 -	else if (action == TopMenuAction_SelectOption)
   15.82 -	{
   15.83 -		/* Might need a better way of selecting the list of pre-defined gravity choices */
   15.84 -		new String:items[5][5] ={"200","400","800","1600","3200"};
   15.85 -		DisplayVoteGravityMenu(param,5, items);
   15.86 -	}
   15.87 -	else if (action == TopMenuAction_DrawOption)
   15.88 -	{	
   15.89 -		/* disable this option if a vote is already running */
   15.90 -		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   15.91 -	}
   15.92 -}
   15.93 -
   15.94 -public Action:Command_VoteGravity(client, args)
   15.95 -{
   15.96 -	if (args < 1)
   15.97 -	{
   15.98 -		ReplyToCommand(client, "[SM] Usage: sm_votegravity <amount> [amount2] ... [amount5]");
   15.99 -		return Plugin_Handled;	
  15.100 -	}
  15.101 -	
  15.102 -	if (IsVoteInProgress())
  15.103 -	{
  15.104 -		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
  15.105 -		return Plugin_Handled;
  15.106 -	}
  15.107 -	
  15.108 -	if (!TestVoteDelay(client))
  15.109 -	{
  15.110 -		return Plugin_Handled;
  15.111 -	}
  15.112 -	
  15.113 -	decl String:text[256];
  15.114 -	GetCmdArgString(text, sizeof(text));
  15.115 -
  15.116 -	decl String:items[5][64];
  15.117 -	new count;	
  15.118 -	new len, pos;
  15.119 -	
  15.120 -	while (pos != -1 && count < 5)
  15.121 -	{	
  15.122 -		pos = BreakString(text[len], items[count], sizeof(items[]));
  15.123 -		
  15.124 -		decl Float:temp;
  15.125 -		if (StringToFloatEx(items[count], temp) == 0)
  15.126 -		{
  15.127 -			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
  15.128 -			return Plugin_Handled;
  15.129 -		}		
  15.130 -
  15.131 -		count++;
  15.132 -		
  15.133 -		if (pos != -1)
  15.134 -		{
  15.135 -			len += pos;
  15.136 -		}	
  15.137 -	}
  15.138 -	
  15.139 -	DisplayVoteGravityMenu(client, count, items);
  15.140 -	
  15.141 -	return Plugin_Handled;	
  15.142 -}
  15.143 \ No newline at end of file
    16.1 --- a/plugins/basefunvotes/voteslay.sp	Fri Feb 22 19:22:22 2008 +0000
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,179 +0,0 @@
    16.4 -/**
    16.5 - * vim: set ts=4 :
    16.6 - * =============================================================================
    16.7 - * SourceMod Basefunvotes Plugin
    16.8 - * Provides voteslay functionality
    16.9 - *
   16.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   16.11 - * =============================================================================
   16.12 - *
   16.13 - * This program is free software; you can redistribute it and/or modify it under
   16.14 - * the terms of the GNU General Public License, version 3.0, as published by the
   16.15 - * Free Software Foundation.
   16.16 - * 
   16.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
   16.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   16.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   16.20 - * details.
   16.21 - *
   16.22 - * You should have received a copy of the GNU General Public License along with
   16.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
   16.24 - *
   16.25 - * As a special exception, AlliedModders LLC gives you permission to link the
   16.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
   16.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   16.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
   16.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
   16.30 - * this exception to all derivative works.  AlliedModders LLC defines further
   16.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   16.32 - * or <http://www.sourcemod.net/license.php>.
   16.33 - *
   16.34 - * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   16.35 - */
   16.36 -
   16.37 -
   16.38 -DisplayVoteSlayMenu(client, target, String:name[])
   16.39 -{
   16.40 -	if (!IsPlayerAlive(target))
   16.41 -	{
   16.42 -		ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
   16.43 -		return;
   16.44 -	}
   16.45 -	
   16.46 -	g_voteClient[VOTE_CLIENTID] = target;
   16.47 -	GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
   16.48 -
   16.49 -	LogAction(client, target, "\"%L\" initiated a slay vote against \"%L\"", client, target);
   16.50 -	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Slay", g_voteInfo[VOTE_NAME]);
   16.51 -	
   16.52 -	g_voteType = voteType:slay;
   16.53 -	
   16.54 -	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   16.55 -	SetMenuTitle(g_hVoteMenu, "Voteslay Player");
   16.56 -	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
   16.57 -	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   16.58 -	SetMenuExitButton(g_hVoteMenu, false);
   16.59 -	VoteMenuToAll(g_hVoteMenu, 20);
   16.60 -}
   16.61 -
   16.62 -DisplaySlayTargetMenu(client)
   16.63 -{
   16.64 -	new Handle:menu = CreateMenu(MenuHandler_Slay);
   16.65 -	
   16.66 -	decl String:title[100];
   16.67 -	Format(title, sizeof(title), "%T:", "Slay vote", client);
   16.68 -	SetMenuTitle(menu, title);
   16.69 -	SetMenuExitBackButton(menu, true);
   16.70 -	
   16.71 -	AddTargetsToMenu(menu, client, true, true);
   16.72 -	
   16.73 -	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   16.74 -}
   16.75 -
   16.76 -public AdminMenu_VoteSlay(Handle:topmenu, 
   16.77 -							  TopMenuAction:action,
   16.78 -							  TopMenuObject:object_id,
   16.79 -							  param,
   16.80 -							  String:buffer[],
   16.81 -							  maxlength)
   16.82 -{
   16.83 -	if (action == TopMenuAction_DisplayOption)
   16.84 -	{
   16.85 -		Format(buffer, maxlength, "%T", "Slay vote", param);
   16.86 -	}
   16.87 -	else if (action == TopMenuAction_SelectOption)
   16.88 -	{
   16.89 -		DisplaySlayTargetMenu(param);
   16.90 -	}
   16.91 -	else if (action == TopMenuAction_DrawOption)
   16.92 -	{	
   16.93 -		/* disable this option if a vote is already running */
   16.94 -		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   16.95 -	}
   16.96 -}
   16.97 -
   16.98 -public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
   16.99 -{
  16.100 -	if (action == MenuAction_End)
  16.101 -	{
  16.102 -		CloseHandle(menu);
  16.103 -	}
  16.104 -	else if (action == MenuAction_Cancel)
  16.105 -	{
  16.106 -		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  16.107 -		{
  16.108 -			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  16.109 -		}
  16.110 -	}
  16.111 -	else if (action == MenuAction_Select)
  16.112 -	{
  16.113 -		decl String:info[32], String:name[32];
  16.114 -		new userid, target;
  16.115 -		
  16.116 -		GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
  16.117 -		userid = StringToInt(info);
  16.118 -
  16.119 -		if ((target = GetClientOfUserId(userid)) == 0)
  16.120 -		{
  16.121 -			PrintToChat(param1, "[SM] %t", "Player no longer available");
  16.122 -		}
  16.123 -		else if (!CanUserTarget(param1, target))
  16.124 -		{
  16.125 -			PrintToChat(param1, "[SM] %t", "Unable to target");
  16.126 -		}
  16.127 -		else if (!IsPlayerAlive(target))
  16.128 -		{
  16.129 -			PrintToChat(param1, "[SM] %t", "Player has since died");
  16.130 -		}
  16.131 -		else
  16.132 -		{
  16.133 -			DisplayVoteSlayMenu(param1, target, name);
  16.134 -		}
  16.135 -	}
  16.136 -}
  16.137 -
  16.138 -public Action:Command_VoteSlay(client, args)
  16.139 -{
  16.140 -	if (args < 1)
  16.141 -	{
  16.142 -		ReplyToCommand(client, "[SM] Usage: sm_voteslay <player>");
  16.143 -		return Plugin_Handled;	
  16.144 -	}
  16.145 -	
  16.146 -	if (IsVoteInProgress())
  16.147 -	{
  16.148 -		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
  16.149 -		return Plugin_Handled;
  16.150 -	}	
  16.151 -	
  16.152 -	if (!TestVoteDelay(client))
  16.153 -	{
  16.154 -		return Plugin_Handled;
  16.155 -	}
  16.156 -	
  16.157 -	decl String:text[256], String:arg[64];
  16.158 -	GetCmdArgString(text, sizeof(text));
  16.159 -	
  16.160 -	BreakString(text, arg, sizeof(arg));
  16.161 -	
  16.162 -	decl String:target_name[MAX_TARGET_LENGTH];
  16.163 -	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  16.164 -	
  16.165 -	if ((target_count = ProcessTargetString(
  16.166 -			arg,
  16.167 -			client,
  16.168 -			target_list,
  16.169 -			MAXPLAYERS,
  16.170 -			COMMAND_FILTER_NO_MULTI,
  16.171 -			target_name,
  16.172 -			sizeof(target_name),
  16.173 -			tn_is_ml)) <= 0)
  16.174 -	{
  16.175 -		ReplyToTargetError(client, target_count);
  16.176 -		return Plugin_Handled;
  16.177 -	}
  16.178 -
  16.179 -	DisplayVoteSlayMenu(client, target_list[0], arg);
  16.180 -	
  16.181 -	return Plugin_Handled;
  16.182 -}
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/plugins/funcommands.sp	Fri Feb 22 21:01:08 2008 +0000
    17.3 @@ -0,0 +1,412 @@
    17.4 +/**
    17.5 + * vim: set ts=4 :
    17.6 + * =============================================================================
    17.7 + * SourceMod Basic Fun Commands Plugin
    17.8 + * Implements basic punishment commands.
    17.9 + *
   17.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   17.11 + * =============================================================================
   17.12 + *
   17.13 + * This program is free software; you can redistribute it and/or modify it under
   17.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   17.15 + * Free Software Foundation.
   17.16 + * 
   17.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   17.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   17.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   17.20 + * details.
   17.21 + *
   17.22 + * You should have received a copy of the GNU General Public License along with
   17.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   17.24 + *
   17.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   17.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   17.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   17.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   17.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   17.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   17.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   17.32 + * or <http://www.sourcemod.net/license.php>.
   17.33 + *
   17.34 + * Version: $Id$
   17.35 + */
   17.36 +
   17.37 +#pragma semicolon 1
   17.38 +
   17.39 +#include <sourcemod>
   17.40 +#include <sdktools>
   17.41 +#undef REQUIRE_PLUGIN
   17.42 +#include <adminmenu>
   17.43 +
   17.44 +public Plugin:myinfo =
   17.45 +{
   17.46 +	name = "Fun Commands",
   17.47 +	author = "AlliedModders LLC",
   17.48 +	description = "Fun Commands",
   17.49 +	version = SOURCEMOD_VERSION,
   17.50 +	url = "http://www.sourcemod.net/"
   17.51 +};
   17.52 +
   17.53 +// -------------------------------------------------------------------------------
   17.54 +// Set any of these to 0 and recompile to completely disable those commands
   17.55 +// -------------------------------------------------------------------------------
   17.56 +#define BEACON		1
   17.57 +#define TIMEBOMB	1
   17.58 +#define FIRE		1
   17.59 +#define ICE			1
   17.60 +#define GRAVITY		1
   17.61 +#define BLIND		1
   17.62 +#define NOCLIP		1
   17.63 +#define DRUG		1
   17.64 +#define TELEPORT	1
   17.65 +#define HEALTH		1
   17.66 +#define COLORS		1
   17.67 +#define CASH		1
   17.68 +// -------------------------------------------------------------------------------
   17.69 +
   17.70 +new Handle:hTopMenu = INVALID_HANDLE;
   17.71 +
   17.72 +// Sounds
   17.73 +#define SOUND_BLIP		"buttons/blip1.wav"
   17.74 +#define SOUND_BEEP		"buttons/button17.wav"
   17.75 +#define SOUND_FINAL		"weapons/cguard/charging.wav"
   17.76 +#define SOUND_BOOM		"weapons/explode3.wav"
   17.77 +#define SOUND_FREEZE	"physics/glass/glass_impact_bullet4.wav"
   17.78 +
   17.79 +// Following are model indexes for temp entities
   17.80 +new g_BeamSprite;
   17.81 +new g_BeamSprite2;
   17.82 +new g_HaloSprite;
   17.83 +new g_GlowSprite;
   17.84 +new g_ExplosionSprite;
   17.85 +
   17.86 +// Basic color arrays for temp entities
   17.87 +new redColor[4] = {255, 75, 75, 255};
   17.88 +new orangeColor[4] = {255, 128, 0, 255};
   17.89 +new greenColor[4] = {75, 255, 75, 255};
   17.90 +new blueColor[4] = {75, 75, 255, 255};
   17.91 +new whiteColor[4] = {255, 255, 255, 255};
   17.92 +new greyColor[4] = {128, 128, 128, 255};
   17.93 +
   17.94 +// UserMessageId for Fade.
   17.95 +new UserMsg:g_FadeUserMsgId;
   17.96 +
   17.97 +// Include various commands and supporting functions
   17.98 +#if BEACON
   17.99 +#include "funcommands/beacon.sp"
  17.100 +#endif
  17.101 +#if TIMEBOMB
  17.102 +#include "funcommands/timebomb.sp"
  17.103 +#endif
  17.104 +#if FIRE
  17.105 +#include "funcommands/fire.sp"
  17.106 +#endif
  17.107 +#if ICE
  17.108 +#include "funcommands/ice.sp"
  17.109 +#endif
  17.110 +#if GRAVITY
  17.111 +#include "funcommands/gravity.sp"
  17.112 +#endif
  17.113 +#if BLIND
  17.114 +#include "funcommands/blind.sp"
  17.115 +#endif
  17.116 +#if NOCLIP
  17.117 +#include "funcommands/noclip.sp"
  17.118 +#endif
  17.119 +#if DRUG
  17.120 +#include "funcommands/drug.sp"
  17.121 +#endif
  17.122 +
  17.123 +public OnPluginStart()
  17.124 +{
  17.125 +	if (FindPluginByFile("basefuncommands.smx") != INVALID_HANDLE)
  17.126 +	{
  17.127 +		ThrowError("This plugin replaces basefuncommands.  You cannot run both at once.");
  17.128 +	}
  17.129 +	
  17.130 +	LoadTranslations("common.phrases");
  17.131 +	LoadTranslations("basefuncommands.phrases");
  17.132 +
  17.133 +	g_FadeUserMsgId = GetUserMessageId("Fade");
  17.134 +	
  17.135 +	RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> <filename>");
  17.136 +
  17.137 +	HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);	
  17.138 +
  17.139 +	#if BEACON
  17.140 +	SetupBeacon();		// sm_beacon
  17.141 +	#endif
  17.142 +	
  17.143 +	#if TIMEBOMB
  17.144 +	SetupTimeBomb();	// sm_timebomb
  17.145 +	#endif
  17.146 +	
  17.147 +	#if FIRE
  17.148 +	SetupFire();		// sm_burn and sm_firebomb
  17.149 +	#endif
  17.150 +	
  17.151 +	#if ICE
  17.152 +	SetupIce();			// sm_freeze and sm_freezebomb
  17.153 +	#endif
  17.154 +	
  17.155 +	#if GRAVITY
  17.156 +	SetupGravity();		// sm_gravity
  17.157 +	#endif
  17.158 +	
  17.159 +	#if BLIND
  17.160 +	SetupBlind();		// sm_blind
  17.161 +	#endif
  17.162 +	
  17.163 +	#if NOCLIP
  17.164 +	SetupNoClip();		// sm_noclip
  17.165 +	#endif
  17.166 +	
  17.167 +	#if DRUG
  17.168 +	SetupDrugs();		// sm_drug
  17.169 +	#endif
  17.170 +	
  17.171 +	AutoExecConfig(true, "funcommands");
  17.172 +	
  17.173 +	/* Account for late loading */
  17.174 +	new Handle:topmenu;
  17.175 +	if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
  17.176 +	{
  17.177 +		OnAdminMenuReady(topmenu);
  17.178 +	}
  17.179 +}
  17.180 +
  17.181 +public OnMapStart()
  17.182 +{
  17.183 +	PrecacheSound(SOUND_BLIP, true);
  17.184 +	PrecacheSound(SOUND_BEEP, true);
  17.185 +	PrecacheSound(SOUND_FINAL, true);
  17.186 +	PrecacheSound(SOUND_BOOM, true);
  17.187 +	PrecacheSound(SOUND_FREEZE, true);
  17.188 +
  17.189 +	g_BeamSprite = PrecacheModel("materials/sprites/laser.vmt");
  17.190 +	g_BeamSprite2 = PrecacheModel("sprites/bluelight1.vmt");
  17.191 +	g_HaloSprite = PrecacheModel("materials/sprites/halo01.vmt");	
  17.192 +	g_GlowSprite = PrecacheModel("sprites/blueglow2.vmt");
  17.193 +	g_ExplosionSprite = PrecacheModel("sprites/sprite_fire01.vmt");
  17.194 +}
  17.195 +
  17.196 +public OnMapEnd()
  17.197 +{
  17.198 +	#if BEACON
  17.199 +	KillAllBeacons();
  17.200 +	#endif
  17.201 +	#if TIMEBOMB
  17.202 +	KillAllTimeBombs();
  17.203 +	#endif
  17.204 +	#if FIRE
  17.205 +	KillAllFireBombs();
  17.206 +	#endif
  17.207 +	#if ICE
  17.208 +	KillAllFreezes();
  17.209 +	#endif
  17.210 +	#if DRUG
  17.211 +	KillAllDrugs();
  17.212 +	#endif
  17.213 +}
  17.214 +
  17.215 +public Action:Event_RoundEnd(Handle:event,const String:name[],bool:dontBroadcast)
  17.216 +{
  17.217 +	#if BEACON
  17.218 +	KillAllBeacons();
  17.219 +	#endif
  17.220 +	#if TIMEBOMB
  17.221 +	KillAllTimeBombs();
  17.222 +	#endif
  17.223 +	#if FIRE
  17.224 +	KillAllFireBombs();
  17.225 +	#endif
  17.226 +	#if ICE
  17.227 +	KillAllFreezes();
  17.228 +	#endif
  17.229 +	#if DRUG
  17.230 +	KillAllDrugs();
  17.231 +	#endif
  17.232 +	
  17.233 +	return Plugin_Handled;
  17.234 +}
  17.235 +
  17.236 +public OnAdminMenuReady(Handle:topmenu)
  17.237 +{
  17.238 +	/* Block us from being called twice */
  17.239 +	if (topmenu == hTopMenu)
  17.240 +	{
  17.241 +		return;
  17.242 +	}
  17.243 +	
  17.244 +	/* Save the Handle */
  17.245 +	hTopMenu = topmenu;
  17.246 +	
  17.247 +	/* Find the "Player Commands" category */
  17.248 +	new TopMenuObject:player_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_PLAYERCOMMANDS);
  17.249 +
  17.250 +	if (player_commands != INVALID_TOPMENUOBJECT)
  17.251 +	{
  17.252 +		#if BEACON
  17.253 +		AddToTopMenu(hTopMenu,
  17.254 +			"sm_beacon",
  17.255 +			TopMenuObject_Item,
  17.256 +			AdminMenu_Beacon,
  17.257 +			player_commands,
  17.258 +			"sm_beacon",
  17.259 +			ADMFLAG_SLAY);
  17.260 +		#endif
  17.261 +		
  17.262 +		#if TIMEBOMB
  17.263 +		AddToTopMenu(hTopMenu,
  17.264 +			"sm_timebomb",
  17.265 +			TopMenuObject_Item,
  17.266 +			AdminMenu_TimeBomb,
  17.267 +			player_commands,
  17.268 +			"sm_timebomb",
  17.269 +			ADMFLAG_SLAY);
  17.270 +		#endif
  17.271 +		
  17.272 +		#if FIRE
  17.273 +		AddToTopMenu(hTopMenu,
  17.274 +			"sm_burn",
  17.275 +			TopMenuObject_Item,
  17.276 +			AdminMenu_Burn,
  17.277 +			player_commands,
  17.278 +			"sm_burn",
  17.279 +			ADMFLAG_SLAY);
  17.280 +			
  17.281 +		AddToTopMenu(hTopMenu,
  17.282 +			"sm_firebomb",
  17.283 +			TopMenuObject_Item,
  17.284 +			AdminMenu_FireBomb,
  17.285 +			player_commands,
  17.286 +			"sm_firebomb",
  17.287 +			ADMFLAG_SLAY);
  17.288 +		#endif
  17.289 +		
  17.290 +		#if ICE
  17.291 +		AddToTopMenu(hTopMenu,
  17.292 +			"sm_freeze",
  17.293 +			TopMenuObject_Item,
  17.294 +			AdminMenu_Freeze,
  17.295 +			player_commands,
  17.296 +			"sm_freeze",
  17.297 +			ADMFLAG_SLAY);
  17.298 +			
  17.299 +		AddToTopMenu(hTopMenu,
  17.300 +			"sm_freezebomb",
  17.301 +			TopMenuObject_Item,
  17.302 +			AdminMenu_FreezeBomb,
  17.303 +			player_commands,
  17.304 +			"sm_freezebomb",
  17.305 +			ADMFLAG_SLAY);
  17.306 +		#endif
  17.307 +			
  17.308 +		#if GRAVITY
  17.309 +		AddToTopMenu(hTopMenu,
  17.310 +			"sm_gravity",
  17.311 +			TopMenuObject_Item,
  17.312 +			AdminMenu_Gravity,
  17.313 +			player_commands,
  17.314 +			"sm_gravity",
  17.315 +			ADMFLAG_SLAY);
  17.316 +		#endif
  17.317 +			
  17.318 +		#if BLIND
  17.319 +		AddToTopMenu(hTopMenu,
  17.320 +			"sm_blind",
  17.321 +			TopMenuObject_Item,
  17.322 +			AdminMenu_Blind,
  17.323 +			player_commands,
  17.324 +			"sm_blind",
  17.325 +			ADMFLAG_SLAY);
  17.326 +		#endif
  17.327 +		
  17.328 +		#if NOCLIP
  17.329 +		AddToTopMenu(hTopMenu,
  17.330 +			"sm_noclip",
  17.331 +			TopMenuObject_Item,
  17.332 +			AdminMenu_NoClip,
  17.333 +			player_commands,
  17.334 +			"sm_noclip",
  17.335 +			ADMFLAG_SLAY);
  17.336 +		#endif
  17.337 +		
  17.338 +		#if DRUG
  17.339 +		AddToTopMenu(hTopMenu,
  17.340 +			"sm_drug",
  17.341 +			TopMenuObject_Item,
  17.342 +			AdminMenu_Drug,
  17.343 +			player_commands,
  17.344 +			"sm_drug",
  17.345 +			ADMFLAG_SLAY);
  17.346 +		#endif		
  17.347 +	}
  17.348 +}
  17.349 +
  17.350 +public Action:Command_Play(client, args)
  17.351 +{
  17.352 +	if (args < 2)
  17.353 +	{
  17.354 +		ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
  17.355 +	}
  17.356 +
  17.357 +	new String:Arguments[PLATFORM_MAX_PATH + 65];
  17.358 +	GetCmdArgString(Arguments, sizeof(Arguments));
  17.359 +
  17.360 + 	decl String:Arg[65];
  17.361 +	new len = BreakString(Arguments, Arg, sizeof(Arg));
  17.362 +
  17.363 +	/* Make sure it does not go out of bound by doing "sm_play user  "*/
  17.364 +	if (len == -1)
  17.365 +	{
  17.366 +		ReplyToCommand(client, "[SM] Usage: sm_play <#userid|name> <filename>");
  17.367 +		return Plugin_Handled;
  17.368 +	}
  17.369 +
  17.370 +	/* Incase they put quotes and white spaces after the quotes */
  17.371 +	if (Arguments[len] == '"')
  17.372 +	{
  17.373 +		len++;
  17.374 +		new FileLen = TrimString(Arguments[len]) + len;
  17.375 +
  17.376 +		if (Arguments[FileLen - 1] == '"')
  17.377 +		{
  17.378 +			Arguments[FileLen - 1] = '\0';
  17.379 +		}
  17.380 +	}
  17.381 +	
  17.382 +	decl String:target_name[MAX_TARGET_LENGTH];
  17.383 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  17.384 +	
  17.385 +	if ((target_count = ProcessTargetString(
  17.386 +			Arg,
  17.387 +			client,
  17.388 +			target_list,
  17.389 +			MAXPLAYERS,
  17.390 +			COMMAND_FILTER_NO_BOTS,
  17.391 +			target_name,
  17.392 +			sizeof(target_name),
  17.393 +			tn_is_ml)) <= 0)
  17.394 +	{
  17.395 +		ReplyToTargetError(client, target_count);
  17.396 +		return Plugin_Handled;
  17.397 +	}
  17.398 +	
  17.399 +	for (new i = 0; i < target_count; i++)
  17.400 +	{
  17.401 +		ClientCommand(target_list[i], "playgamesound \"%s\"", Arguments[len]);
  17.402 +		LogAction(client, target_list[i], "\"%L\" played sound on \"%L\" (file \"%s\")", client, target_list[i], Arguments[len]);
  17.403 +	}
  17.404 +	
  17.405 +	if (tn_is_ml)
  17.406 +	{
  17.407 +		ShowActivity2(client, "[SM] ", "%t", "Played sound to target", target_name);
  17.408 +	}
  17.409 +	else
  17.410 +	{
  17.411 +		ShowActivity2(client, "[SM] ", "%t", "Played sound to target", "_s", target_name);
  17.412 +	}
  17.413 +
  17.414 +	return Plugin_Handled;
  17.415 +}
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/plugins/funcommands/beacon.sp	Fri Feb 22 21:01:08 2008 +0000
    18.3 @@ -0,0 +1,280 @@
    18.4 +/**
    18.5 + * vim: set ts=4 :
    18.6 + * =============================================================================
    18.7 + * SourceMod Basefuncommands Plugin
    18.8 + * Provides beacon functionality
    18.9 + *
   18.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   18.11 + * =============================================================================
   18.12 + *
   18.13 + * This program is free software; you can redistribute it and/or modify it under
   18.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   18.15 + * Free Software Foundation.
   18.16 + * 
   18.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   18.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   18.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   18.20 + * details.
   18.21 + *
   18.22 + * You should have received a copy of the GNU General Public License along with
   18.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   18.24 + *
   18.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   18.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   18.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   18.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   18.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   18.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   18.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   18.32 + * or <http://www.sourcemod.net/license.php>.
   18.33 + *
   18.34 + * Version: $Id$
   18.35 + */
   18.36 +
   18.37 +new Handle:g_BeaconTimers[MAXPLAYERS+1];
   18.38 +
   18.39 +new Handle:g_BeaconRadius = INVALID_HANDLE;
   18.40 +
   18.41 +SetupBeacon()
   18.42 +{
   18.43 +	RegAdminCmd("sm_beacon", Command_Beacon, ADMFLAG_SLAY, "sm_beacon <#userid|name> [0/1]");
   18.44 +	
   18.45 +	g_BeaconRadius = CreateConVar("sm_beacon_radius", "375", "Sets the radius for beacon's light rings.", 0, true, 50.0, true, 1500.0);
   18.46 +}
   18.47 +
   18.48 +CreateBeacon(client)
   18.49 +{
   18.50 +	g_BeaconTimers[client] = CreateTimer(2.0, Timer_Beacon, client, TIMER_REPEAT);	
   18.51 +}
   18.52 +
   18.53 +KillBeacon(client)
   18.54 +{
   18.55 +	KillTimer(g_BeaconTimers[client]);
   18.56 +	g_BeaconTimers[client] = INVALID_HANDLE;
   18.57 +}
   18.58 +
   18.59 +KillAllBeacons()
   18.60 +{
   18.61 +	new maxclients = GetMaxClients();
   18.62 +	for (new i = 1; i <= maxclients; i++)
   18.63 +	{
   18.64 +		if (g_BeaconTimers[i] != INVALID_HANDLE)
   18.65 +		{
   18.66 +			KillBeacon(i);
   18.67 +		}
   18.68 +	}
   18.69 +}
   18.70 +
   18.71 +PerformBeacon(client, target, toggle)
   18.72 +{
   18.73 +	switch (toggle)
   18.74 +	{
   18.75 +		case (2):
   18.76 +		{
   18.77 +			if (g_BeaconTimers[target] == INVALID_HANDLE)
   18.78 +			{
   18.79 +				CreateBeacon(target);
   18.80 +				LogAction(client, target, "\"%L\" set a beacon on \"%L\"", client, target);
   18.81 +			}
   18.82 +			else
   18.83 +			{
   18.84 +				KillBeacon(target);
   18.85 +				LogAction(client, target, "\"%L\" removed a beacon on \"%L\"", client, target);
   18.86 +			}			
   18.87 +		}
   18.88 +
   18.89 +		case (1):
   18.90 +		{
   18.91 +			if (g_BeaconTimers[target] == INVALID_HANDLE)
   18.92 +			{
   18.93 +				CreateBeacon(target);
   18.94 +				LogAction(client, target, "\"%L\" set a beacon on \"%L\"", client, target);
   18.95 +			}			
   18.96 +		}
   18.97 +		
   18.98 +		case (0):
   18.99 +		{
  18.100 +			if (g_BeaconTimers[target] != INVALID_HANDLE)
  18.101 +			{
  18.102 +				KillBeacon(target);
  18.103 +				LogAction(client, target, "\"%L\" removed a beacon on \"%L\"", client, target);
  18.104 +			}			
  18.105 +		}
  18.106 +	}
  18.107 +}
  18.108 +
  18.109 +public Action:Timer_Beacon(Handle:timer, any:client)
  18.110 +{
  18.111 +	if (!IsClientInGame(client) || !IsPlayerAlive(client))
  18.112 +	{
  18.113 +		KillBeacon(client);		
  18.114 +
  18.115 +		return Plugin_Handled;
  18.116 +	}
  18.117 +	
  18.118 +	new team = GetClientTeam(client);
  18.119 +
  18.120 +	new Float:vec[3];
  18.121 +	GetClientAbsOrigin(client, vec);
  18.122 +	vec[2] += 10;
  18.123 +
  18.124 +	TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_BeaconRadius), g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
  18.125 +	TE_SendToAll();
  18.126 +	
  18.127 +	if (team == 2)
  18.128 +	{
  18.129 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_BeaconRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, redColor, 10, 0);
  18.130 +	}
  18.131 +	else if (team == 3)
  18.132 +	{
  18.133 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_BeaconRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, blueColor, 10, 0);
  18.134 +	}
  18.135 +	else
  18.136 +	{
  18.137 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_BeaconRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, greenColor, 10, 0);
  18.138 +	}
  18.139 +	
  18.140 +	TE_SendToAll();
  18.141 +		
  18.142 +	GetClientEyePosition(client, vec);
  18.143 +	EmitAmbientSound(SOUND_BLIP, vec, client, SNDLEVEL_RAIDSIREN);	
  18.144 +		
  18.145 +	return Plugin_Handled;
  18.146 +}
  18.147 +
  18.148 +public AdminMenu_Beacon(Handle:topmenu, 
  18.149 +					  TopMenuAction:action,
  18.150 +					  TopMenuObject:object_id,
  18.151 +					  param,
  18.152 +					  String:buffer[],
  18.153 +					  maxlength)
  18.154 +{
  18.155 +	if (action == TopMenuAction_DisplayOption)
  18.156 +	{
  18.157 +		Format(buffer, maxlength, "%T", "Beacon player", param);
  18.158 +	}
  18.159 +	else if (action == TopMenuAction_SelectOption)
  18.160 +	{
  18.161 +		DisplayBeaconMenu(param);
  18.162 +	}
  18.163 +}
  18.164 +
  18.165 +DisplayBeaconMenu(client)
  18.166 +{
  18.167 +	new Handle:menu = CreateMenu(MenuHandler_Beacon);
  18.168 +	
  18.169 +	decl String:title[100];
  18.170 +	Format(title, sizeof(title), "%T:", "Beacon player", client);
  18.171 +	SetMenuTitle(menu, title);
  18.172 +	SetMenuExitBackButton(menu, true);
  18.173 +	
  18.174 +	AddTargetsToMenu(menu, client, true, true);
  18.175 +	
  18.176 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  18.177 +}
  18.178 +
  18.179 +public MenuHandler_Beacon(Handle:menu, MenuAction:action, param1, param2)
  18.180 +{
  18.181 +	if (action == MenuAction_End)
  18.182 +	{
  18.183 +		CloseHandle(menu);
  18.184 +	}
  18.185 +	else if (action == MenuAction_Cancel)
  18.186 +	{
  18.187 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  18.188 +		{
  18.189 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  18.190 +		}
  18.191 +	}
  18.192 +	else if (action == MenuAction_Select)
  18.193 +	{
  18.194 +		decl String:info[32];
  18.195 +		new userid, target;
  18.196 +		
  18.197 +		GetMenuItem(menu, param2, info, sizeof(info));
  18.198 +		userid = StringToInt(info);
  18.199 +
  18.200 +		if ((target = GetClientOfUserId(userid)) == 0)
  18.201 +		{
  18.202 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  18.203 +		}
  18.204 +		else if (!CanUserTarget(param1, target))
  18.205 +		{
  18.206 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  18.207 +		}
  18.208 +		else
  18.209 +		{
  18.210 +			new String:name[32];
  18.211 +			GetClientName(target, name, sizeof(name));
  18.212 +			
  18.213 +			PerformBeacon(param1, target, 2);
  18.214 +			ShowActivity2(param1, "[SM] ", "%t", "Toggled beacon on target", "_s", name);
  18.215 +		}
  18.216 +		
  18.217 +		/* Re-draw the menu if they're still valid */
  18.218 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  18.219 +		{
  18.220 +			DisplayBeaconMenu(param1);
  18.221 +		}
  18.222 +	}
  18.223 +}
  18.224 +
  18.225 +public Action:Command_Beacon(client, args)
  18.226 +{
  18.227 +	if (args < 1)
  18.228 +	{
  18.229 +		ReplyToCommand(client, "[SM] Usage: sm_beacon <#userid|name> [0/1]");
  18.230 +		return Plugin_Handled;
  18.231 +	}
  18.232 +
  18.233 +	decl String:arg[65];
  18.234 +	GetCmdArg(1, arg, sizeof(arg));
  18.235 +	
  18.236 +	new toggle = 2;
  18.237 +	if (args > 1)
  18.238 +	{
  18.239 +		decl String:arg2[2];
  18.240 +		GetCmdArg(2, arg2, sizeof(arg2));
  18.241 +		if (arg2[0])
  18.242 +		{
  18.243 +			toggle = 1;
  18.244 +		}
  18.245 +		else
  18.246 +		{
  18.247 +			toggle = 0;
  18.248 +		}
  18.249 +	}
  18.250 +
  18.251 +	decl String:target_name[MAX_TARGET_LENGTH];
  18.252 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  18.253 +	
  18.254 +	if ((target_count = ProcessTargetString(
  18.255 +			arg,
  18.256 +			client,
  18.257 +			target_list,
  18.258 +			MAXPLAYERS,
  18.259 +			COMMAND_FILTER_ALIVE,
  18.260 +			target_name,
  18.261 +			sizeof(target_name),
  18.262 +			tn_is_ml)) <= 0)
  18.263 +	{
  18.264 +		ReplyToTargetError(client, target_count);
  18.265 +		return Plugin_Handled;
  18.266 +	}
  18.267 +	
  18.268 +	for (new i = 0; i < target_count; i++)
  18.269 +	{
  18.270 +		PerformBeacon(client, target_list[i], toggle);
  18.271 +	}
  18.272 +	
  18.273 +	if (tn_is_ml)
  18.274 +	{
  18.275 +		ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", target_name);
  18.276 +	}
  18.277 +	else
  18.278 +	{
  18.279 +		ShowActivity2(client, "[SM] ", "%t", "Toggled beacon on target", "_s", target_name);
  18.280 +	}
  18.281 +	
  18.282 +	return Plugin_Handled;
  18.283 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/plugins/funcommands/blind.sp	Fri Feb 22 21:01:08 2008 +0000
    19.3 @@ -0,0 +1,279 @@
    19.4 +/**
    19.5 + * vim: set ts=4 :
    19.6 + * =============================================================================
    19.7 + * SourceMod Basefuncommands Plugin
    19.8 + * Provides blind functionality
    19.9 + *
   19.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   19.11 + * =============================================================================
   19.12 + *
   19.13 + * This program is free software; you can redistribute it and/or modify it under
   19.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   19.15 + * Free Software Foundation.
   19.16 + * 
   19.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   19.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   19.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   19.20 + * details.
   19.21 + *
   19.22 + * You should have received a copy of the GNU General Public License along with
   19.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   19.24 + *
   19.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   19.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   19.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   19.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   19.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   19.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   19.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   19.32 + * or <http://www.sourcemod.net/license.php>.
   19.33 + *
   19.34 + * Version: $Id$
   19.35 + */
   19.36 +
   19.37 +new g_BlindTarget[MAXPLAYERS+1];
   19.38 +
   19.39 +SetupBlind()
   19.40 +{
   19.41 +	RegAdminCmd("sm_blind", Command_Blind, ADMFLAG_SLAY, "sm_blind <#userid|name> [amount] - Leave amount off to reset.");
   19.42 +}
   19.43 +
   19.44 +PerformBlind(client, target, amount)
   19.45 +{
   19.46 +	new targets[2];
   19.47 +	targets[0] = target;
   19.48 +	
   19.49 +	new Handle:message = StartMessageEx(g_FadeUserMsgId, targets, 1);
   19.50 +	BfWriteShort(message, 1536);
   19.51 +	BfWriteShort(message, 1536);
   19.52 +	
   19.53 +	if (amount == 0)
   19.54 +	{
   19.55 +		BfWriteShort(message, (0x0001 | 0x0010));
   19.56 +	}
   19.57 +	else
   19.58 +	{
   19.59 +		BfWriteShort(message, (0x0002 | 0x0008));
   19.60 +	}
   19.61 +	
   19.62 +	BfWriteByte(message, 0);
   19.63 +	BfWriteByte(message, 0);
   19.64 +	BfWriteByte(message, 0);
   19.65 +	BfWriteByte(message, amount);
   19.66 +	
   19.67 +	EndMessage();
   19.68 +
   19.69 +	LogAction(client, target, "\"%L\" set blind on \"%L\", amount %d.", client, target, amount);
   19.70 +}
   19.71 +
   19.72 +public AdminMenu_Blind(Handle:topmenu, 
   19.73 +					  TopMenuAction:action,
   19.74 +					  TopMenuObject:object_id,
   19.75 +					  param,
   19.76 +					  String:buffer[],
   19.77 +					  maxlength)
   19.78 +{
   19.79 +	if (action == TopMenuAction_DisplayOption)
   19.80 +	{
   19.81 +		Format(buffer, maxlength, "%T", "Blind player", param);
   19.82 +	}
   19.83 +	else if (action == TopMenuAction_SelectOption)
   19.84 +	{
   19.85 +		DisplayBlindMenu(param);
   19.86 +	}
   19.87 +	else if (action == TopMenuAction_DrawOption)
   19.88 +	{	
   19.89 +		// Disable if we could not find the user message id for Fade.
   19.90 +		buffer[0] = ((g_FadeUserMsgId == INVALID_MESSAGE_ID) ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT);
   19.91 +	}	
   19.92 +}
   19.93 +
   19.94 +DisplayBlindMenu(client)
   19.95 +{
   19.96 +	new Handle:menu = CreateMenu(MenuHandler_Blind);
   19.97 +	
   19.98 +	decl String:title[100];
   19.99 +	Format(title, sizeof(title), "%T:", "Blind player", client);
  19.100 +	SetMenuTitle(menu, title);
  19.101 +	SetMenuExitBackButton(menu, true);
  19.102 +	
  19.103 +	AddTargetsToMenu(menu, client, true, true);
  19.104 +	
  19.105 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  19.106 +}
  19.107 +
  19.108 +DisplayAmountMenu(client)
  19.109 +{
  19.110 +	new Handle:menu = CreateMenu(MenuHandler_Amount);
  19.111 +	
  19.112 +	decl String:title[100];
  19.113 +	Format(title, sizeof(title), "%T:", "Blind amount", client);
  19.114 +	SetMenuTitle(menu, title);
  19.115 +	SetMenuExitBackButton(menu, true);
  19.116 +	
  19.117 +	AddMenuItem(menu, "255", "Fully blind");
  19.118 +	AddMenuItem(menu, "240", "Half blind");
  19.119 +	AddMenuItem(menu, "0", "No blind");
  19.120 +	
  19.121 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  19.122 +}
  19.123 +
  19.124 +public MenuHandler_Blind(Handle:menu, MenuAction:action, param1, param2)
  19.125 +{
  19.126 +	if (action == MenuAction_End)
  19.127 +	{
  19.128 +		CloseHandle(menu);
  19.129 +	}
  19.130 +	else if (action == MenuAction_Cancel)
  19.131 +	{
  19.132 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  19.133 +		{
  19.134 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  19.135 +		}
  19.136 +	}
  19.137 +	else if (action == MenuAction_Select)
  19.138 +	{
  19.139 +		decl String:info[32];
  19.140 +		new userid, target;
  19.141 +		
  19.142 +		GetMenuItem(menu, param2, info, sizeof(info));
  19.143 +		userid = StringToInt(info);
  19.144 +
  19.145 +		if ((target = GetClientOfUserId(userid)) == 0)
  19.146 +		{
  19.147 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  19.148 +		}
  19.149 +		else if (!CanUserTarget(param1, target))
  19.150 +		{
  19.151 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  19.152 +		}
  19.153 +		else
  19.154 +		{
  19.155 +			g_BlindTarget[param1] = userid;
  19.156 +			DisplayAmountMenu(param1);
  19.157 +			return;	// Return, because we went to a new menu and don't want the re-draw to occur.
  19.158 +		}
  19.159 +		
  19.160 +		/* Re-draw the menu if they're still valid */
  19.161 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  19.162 +		{
  19.163 +			DisplayBlindMenu(param1);
  19.164 +		}
  19.165 +	}
  19.166 +	
  19.167 +	return;
  19.168 +}
  19.169 +
  19.170 +public MenuHandler_Amount(Handle:menu, MenuAction:action, param1, param2)
  19.171 +{
  19.172 +	if (action == MenuAction_End)
  19.173 +	{
  19.174 +		CloseHandle(menu);
  19.175 +	}
  19.176 +	else if (action == MenuAction_Cancel)
  19.177 +	{
  19.178 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  19.179 +		{
  19.180 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  19.181 +		}
  19.182 +	}
  19.183 +	else if (action == MenuAction_Select)
  19.184 +	{
  19.185 +		decl String:info[32];
  19.186 +		new amount, target;
  19.187 +		
  19.188 +		GetMenuItem(menu, param2, info, sizeof(info));
  19.189 +		amount = StringToInt(info);
  19.190 +
  19.191 +		if ((target = GetClientOfUserId(g_BlindTarget[param1])) == 0)
  19.192 +		{
  19.193 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  19.194 +		}
  19.195 +		else if (!CanUserTarget(param1, target))
  19.196 +		{
  19.197 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  19.198 +		}
  19.199 +		else
  19.200 +		{
  19.201 +			new String:name[32];
  19.202 +			GetClientName(target, name, sizeof(name));
  19.203 +			
  19.204 +			PerformBlind(param1, target, amount);
  19.205 +			ShowActivity2(param1, "[SM] ", "%t", "Set blind on target", "_s", name, amount);
  19.206 +		}
  19.207 +		
  19.208 +		/* Re-draw the menu if they're still valid */
  19.209 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  19.210 +		{
  19.211 +			DisplayBlindMenu(param1);
  19.212 +		}
  19.213 +	}
  19.214 +}
  19.215 +
  19.216 +
  19.217 +public Action:Command_Blind(client, args)
  19.218 +{
  19.219 +	if (args < 1)
  19.220 +	{
  19.221 +		ReplyToCommand(client, "[SM] Usage: sm_blind <#userid|name> [amount]");
  19.222 +		return Plugin_Handled;
  19.223 +	}
  19.224 +
  19.225 +	decl String:arg[65];
  19.226 +	GetCmdArg(1, arg, sizeof(arg));
  19.227 +	
  19.228 +	new amount = 0;
  19.229 +	if (args > 1)
  19.230 +	{
  19.231 +		decl String:arg2[20];
  19.232 +		GetCmdArg(2, arg2, sizeof(arg2));
  19.233 +		if (StringToIntEx(arg2, amount) == 0)
  19.234 +		{
  19.235 +			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
  19.236 +			return Plugin_Handled;
  19.237 +		}
  19.238 +		
  19.239 +		if (amount < 0)
  19.240 +		{
  19.241 +			amount = 0;
  19.242 +		}
  19.243 +		
  19.244 +		if (amount > 255)
  19.245 +		{
  19.246 +			amount = 255;
  19.247 +		}
  19.248 +	}
  19.249 +
  19.250 +	decl String:target_name[MAX_TARGET_LENGTH];
  19.251 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  19.252 +	
  19.253 +	if ((target_count = ProcessTargetString(
  19.254 +			arg,
  19.255 +			client,
  19.256 +			target_list,
  19.257 +			MAXPLAYERS,
  19.258 +			COMMAND_FILTER_ALIVE,
  19.259 +			target_name,
  19.260 +			sizeof(target_name),
  19.261 +			tn_is_ml)) <= 0)
  19.262 +	{
  19.263 +		ReplyToTargetError(client, target_count);
  19.264 +		return Plugin_Handled;
  19.265 +	}
  19.266 +	
  19.267 +	for (new i = 0; i < target_count; i++)
  19.268 +	{
  19.269 +		PerformBlind(client, target_list[i], amount);
  19.270 +	}
  19.271 +	
  19.272 +	if (tn_is_ml)
  19.273 +	{
  19.274 +		ShowActivity2(client, "[SM] ", "%t", "Set blind on target", target_name);
  19.275 +	}
  19.276 +	else
  19.277 +	{
  19.278 +		ShowActivity2(client, "[SM] ", "%t", "Set blind on target", "_s", target_name);
  19.279 +	}
  19.280 +	
  19.281 +	return Plugin_Handled;
  19.282 +}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/plugins/funcommands/drug.sp	Fri Feb 22 21:01:08 2008 +0000
    20.3 @@ -0,0 +1,315 @@
    20.4 +/**
    20.5 + * vim: set ts=4 :
    20.6 + * =============================================================================
    20.7 + * SourceMod Basefuncommands Plugin
    20.8 + * Provides drug functionality
    20.9 + *
   20.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   20.11 + * =============================================================================
   20.12 + *
   20.13 + * This program is free software; you can redistribute it and/or modify it under
   20.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   20.15 + * Free Software Foundation.
   20.16 + * 
   20.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   20.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   20.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   20.20 + * details.
   20.21 + *
   20.22 + * You should have received a copy of the GNU General Public License along with
   20.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   20.24 + *
   20.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   20.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   20.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   20.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   20.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   20.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   20.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   20.32 + * or <http://www.sourcemod.net/license.php>.
   20.33 + *
   20.34 + * Version: $Id$
   20.35 + */
   20.36 +
   20.37 +new Handle:g_DrugTimers[MAXPLAYERS+1];
   20.38 +new Float:g_DrugAngles[20] = {0.0, 5.0, 10.0, 15.0, 20.0, 25.0, 20.0, 15.0, 10.0, 5.0, 0.0, -5.0, -10.0, -15.0, -20.0, -25.0, -20.0, -15.0, -10.0, -5.0};
   20.39 +
   20.40 +SetupDrugs()
   20.41 +{
   20.42 +	RegAdminCmd("sm_drug", Command_Drug, ADMFLAG_SLAY, "sm_drug <#userid|name> [0/1]");
   20.43 +}
   20.44 +
   20.45 +CreateDrug(client)
   20.46 +{
   20.47 +	g_DrugTimers[client] = CreateTimer(1.0, Timer_Drug, client, TIMER_REPEAT);	
   20.48 +}
   20.49 +
   20.50 +KillDrug(client)
   20.51 +{
   20.52 +	KillDrugTimer(client);
   20.53 +	
   20.54 +	new Float:pos[3];
   20.55 +	GetClientAbsOrigin(client, pos);
   20.56 +	new Float:angs[3];
   20.57 +	GetClientEyeAngles(client, angs);
   20.58 +	
   20.59 +	angs[2] = 0.0;
   20.60 +	
   20.61 +	TeleportEntity(client, pos, angs, NULL_VECTOR);	
   20.62 +	
   20.63 +	new clients[2];
   20.64 +	clients[0] = client;	
   20.65 +	
   20.66 +	new Handle:message = StartMessageEx(g_FadeUserMsgId, clients, 1);
   20.67 +	BfWriteShort(message, 1536);
   20.68 +	BfWriteShort(message, 1536);
   20.69 +	BfWriteShort(message, (0x0001 | 0x0010));
   20.70 +	BfWriteByte(message, 0);
   20.71 +	BfWriteByte(message, 0);
   20.72 +	BfWriteByte(message, 0);
   20.73 +	BfWriteByte(message, 0);
   20.74 +	EndMessage();	
   20.75 +}
   20.76 +
   20.77 +KillDrugTimer(client)
   20.78 +{
   20.79 +	KillTimer(g_DrugTimers[client]);
   20.80 +	g_DrugTimers[client] = INVALID_HANDLE;	
   20.81 +}
   20.82 +
   20.83 +KillAllDrugs()
   20.84 +{
   20.85 +	new maxclients = GetMaxClients();
   20.86 +	for (new i = 1; i <= maxclients; i++)
   20.87 +	{
   20.88 +		if (g_DrugTimers[i] != INVALID_HANDLE)
   20.89 +		{
   20.90 +			if(IsClientInGame(i))
   20.91 +			{
   20.92 +				KillDrug(i);
   20.93 +			}
   20.94 +			else
   20.95 +			{
   20.96 +				KillDrugTimer(i);
   20.97 +			}
   20.98 +		}
   20.99 +	}
  20.100 +}
  20.101 +
  20.102 +PerformDrug(client, target, toggle)
  20.103 +{
  20.104 +	switch (toggle)
  20.105 +	{
  20.106 +		case (2):
  20.107 +		{
  20.108 +			if (g_DrugTimers[target] == INVALID_HANDLE)
  20.109 +			{
  20.110 +				CreateDrug(target);
  20.111 +				LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
  20.112 +			}
  20.113 +			else
  20.114 +			{
  20.115 +				KillDrug(target);
  20.116 +				LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
  20.117 +			}			
  20.118 +		}
  20.119 +
  20.120 +		case (1):
  20.121 +		{
  20.122 +			if (g_DrugTimers[target] == INVALID_HANDLE)
  20.123 +			{
  20.124 +				CreateDrug(target);
  20.125 +				LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
  20.126 +			}			
  20.127 +		}
  20.128 +		
  20.129 +		case (0):
  20.130 +		{
  20.131 +			if (g_DrugTimers[target] != INVALID_HANDLE)
  20.132 +			{
  20.133 +				KillDrug(target);
  20.134 +				LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
  20.135 +			}			
  20.136 +		}
  20.137 +	}
  20.138 +}
  20.139 +
  20.140 +public Action:Timer_Drug(Handle:timer, any:client)
  20.141 +{
  20.142 +	if (!IsClientInGame(client))
  20.143 +	{
  20.144 +		KillDrugTimer(client);
  20.145 +
  20.146 +		return Plugin_Handled;
  20.147 +	}
  20.148 +	
  20.149 +	if (!IsPlayerAlive(client))
  20.150 +	{
  20.151 +		KillDrug(client);
  20.152 +		
  20.153 +		return Plugin_Handled;
  20.154 +	}
  20.155 +	
  20.156 +	new Float:pos[3];
  20.157 +	GetClientAbsOrigin(client, pos);
  20.158 +	
  20.159 +	new Float:angs[3];
  20.160 +	GetClientEyeAngles(client, angs);
  20.161 +	
  20.162 +	angs[2] = g_DrugAngles[GetRandomInt(0,100) % 20];
  20.163 +	
  20.164 +	TeleportEntity(client, pos, angs, NULL_VECTOR);
  20.165 +	
  20.166 +	new clients[2];
  20.167 +	clients[0] = client;	
  20.168 +	
  20.169 +	new Handle:message = StartMessageEx(g_FadeUserMsgId, clients, 1);
  20.170 +	BfWriteShort(message, 255);
  20.171 +	BfWriteShort(message, 255);
  20.172 +	BfWriteShort(message, (0x0002));
  20.173 +	BfWriteByte(message, GetRandomInt(0,255));
  20.174 +	BfWriteByte(message, GetRandomInt(0,255));
  20.175 +	BfWriteByte(message, GetRandomInt(0,255));
  20.176 +	BfWriteByte(message, 128);
  20.177 +	
  20.178 +	EndMessage();	
  20.179 +		
  20.180 +	return Plugin_Handled;
  20.181 +}
  20.182 +
  20.183 +public AdminMenu_Drug(Handle:topmenu, 
  20.184 +					  TopMenuAction:action,
  20.185 +					  TopMenuObject:object_id,
  20.186 +					  param,
  20.187 +					  String:buffer[],
  20.188 +					  maxlength)
  20.189 +{
  20.190 +	if (action == TopMenuAction_DisplayOption)
  20.191 +	{
  20.192 +		Format(buffer, maxlength, "%T", "Drug player", param);
  20.193 +	}
  20.194 +	else if (action == TopMenuAction_SelectOption)
  20.195 +	{
  20.196 +		DisplayDrugMenu(param);
  20.197 +	}
  20.198 +}
  20.199 +
  20.200 +DisplayDrugMenu(client)
  20.201 +{
  20.202 +	new Handle:menu = CreateMenu(MenuHandler_Drug);
  20.203 +	
  20.204 +	decl String:title[100];
  20.205 +	Format(title, sizeof(title), "%T:", "Drug player", client);
  20.206 +	SetMenuTitle(menu, title);
  20.207 +	SetMenuExitBackButton(menu, true);
  20.208 +	
  20.209 +	AddTargetsToMenu(menu, client, true, true);
  20.210 +	
  20.211 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  20.212 +}
  20.213 +
  20.214 +public MenuHandler_Drug(Handle:menu, MenuAction:action, param1, param2)
  20.215 +{
  20.216 +	if (action == MenuAction_End)
  20.217 +	{
  20.218 +		CloseHandle(menu);
  20.219 +	}
  20.220 +	else if (action == MenuAction_Cancel)
  20.221 +	{
  20.222 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  20.223 +		{
  20.224 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  20.225 +		}
  20.226 +	}
  20.227 +	else if (action == MenuAction_Select)
  20.228 +	{
  20.229 +		decl String:info[32];
  20.230 +		new userid, target;
  20.231 +		
  20.232 +		GetMenuItem(menu, param2, info, sizeof(info));
  20.233 +		userid = StringToInt(info);
  20.234 +
  20.235 +		if ((target = GetClientOfUserId(userid)) == 0)
  20.236 +		{
  20.237 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  20.238 +		}
  20.239 +		else if (!CanUserTarget(param1, target))
  20.240 +		{
  20.241 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  20.242 +		}
  20.243 +		else
  20.244 +		{
  20.245 +			new String:name[32];
  20.246 +			GetClientName(target, name, sizeof(name));
  20.247 +			
  20.248 +			PerformDrug(param1, target, 2);
  20.249 +			ShowActivity2(param1, "[SM] ", "%t", "Toggled drug on target", "_s", name);
  20.250 +		}
  20.251 +		
  20.252 +		/* Re-draw the menu if they're still valid */
  20.253 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  20.254 +		{
  20.255 +			DisplayDrugMenu(param1);
  20.256 +		}
  20.257 +	}
  20.258 +}
  20.259 +
  20.260 +public Action:Command_Drug(client, args)
  20.261 +{
  20.262 +	if (args < 1)
  20.263 +	{
  20.264 +		ReplyToCommand(client, "[SM] Usage: sm_drug <#userid|name> [0/1]");
  20.265 +		return Plugin_Handled;
  20.266 +	}
  20.267 +
  20.268 +	decl String:arg[65];
  20.269 +	GetCmdArg(1, arg, sizeof(arg));
  20.270 +	
  20.271 +	new toggle = 2;
  20.272 +	if (args > 1)
  20.273 +	{
  20.274 +		decl String:arg2[2];
  20.275 +		GetCmdArg(2, arg2, sizeof(arg2));
  20.276 +		if (arg2[0])
  20.277 +		{
  20.278 +			toggle = 1;
  20.279 +		}
  20.280 +		else
  20.281 +		{
  20.282 +			toggle = 0;
  20.283 +		}
  20.284 +	}
  20.285 +
  20.286 +	decl String:target_name[MAX_TARGET_LENGTH];
  20.287 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  20.288 +	
  20.289 +	if ((target_count = ProcessTargetString(
  20.290 +			arg,
  20.291 +			client,
  20.292 +			target_list,
  20.293 +			MAXPLAYERS,
  20.294 +			COMMAND_FILTER_ALIVE,
  20.295 +			target_name,
  20.296 +			sizeof(target_name),
  20.297 +			tn_is_ml)) <= 0)
  20.298 +	{
  20.299 +		ReplyToTargetError(client, target_count);
  20.300 +		return Plugin_Handled;
  20.301 +	}
  20.302 +	
  20.303 +	for (new i = 0; i < target_count; i++)
  20.304 +	{
  20.305 +		PerformDrug(client, target_list[i], toggle);
  20.306 +	}
  20.307 +	
  20.308 +	if (tn_is_ml)
  20.309 +	{
  20.310 +		ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", target_name);
  20.311 +	}
  20.312 +	else
  20.313 +	{
  20.314 +		ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", "_s", target_name);
  20.315 +	}
  20.316 +	
  20.317 +	return Plugin_Handled;
  20.318 +}
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/plugins/funcommands/fire.sp	Fri Feb 22 21:01:08 2008 +0000
    21.3 @@ -0,0 +1,504 @@
    21.4 +/**
    21.5 + * vim: set ts=4 :
    21.6 + * =============================================================================
    21.7 + * SourceMod Basefuncommands Plugin
    21.8 + * Provides FireBomb functionality
    21.9 + *
   21.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   21.11 + * =============================================================================
   21.12 + *
   21.13 + * This program is free software; you can redistribute it and/or modify it under
   21.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   21.15 + * Free Software Foundation.
   21.16 + * 
   21.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   21.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   21.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   21.20 + * details.
   21.21 + *
   21.22 + * You should have received a copy of the GNU General Public License along with
   21.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   21.24 + *
   21.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   21.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   21.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   21.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   21.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   21.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   21.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   21.32 + * or <http://www.sourcemod.net/license.php>.
   21.33 + *
   21.34 + * Version: $Id$
   21.35 + */
   21.36 +
   21.37 +new Handle:g_FireBombTimers[MAXPLAYERS+1];
   21.38 +new g_FireBombTracker[MAXPLAYERS+1];
   21.39 +
   21.40 +new Handle:g_BurnDuration = INVALID_HANDLE;
   21.41 +new Handle:g_FireBombTicks = INVALID_HANDLE;
   21.42 +new Handle:g_FireBombRadius = INVALID_HANDLE;
   21.43 +new Handle:g_FireBombMode = INVALID_HANDLE;
   21.44 +
   21.45 +SetupFire()
   21.46 +{
   21.47 +	RegAdminCmd("sm_burn", Command_Burn, ADMFLAG_SLAY, "sm_burn <#userid|name> [time]");
   21.48 +	RegAdminCmd("sm_firebomb", Command_FireBomb, ADMFLAG_SLAY, "sm_firebomb <#userid|name> [0/1]");	
   21.49 +	
   21.50 +	g_BurnDuration = CreateConVar("sm_burn_duration", "20", "Sets the default duration of sm_burn and firebomb victims.", 0, true, 0.5, true, 20.0);
   21.51 +	g_FireBombTicks = CreateConVar("sm_firebomb_ticks", "10", "Sets how long the FireBomb fuse is.", 0, true, 5.0, true, 120.0);
   21.52 +	g_FireBombRadius = CreateConVar("sm_firebomb_radius", "600", "Sets the bomb blast radius.", 0, true, 50.0, true, 3000.0);
   21.53 +	g_FireBombMode = CreateConVar("sm_firebomb_mode", "0", "Who is targetted by the FireBomb? 0 = Target only, 1 = Target's team, 2 = Everyone", 0, true, 0.0, true, 2.0);
   21.54 +}
   21.55 +
   21.56 +CreateFireBomb(client)
   21.57 +{
   21.58 +	g_FireBombTimers[client] = CreateTimer(1.0, Timer_FireBomb, client, TIMER_REPEAT);
   21.59 +	g_FireBombTracker[client] = GetConVarInt(g_FireBombTicks);
   21.60 +}
   21.61 +
   21.62 +KillFireBomb(client)
   21.63 +{
   21.64 +	KillTimer(g_FireBombTimers[client]);
   21.65 +	g_FireBombTimers[client] = INVALID_HANDLE;
   21.66 +}
   21.67 +
   21.68 +KillAllFireBombs()
   21.69 +{
   21.70 +	new maxclients = GetMaxClients();
   21.71 +	for (new i = 1; i <= maxclients; i++)
   21.72 +	{
   21.73 +		if (g_FireBombTimers[i] != INVALID_HANDLE)
   21.74 +		{
   21.75 +			KillFireBomb(i);
   21.76 +		}
   21.77 +	}
   21.78 +}
   21.79 +
   21.80 +PerformBurn(client, target, Float:seconds)
   21.81 +{
   21.82 +	LogAction(client, target, "\"%L\" ignited \"%L\" (seconds \"%f\")", client, target, seconds);
   21.83 +	IgniteEntity(target, seconds);
   21.84 +}
   21.85 +
   21.86 +PerformFireBomb(client, target, toggle)
   21.87 +{
   21.88 +	switch (toggle)
   21.89 +	{
   21.90 +		case (2):
   21.91 +		{
   21.92 +			if (g_FireBombTimers[target] == INVALID_HANDLE)
   21.93 +			{
   21.94 +				CreateFireBomb(target);
   21.95 +				LogAction(client, target, "\"%L\" set a FireBomb on \"%L\"", client, target);
   21.96 +			}
   21.97 +			else
   21.98 +			{
   21.99 +				KillFireBomb(target);
  21.100 +				SetEntityRenderColor(client, 255, 255, 255, 255);
  21.101 +				LogAction(client, target, "\"%L\" removed a FireBomb on \"%L\"", client, target);
  21.102 +			}			
  21.103 +		}
  21.104 +
  21.105 +		case (1):
  21.106 +		{
  21.107 +			if (g_FireBombTimers[target] == INVALID_HANDLE)
  21.108 +			{
  21.109 +				CreateFireBomb(target);
  21.110 +				LogAction(client, target, "\"%L\" set a FireBomb on \"%L\"", client, target);
  21.111 +			}			
  21.112 +		}
  21.113 +		
  21.114 +		case (0):
  21.115 +		{
  21.116 +			if (g_FireBombTimers[target] != INVALID_HANDLE)
  21.117 +			{
  21.118 +				KillFireBomb(target);
  21.119 +				SetEntityRenderColor(client, 255, 255, 255, 255);
  21.120 +				LogAction(client, target, "\"%L\" removed a FireBomb on \"%L\"", client, target);
  21.121 +			}			
  21.122 +		}
  21.123 +	}
  21.124 +}
  21.125 +
  21.126 +public Action:Timer_FireBomb(Handle:timer, any:client)
  21.127 +{
  21.128 +	if (!IsClientInGame(client) || !IsPlayerAlive(client))
  21.129 +	{
  21.130 +		KillFireBomb(client);		
  21.131 +
  21.132 +		return Plugin_Handled;
  21.133 +	}
  21.134 +	
  21.135 +	g_FireBombTracker[client]--;
  21.136 +	
  21.137 +	new Float:vec[3];
  21.138 +	GetClientEyePosition(client, vec);
  21.139 +	
  21.140 +	if (g_FireBombTracker[client] > 0)
  21.141 +	{
  21.142 +		new color;
  21.143 +		
  21.144 +		if (g_FireBombTracker[client] > 1)
  21.145 +		{
  21.146 +			color = RoundToFloor(g_FireBombTracker[client] * (255.0 / GetConVarFloat(g_FireBombTicks)));
  21.147 +			EmitAmbientSound(SOUND_BEEP, vec, client, SNDLEVEL_RAIDSIREN);	
  21.148 +		}
  21.149 +		else
  21.150 +		{
  21.151 +			color = 0;
  21.152 +			EmitAmbientSound(SOUND_FINAL, vec, client, SNDLEVEL_RAIDSIREN);
  21.153 +		}
  21.154 +		
  21.155 +		SetEntityRenderColor(client, 255, color, color, 255);
  21.156 +
  21.157 +		decl String:name[64];
  21.158 +		GetClientName(client, name, sizeof(name));
  21.159 +		PrintCenterTextAll("%t", "Till Explodes", name, g_FireBombTracker[client]);		
  21.160 +		
  21.161 +		GetClientAbsOrigin(client, vec);
  21.162 +		vec[2] += 10;
  21.163 +
  21.164 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_FireBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
  21.165 +		TE_SendToAll();
  21.166 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_FireBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
  21.167 +		TE_SendToAll();
  21.168 +	}
  21.169 +	else
  21.170 +	{
  21.171 +		TE_SetupExplosion(vec, g_ExplosionSprite, 0.1, 1, 0, GetConVarInt(g_FireBombRadius), 5000);
  21.172 +		TE_SendToAll();
  21.173 +		
  21.174 +		GetClientAbsOrigin(client, vec);
  21.175 +		vec[2] += 10;
  21.176 +		TE_SetupBeamRingPoint(vec, 50.0, GetConVarFloat(g_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.5, 30.0, 1.5, orangeColor, 5, 0);
  21.177 +		TE_SendToAll();
  21.178 +		vec[2] += 15;
  21.179 +		TE_SetupBeamRingPoint(vec, 40.0, GetConVarFloat(g_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 30.0, 1.5, orangeColor, 5, 0);
  21.180 +		TE_SendToAll();	
  21.181 +		vec[2] += 15;
  21.182 +		TE_SetupBeamRingPoint(vec, 30.0, GetConVarFloat(g_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.7, 30.0, 1.5, orangeColor, 5, 0);
  21.183 +		TE_SendToAll();
  21.184 +		vec[2] += 15;
  21.185 +		TE_SetupBeamRingPoint(vec, 20.0, GetConVarFloat(g_FireBombRadius), g_BeamSprite, g_HaloSprite, 0, 10, 0.8, 30.0, 1.5, orangeColor, 5, 0);
  21.186 +		TE_SendToAll();		
  21.187 +		
  21.188 +		EmitAmbientSound(SOUND_BOOM, vec, client, SNDLEVEL_RAIDSIREN);
  21.189 +
  21.190 +		IgniteEntity(client, GetConVarFloat(g_BurnDuration));
  21.191 +		KillFireBomb(client);
  21.192 +		SetEntityRenderColor(client, 255, 255, 255, 255);
  21.193 +		
  21.194 +		if (GetConVarInt(g_FireBombMode) > 0)
  21.195 +		{
  21.196 +			new teamOnly = ((GetConVarInt(g_FireBombMode) == 1) ? true : false);
  21.197 +			new maxClients = GetMaxClients();
  21.198 +			
  21.199 +			for (new i = 1; i < maxClients; i++)
  21.200 +			{
  21.201 +				if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
  21.202 +				{
  21.203 +					continue;
  21.204 +				}
  21.205 +				
  21.206 +				if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
  21.207 +				{
  21.208 +					continue;
  21.209 +				}
  21.210 +				
  21.211 +				new Float:pos[3];
  21.212 +				GetClientAbsOrigin(i, pos);
  21.213 +				
  21.214 +				new Float:distance = GetVectorDistance(vec, pos);
  21.215 +				
  21.216 +				if (distance > GetConVarFloat(g_FireBombRadius))
  21.217 +				{
  21.218 +					continue;
  21.219 +				}
  21.220 +				
  21.221 +				new Float:duration = GetConVarFloat(g_BurnDuration);
  21.222 +				duration *= (GetConVarFloat(g_FireBombRadius) - distance) / GetConVarFloat(g_FireBombRadius);
  21.223 +
  21.224 +				IgniteEntity(i, duration);
  21.225 +			}		
  21.226 +		}
  21.227 +	}
  21.228 +			
  21.229 +	return Plugin_Handled;
  21.230 +}
  21.231 +
  21.232 +public AdminMenu_Burn(Handle:topmenu, 
  21.233 +					  TopMenuAction:action,
  21.234 +					  TopMenuObject:object_id,
  21.235 +					  param,
  21.236 +					  String:buffer[],
  21.237 +					  maxlength)
  21.238 +{
  21.239 +	if (action == TopMenuAction_DisplayOption)
  21.240 +	{
  21.241 +		Format(buffer, maxlength, "%T", "Burn player", param);
  21.242 +	}
  21.243 +	else if (action == TopMenuAction_SelectOption)
  21.244 +	{
  21.245 +		DisplayBurnMenu(param);
  21.246 +	}
  21.247 +}
  21.248 +
  21.249 +public AdminMenu_FireBomb(Handle:topmenu, 
  21.250 +					  TopMenuAction:action,
  21.251 +					  TopMenuObject:object_id,
  21.252 +					  param,
  21.253 +					  String:buffer[],
  21.254 +					  maxlength)
  21.255 +{
  21.256 +	if (action == TopMenuAction_DisplayOption)
  21.257 +	{
  21.258 +		Format(buffer, maxlength, "%T", "FireBomb player", param);
  21.259 +	}
  21.260 +	else if (action == TopMenuAction_SelectOption)
  21.261 +	{
  21.262 +		DisplayFireBombMenu(param);
  21.263 +	}
  21.264 +}
  21.265 +
  21.266 +DisplayBurnMenu(client)
  21.267 +{
  21.268 +	new Handle:menu = CreateMenu(MenuHandler_Burn);
  21.269 +	
  21.270 +	decl String:title[100];
  21.271 +	Format(title, sizeof(title), "%T:", "Burn player", client);
  21.272 +	SetMenuTitle(menu, title);
  21.273 +	SetMenuExitBackButton(menu, true);
  21.274 +	
  21.275 +	AddTargetsToMenu(menu, client, true, true);
  21.276 +	
  21.277 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  21.278 +}
  21.279 +
  21.280 +DisplayFireBombMenu(client)
  21.281 +{
  21.282 +	new Handle:menu = CreateMenu(MenuHandler_FireBomb);
  21.283 +	
  21.284 +	decl String:title[100];
  21.285 +	Format(title, sizeof(title), "%T:", "FireBomb player", client);
  21.286 +	SetMenuTitle(menu, title);
  21.287 +	SetMenuExitBackButton(menu, true);
  21.288 +	
  21.289 +	AddTargetsToMenu(menu, client, true, true);
  21.290 +	
  21.291 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  21.292 +}
  21.293 +
  21.294 +public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
  21.295 +{
  21.296 +	if (action == MenuAction_End)
  21.297 +	{
  21.298 +		CloseHandle(menu);
  21.299 +	}
  21.300 +	else if (action == MenuAction_Cancel)
  21.301 +	{
  21.302 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  21.303 +		{
  21.304 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  21.305 +		}
  21.306 +	}
  21.307 +	else if (action == MenuAction_Select)
  21.308 +	{
  21.309 +		decl String:info[32];
  21.310 +		new userid, target;
  21.311 +		
  21.312 +		GetMenuItem(menu, param2, info, sizeof(info));
  21.313 +		userid = StringToInt(info);
  21.314 +
  21.315 +		if ((target = GetClientOfUserId(userid)) == 0)
  21.316 +		{
  21.317 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  21.318 +		}
  21.319 +		else if (!CanUserTarget(param1, target))
  21.320 +		{
  21.321 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  21.322 +		}
  21.323 +		else
  21.324 +		{
  21.325 +			new String:name[32];
  21.326 +			GetClientName(target, name, sizeof(name));
  21.327 +			PerformBurn(param1, target, 20.0);
  21.328 +			ShowActivity2(param1, "[SM] ", "%t", "Set target on fire", "_s", name);
  21.329 +		}
  21.330 +		
  21.331 +		/* Re-draw the menu if they're still valid */
  21.332 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  21.333 +		{
  21.334 +			DisplayBurnMenu(param1);
  21.335 +		}
  21.336 +	}
  21.337 +}
  21.338 +
  21.339 +public MenuHandler_FireBomb(Handle:menu, MenuAction:action, param1, param2)
  21.340 +{
  21.341 +	if (action == MenuAction_End)
  21.342 +	{
  21.343 +		CloseHandle(menu);
  21.344 +	}
  21.345 +	else if (action == MenuAction_Cancel)
  21.346 +	{
  21.347 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  21.348 +		{
  21.349 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  21.350 +		}
  21.351 +	}
  21.352 +	else if (action == MenuAction_Select)
  21.353 +	{
  21.354 +		decl String:info[32];
  21.355 +		new userid, target;
  21.356 +		
  21.357 +		GetMenuItem(menu, param2, info, sizeof(info));
  21.358 +		userid = StringToInt(info);
  21.359 +
  21.360 +		if ((target = GetClientOfUserId(userid)) == 0)
  21.361 +		{
  21.362 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  21.363 +		}
  21.364 +		else if (!CanUserTarget(param1, target))
  21.365 +		{
  21.366 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  21.367 +		}
  21.368 +		else
  21.369 +		{
  21.370 +			new String:name[32];
  21.371 +			GetClientName(target, name, sizeof(name));
  21.372 +			
  21.373 +			PerformFireBomb(param1, target, 2);
  21.374 +			ShowActivity2(param1, "[SM] ", "%t", "Toggled FireBomb on target", "_s", name);
  21.375 +		}
  21.376 +		
  21.377 +		/* Re-draw the menu if they're still valid */
  21.378 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  21.379 +		{
  21.380 +			DisplayFireBombMenu(param1);
  21.381 +		}
  21.382 +	}
  21.383 +}
  21.384 +
  21.385 +public Action:Command_Burn(client, args)
  21.386 +{
  21.387 +	if (args < 1)
  21.388 +	{
  21.389 +		ReplyToCommand(client, "[SM] Usage: sm_burn <#userid|name> [time]");
  21.390 +		return Plugin_Handled;
  21.391 +	}
  21.392 +
  21.393 +	decl String:arg[65];
  21.394 +	GetCmdArg(1, arg, sizeof(arg));
  21.395 +
  21.396 +	new Float:seconds = GetConVarFloat(g_BurnDuration);
  21.397 +	
  21.398 +	if (args > 1)
  21.399 +	{
  21.400 +		decl String:time[20];
  21.401 +		GetCmdArg(2, time, sizeof(time));
  21.402 +		if (StringToFloatEx(time, seconds) == 0)
  21.403 +		{
  21.404 +			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
  21.405 +			return Plugin_Handled;
  21.406 +		}
  21.407 +	}
  21.408 +	
  21.409 +	decl String:target_name[MAX_TARGET_LENGTH];
  21.410 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  21.411 +	
  21.412 +	if ((target_count = ProcessTargetString(
  21.413 +			arg,
  21.414 +			client,
  21.415 +			target_list,
  21.416 +			MAXPLAYERS,
  21.417 +			COMMAND_FILTER_ALIVE,
  21.418 +			target_name,
  21.419 +			sizeof(target_name),
  21.420 +			tn_is_ml)) <= 0)
  21.421 +	{
  21.422 +		ReplyToTargetError(client, target_count);
  21.423 +		return Plugin_Handled;
  21.424 +	}
  21.425 +	
  21.426 +	for (new i = 0; i < target_count; i++)
  21.427 +	{
  21.428 +		PerformBurn(client, target_list[i], seconds);
  21.429 +	}
  21.430 +	
  21.431 +	if (tn_is_ml)
  21.432 +	{
  21.433 +		ShowActivity2(client, "[SM] ", "%t", "Set target on fire", target_name);
  21.434 +	}
  21.435 +	else
  21.436 +	{
  21.437 +		ShowActivity2(client, "[SM] ", "%t", "Set target on fire", "_s", target_name);
  21.438 +	}
  21.439 +
  21.440 +	return Plugin_Handled;
  21.441 +}
  21.442 +
  21.443 +public Action:Command_FireBomb(client, args)
  21.444 +{
  21.445 +	if (args < 1)
  21.446 +	{
  21.447 +		ReplyToCommand(client, "[SM] Usage: sm_firebomb <#userid|name> [0/1]");
  21.448 +		return Plugin_Handled;
  21.449 +	}
  21.450 +
  21.451 +	decl String:arg[65];
  21.452 +	GetCmdArg(1, arg, sizeof(arg));
  21.453 +	
  21.454 +	new toggle = 2;
  21.455 +	if (args > 1)
  21.456 +	{
  21.457 +		decl String:arg2[2];
  21.458 +		GetCmdArg(2, arg2, sizeof(arg2));
  21.459 +		if (arg2[0])
  21.460 +		{
  21.461 +			toggle = 1;
  21.462 +		}
  21.463 +		else
  21.464 +		{
  21.465 +			toggle = 0;
  21.466 +		}
  21.467 +	}
  21.468 +
  21.469 +	decl String:target_name[MAX_TARGET_LENGTH];
  21.470 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  21.471 +	
  21.472 +	if ((target_count = ProcessTargetString(
  21.473 +			arg,
  21.474 +			client,
  21.475 +			target_list,
  21.476 +			MAXPLAYERS,
  21.477 +			COMMAND_FILTER_ALIVE,
  21.478 +			target_name,
  21.479 +			sizeof(target_name),
  21.480 +			tn_is_ml)) <= 0)
  21.481 +	{
  21.482 +		ReplyToTargetError(client, target_count);
  21.483 +		return Plugin_Handled;
  21.484 +	}
  21.485 +	
  21.486 +	for (new i = 0; i < target_count; i++)
  21.487 +	{
  21.488 +		PerformFireBomb(client, target_list[i], toggle);
  21.489 +	}
  21.490 +	
  21.491 +	if (tn_is_ml)
  21.492 +	{
  21.493 +		ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", target_name);
  21.494 +	}
  21.495 +	else
  21.496 +	{
  21.497 +		ShowActivity2(client, "[SM] ", "%t", "Toggled FireBomb on target", "_s", target_name);
  21.498 +	}
  21.499 +	
  21.500 +	return Plugin_Handled;
  21.501 +}
  21.502 +
  21.503 +
  21.504 +
  21.505 +
  21.506 +
  21.507 +
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/plugins/funcommands/gravity.sp	Fri Feb 22 21:01:08 2008 +0000
    22.3 @@ -0,0 +1,252 @@
    22.4 +/**
    22.5 + * vim: set ts=4 :
    22.6 + * =============================================================================
    22.7 + * SourceMod Basefuncommands Plugin
    22.8 + * Provides gravity functionality
    22.9 + *
   22.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   22.11 + * =============================================================================
   22.12 + *
   22.13 + * This program is free software; you can redistribute it and/or modify it under
   22.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   22.15 + * Free Software Foundation.
   22.16 + * 
   22.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   22.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   22.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   22.20 + * details.
   22.21 + *
   22.22 + * You should have received a copy of the GNU General Public License along with
   22.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   22.24 + *
   22.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   22.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   22.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   22.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   22.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   22.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   22.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   22.32 + * or <http://www.sourcemod.net/license.php>.
   22.33 + *
   22.34 + * Version: $Id$
   22.35 + */
   22.36 +
   22.37 +new g_GravityTarget[MAXPLAYERS+1];
   22.38 +
   22.39 +SetupGravity()
   22.40 +{
   22.41 +	RegAdminCmd("sm_gravity", Command_Gravity, ADMFLAG_SLAY, "sm_gravity <#userid|name> [amount] - Leave amount off to reset. Amount is 0.0 through 5.0");
   22.42 +}
   22.43 +
   22.44 +PerformGravity(client, target, Float:amount)
   22.45 +{
   22.46 +	new offset = FindDataMapOffs(client, "m_flGravity");
   22.47 +	new Float:temp = GetEntDataFloat(client, offset);
   22.48 +	PrintToChatAll("Gravity check %f", temp);
   22.49 +	
   22.50 +	SetEntityGravity(target, amount);
   22.51 +	LogAction(client, target, "\"%L\" set gravity on \"%L\" to %d.", client, target, amount);
   22.52 +}
   22.53 +
   22.54 +public AdminMenu_Gravity(Handle:topmenu, 
   22.55 +					  TopMenuAction:action,
   22.56 +					  TopMenuObject:object_id,
   22.57 +					  param,
   22.58 +					  String:buffer[],
   22.59 +					  maxlength)
   22.60 +{
   22.61 +	if (action == TopMenuAction_DisplayOption)
   22.62 +	{
   22.63 +		Format(buffer, maxlength, "%T", "Gravity player", param);
   22.64 +	}
   22.65 +	else if (action == TopMenuAction_SelectOption)
   22.66 +	{
   22.67 +		DisplayGravityMenu(param);
   22.68 +	}
   22.69 +}
   22.70 +
   22.71 +DisplayGravityMenu(client)
   22.72 +{
   22.73 +	new Handle:menu = CreateMenu(MenuHandler_Gravity);
   22.74 +	
   22.75 +	decl String:title[100];
   22.76 +	Format(title, sizeof(title), "%T:", "Gravity player", client);
   22.77 +	SetMenuTitle(menu, title);
   22.78 +	SetMenuExitBackButton(menu, true);
   22.79 +	
   22.80 +	AddTargetsToMenu(menu, client, true, true);
   22.81 +	
   22.82 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   22.83 +}
   22.84 +
   22.85 +DisplayGravityAmountMenu(client)
   22.86 +{
   22.87 +	new Handle:menu = CreateMenu(MenuHandler_GravityAmount);
   22.88 +	
   22.89 +	decl String:title[100];
   22.90 +	Format(title, sizeof(title), "%T:", "Gravity amount", client);
   22.91 +	SetMenuTitle(menu, title);
   22.92 +	SetMenuExitBackButton(menu, true);
   22.93 +	
   22.94 +	AddMenuItem(menu, "4.0", "Gravity Very High");
   22.95 +	AddMenuItem(menu, "2.0", "Gravity High");
   22.96 +	AddMenuItem(menu, "1.0", "Gravity Normal");
   22.97 +	AddMenuItem(menu, "0.5", "Gravity Low");
   22.98 +	AddMenuItem(menu, "0.1", "Gravity Very Low");
   22.99 +	
  22.100 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  22.101 +}
  22.102 +
  22.103 +public MenuHandler_Gravity(Handle:menu, MenuAction:action, param1, param2)
  22.104 +{
  22.105 +	if (action == MenuAction_End)
  22.106 +	{
  22.107 +		CloseHandle(menu);
  22.108 +	}
  22.109 +	else if (action == MenuAction_Cancel)
  22.110 +	{
  22.111 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  22.112 +		{
  22.113 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  22.114 +		}
  22.115 +	}
  22.116 +	else if (action == MenuAction_Select)
  22.117 +	{
  22.118 +		decl String:info[32];
  22.119 +		new userid, target;
  22.120 +		
  22.121 +		GetMenuItem(menu, param2, info, sizeof(info));
  22.122 +		userid = StringToInt(info);
  22.123 +
  22.124 +		if ((target = GetClientOfUserId(userid)) == 0)
  22.125 +		{
  22.126 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  22.127 +		}
  22.128 +		else if (!CanUserTarget(param1, target))
  22.129 +		{
  22.130 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  22.131 +		}
  22.132 +		else
  22.133 +		{
  22.134 +			g_GravityTarget[param1] = userid;
  22.135 +			DisplayGravityAmountMenu(param1);
  22.136 +			return;	// Return, because we went to a new menu and don't want the re-draw to occur.
  22.137 +		}
  22.138 +		
  22.139 +		/* Re-draw the menu if they're still valid */
  22.140 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  22.141 +		{
  22.142 +			DisplayGravityMenu(param1);
  22.143 +		}
  22.144 +	}
  22.145 +	
  22.146 +	return;
  22.147 +}
  22.148 +
  22.149 +public MenuHandler_GravityAmount(Handle:menu, MenuAction:action, param1, param2)
  22.150 +{
  22.151 +	if (action == MenuAction_End)
  22.152 +	{
  22.153 +		CloseHandle(menu);
  22.154 +	}
  22.155 +	else if (action == MenuAction_Cancel)
  22.156 +	{
  22.157 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  22.158 +		{
  22.159 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  22.160 +		}
  22.161 +	}
  22.162 +	else if (action == MenuAction_Select)
  22.163 +	{
  22.164 +		decl String:info[32];
  22.165 +		new Float:amount, target;
  22.166 +		
  22.167 +		GetMenuItem(menu, param2, info, sizeof(info));
  22.168 +		amount = StringToFloat(info);
  22.169 +
  22.170 +		if ((target = GetClientOfUserId(g_GravityTarget[param1])) == 0)
  22.171 +		{
  22.172 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  22.173 +		}
  22.174 +		else if (!CanUserTarget(param1, target))
  22.175 +		{
  22.176 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  22.177 +		}
  22.178 +		else
  22.179 +		{
  22.180 +			new String:name[32];
  22.181 +			GetClientName(target, name, sizeof(name));
  22.182 +			
  22.183 +			PerformGravity(param1, target, amount);
  22.184 +			ShowActivity2(param1, "[SM] ", "%t", "Set gravity on target", "_s", name, amount);
  22.185 +		}
  22.186 +		
  22.187 +		/* Re-draw the menu if they're still valid */
  22.188 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  22.189 +		{
  22.190 +			DisplayGravityMenu(param1);
  22.191 +		}
  22.192 +	}
  22.193 +}
  22.194 +
  22.195 +public Action:Command_Gravity(client, args)
  22.196 +{
  22.197 +	if (args < 1)
  22.198 +	{
  22.199 +		ReplyToCommand(client, "[SM] Usage: sm_gravity <#userid|name> [amount]");
  22.200 +		return Plugin_Handled;
  22.201 +	}
  22.202 +
  22.203 +	decl String:arg[65];
  22.204 +	GetCmdArg(1, arg, sizeof(arg));
  22.205 +	
  22.206 +	new Float:amount = 1.0;
  22.207 +	if (args > 1)
  22.208 +	{
  22.209 +		decl String:arg2[20];
  22.210 +		GetCmdArg(2, arg2, sizeof(arg2));
  22.211 +		if (StringToFloatEx(arg2, amount) == 0)
  22.212 +		{
  22.213 +			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
  22.214 +			return Plugin_Handled;
  22.215 +		}
  22.216 +		
  22.217 +		if (amount < 0.0)
  22.218 +		{
  22.219 +			amount = 0.0;
  22.220 +		}
  22.221 +	}
  22.222 +
  22.223 +	decl String:target_name[MAX_TARGET_LENGTH];
  22.224 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  22.225 +	
  22.226 +	if ((target_count = ProcessTargetString(
  22.227 +			arg,
  22.228 +			client,
  22.229 +			target_list,
  22.230 +			MAXPLAYERS,
  22.231 +			COMMAND_FILTER_ALIVE,
  22.232 +			target_name,
  22.233 +			sizeof(target_name),
  22.234 +			tn_is_ml)) <= 0)
  22.235 +	{
  22.236 +		ReplyToTargetError(client, target_count);
  22.237 +		return Plugin_Handled;
  22.238 +	}
  22.239 +	
  22.240 +	for (new i = 0; i < target_count; i++)
  22.241 +	{
  22.242 +		PerformGravity(client, target_list[i], amount);
  22.243 +	}
  22.244 +	
  22.245 +	if (tn_is_ml)
  22.246 +	{
  22.247 +		ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", target_name);
  22.248 +	}
  22.249 +	else
  22.250 +	{
  22.251 +		ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", "_s", target_name);
  22.252 +	}
  22.253 +	
  22.254 +	return Plugin_Handled;
  22.255 +}
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/plugins/funcommands/ice.sp	Fri Feb 22 21:01:08 2008 +0000
    23.3 @@ -0,0 +1,573 @@
    23.4 +/**
    23.5 + * vim: set ts=4 :
    23.6 + * =============================================================================
    23.7 + * SourceMod Basefuncommands Plugin
    23.8 + * Provides freeze and freezebomb functionality
    23.9 + *
   23.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   23.11 + * =============================================================================
   23.12 + *
   23.13 + * This program is free software; you can redistribute it and/or modify it under
   23.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   23.15 + * Free Software Foundation.
   23.16 + * 
   23.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   23.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   23.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   23.20 + * details.
   23.21 + *
   23.22 + * You should have received a copy of the GNU General Public License along with
   23.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   23.24 + *
   23.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   23.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   23.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   23.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   23.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   23.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   23.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   23.32 + * or <http://www.sourcemod.net/license.php>.
   23.33 + *
   23.34 + * Version: $Id$
   23.35 + */
   23.36 +
   23.37 +new Handle:g_FreezeTimers[MAXPLAYERS+1];
   23.38 +new Handle:g_FreezeBombTimers[MAXPLAYERS+1];
   23.39 +new g_FreezeTracker[MAXPLAYERS+1];
   23.40 +new g_FreezeBombTracker[MAXPLAYERS+1];
   23.41 +
   23.42 +new Handle:g_FreezeDuration = INVALID_HANDLE;
   23.43 +new Handle:g_FreezeBombTicks = INVALID_HANDLE;
   23.44 +new Handle:g_FreezeBombRadius = INVALID_HANDLE;
   23.45 +new Handle:g_FreezeBombMode = INVALID_HANDLE;
   23.46 +
   23.47 +SetupIce()
   23.48 +{
   23.49 +	RegAdminCmd("sm_freeze", Command_Freeze, ADMFLAG_SLAY, "sm_freeze <#userid|name> [time]");
   23.50 +	RegAdminCmd("sm_freezebomb", Command_FreezeBomb, ADMFLAG_SLAY, "sm_freezebomb <#userid|name> [0/1]");
   23.51 +
   23.52 +	g_FreezeDuration = CreateConVar("sm_freeze_duration", "10.0", "Sets the default duration for sm_freeze and freezebomb victims", 0, true, 1.0, true, 120.0);	
   23.53 +	g_FreezeBombTicks = CreateConVar("sm_freezebomb_ticks", "10", "Sets how long the freezebomb fuse is.", 0, true, 5.0, true, 120.0);
   23.54 +	g_FreezeBombRadius = CreateConVar("sm_freezebomb_radius", "600", "Sets the freezebomb blast radius.", 0, true, 50.0, true, 3000.0);
   23.55 +	g_FreezeBombMode = CreateConVar("sm_freezebomb_mode", "0", "Who is targetted by the freezebomb? 0 = Target only, 1 = Target's team, 2 = Everyone", 0, true, 0.0, true, 2.0);
   23.56 +}
   23.57 +
   23.58 +FreezeClient(client, time)
   23.59 +{
   23.60 +	if (g_FreezeTimers[client] != INVALID_HANDLE)
   23.61 +	{
   23.62 +		UnfreezeClient(client);
   23.63 +	}
   23.64 +	
   23.65 +	SetEntityMoveType(client, MOVETYPE_NONE);
   23.66 +	SetEntityRenderColor(client, 0, 128, 255, 192);
   23.67 +	
   23.68 +	new Float:vec[3];
   23.69 +	GetClientEyePosition(client, vec);
   23.70 +	EmitAmbientSound(SOUND_FREEZE, vec, client, SNDLEVEL_RAIDSIREN);
   23.71 +
   23.72 +	g_FreezeTimers[client] = CreateTimer(1.0, Timer_Freeze, client, TIMER_REPEAT);
   23.73 +	g_FreezeTracker[client] = time;
   23.74 +}
   23.75 +
   23.76 +UnfreezeClient(client)
   23.77 +{
   23.78 +	KillFreezeTimer(client);
   23.79 +
   23.80 +	new Float:vec[3];
   23.81 +	GetClientAbsOrigin(client, vec);
   23.82 +	vec[2] += 10;	
   23.83 +	
   23.84 +	GetClientEyePosition(client, vec);
   23.85 +	EmitAmbientSound(SOUND_FREEZE, vec, client, SNDLEVEL_RAIDSIREN);
   23.86 +
   23.87 +	SetEntityMoveType(client, MOVETYPE_WALK);
   23.88 +	SetEntityRenderColor(client, 255, 255, 255, 255);	
   23.89 +}
   23.90 +
   23.91 +KillFreezeTimer(client)
   23.92 +{
   23.93 +	KillTimer(g_FreezeTimers[client]);
   23.94 +	g_FreezeTimers[client] = INVALID_HANDLE;
   23.95 +}
   23.96 +
   23.97 +CreateFreezeBomb(client)
   23.98 +{
   23.99 +	g_FreezeBombTimers[client] = CreateTimer(1.0, Timer_FreezeBomb, client, TIMER_REPEAT);
  23.100 +	g_FreezeBombTracker[client] = GetConVarInt(g_FreezeBombTicks);
  23.101 +}
  23.102 +
  23.103 +KillFreezeBomb(client)
  23.104 +{
  23.105 +	KillTimer(g_FreezeBombTimers[client]);
  23.106 +	g_FreezeBombTimers[client] = INVALID_HANDLE;
  23.107 +	
  23.108 +	SetEntityRenderColor(client, 255, 255, 255, 255);
  23.109 +}
  23.110 +
  23.111 +KillAllFreezes()
  23.112 +{
  23.113 +	new maxclients = GetMaxClients();
  23.114 +	for (new i = 1; i <= maxclients; i++)
  23.115 +	{
  23.116 +		if (g_FreezeTimers[i] != INVALID_HANDLE)
  23.117 +		{
  23.118 +			if(IsClientInGame(i))
  23.119 +			{
  23.120 +				UnfreezeClient(i);
  23.121 +			}
  23.122 +			else
  23.123 +			{
  23.124 +				KillFreezeTimer(i);
  23.125 +			}			
  23.126 +		}		
  23.127 +		
  23.128 +		if (g_FreezeBombTimers[i] != INVALID_HANDLE)
  23.129 +		{
  23.130 +			KillFreezeBomb(i);
  23.131 +		}
  23.132 +	}
  23.133 +}
  23.134 +
  23.135 +PerformFreeze(client, target, time)
  23.136 +{
  23.137 +	FreezeClient(target, time);
  23.138 +	LogAction(client, target, "\"%L\" froze \"%L\"", client, target);
  23.139 +}
  23.140 +
  23.141 +PerformFreezeBomb(client, target, toggle)
  23.142 +{
  23.143 +	switch (toggle)
  23.144 +	{
  23.145 +		case (2):
  23.146 +		{
  23.147 +			if (g_FreezeBombTimers[target] == INVALID_HANDLE)
  23.148 +			{
  23.149 +				CreateFreezeBomb(target);
  23.150 +				LogAction(client, target, "\"%L\" set a FreezeBomb on \"%L\"", client, target);
  23.151 +			}
  23.152 +			else
  23.153 +			{
  23.154 +				KillFreezeBomb(target);
  23.155 +				LogAction(client, target, "\"%L\" removed a FreezeBomb on \"%L\"", client, target);
  23.156 +			}
  23.157 +		}
  23.158 +
  23.159 +		case (1):
  23.160 +		{
  23.161 +			if (g_FreezeBombTimers[target] == INVALID_HANDLE)
  23.162 +			{
  23.163 +				CreateFreezeBomb(target);
  23.164 +				LogAction(client, target, "\"%L\" set a FreezeBomb on \"%L\"", client, target);
  23.165 +			}
  23.166 +		}
  23.167 +		
  23.168 +		case (0):
  23.169 +		{
  23.170 +			if (g_FreezeBombTimers[target] != INVALID_HANDLE)
  23.171 +			{
  23.172 +				KillFreezeBomb(target);
  23.173 +				LogAction(client, target, "\"%L\" removed a FreezeBomb on \"%L\"", client, target);
  23.174 +			}
  23.175 +		}
  23.176 +	}
  23.177 +}
  23.178 +
  23.179 +public Action:Timer_Freeze(Handle:timer, any:client)
  23.180 +{
  23.181 +	if (!IsClientInGame(client))
  23.182 +	{
  23.183 +		KillFreezeTimer(client);
  23.184 +
  23.185 +		return Plugin_Handled;
  23.186 +	}
  23.187 +	
  23.188 +	if (!IsPlayerAlive(client))
  23.189 +	{
  23.190 +		UnfreezeClient(client);
  23.191 +		
  23.192 +		return Plugin_Handled;
  23.193 +	}		
  23.194 +	
  23.195 +	g_FreezeTracker[client]--;
  23.196 +	
  23.197 +	SetEntityMoveType(client, MOVETYPE_NONE);
  23.198 +	SetEntityRenderColor(client, 0, 128, 255, 135);
  23.199 +	
  23.200 +	new Float:vec[3];
  23.201 +	GetClientAbsOrigin(client, vec);
  23.202 +	vec[2] += 10;
  23.203 +	
  23.204 +	TE_SetupGlowSprite(vec, g_GlowSprite, 0.95, 1.5, 50);
  23.205 +	TE_SendToAll();	
  23.206 +
  23.207 +	if (g_FreezeTracker[client] == 0)
  23.208 +	{
  23.209 +		UnfreezeClient(client);
  23.210 +	}
  23.211 +
  23.212 +	return Plugin_Handled;
  23.213 +}
  23.214 +
  23.215 +public Action:Timer_FreezeBomb(Handle:timer, any:client)
  23.216 +{
  23.217 +	if (!IsClientInGame(client) || !IsPlayerAlive(client))
  23.218 +	{
  23.219 +		KillFreezeBomb(client);
  23.220 +
  23.221 +		return Plugin_Handled;
  23.222 +	}
  23.223 +	
  23.224 +	g_FreezeBombTracker[client]--;
  23.225 +	
  23.226 +	new Float:vec[3];
  23.227 +	GetClientEyePosition(client, vec);
  23.228 +	
  23.229 +	if (g_FreezeBombTracker[client] > 0)
  23.230 +	{
  23.231 +		new color;
  23.232 +		
  23.233 +		if (g_FreezeBombTracker[client] > 1)
  23.234 +		{
  23.235 +			color = RoundToFloor(g_FreezeBombTracker[client] * (255.0 / GetConVarFloat(g_FreezeBombTicks)));
  23.236 +			EmitAmbientSound(SOUND_BEEP, vec, client, SNDLEVEL_RAIDSIREN);	
  23.237 +		}
  23.238 +		else
  23.239 +		{
  23.240 +			color = 0;
  23.241 +			EmitAmbientSound(SOUND_FINAL, vec, client, SNDLEVEL_RAIDSIREN);
  23.242 +		}
  23.243 +		
  23.244 +		SetEntityRenderColor(client, color, color, 255, 255);
  23.245 +
  23.246 +		decl String:name[64];
  23.247 +		GetClientName(client, name, sizeof(name));
  23.248 +		PrintCenterTextAll("%t", "Till Explodes", name, g_FreezeBombTracker[client]);
  23.249 +		
  23.250 +		GetClientAbsOrigin(client, vec);
  23.251 +		vec[2] += 10;
  23.252 +
  23.253 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_FreezeBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
  23.254 +		TE_SendToAll();
  23.255 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_FreezeBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
  23.256 +		TE_SendToAll();
  23.257 +	}
  23.258 +	else
  23.259 +	{
  23.260 +		TE_SetupExplosion(vec, g_ExplosionSprite, 5.0, 1, 0, GetConVarInt(g_FreezeBombRadius), 5000);
  23.261 +		TE_SendToAll();
  23.262 +
  23.263 +		EmitAmbientSound(SOUND_BOOM, vec, client, SNDLEVEL_RAIDSIREN);
  23.264 +
  23.265 +		KillFreezeBomb(client);
  23.266 +		FreezeClient(client, GetConVarInt(g_FreezeDuration));
  23.267 +		
  23.268 +		if (GetConVarInt(g_FreezeBombMode) > 0)
  23.269 +		{
  23.270 +			new teamOnly = ((GetConVarInt(g_FreezeBombMode) == 1) ? true : false);
  23.271 +			new maxClients = GetMaxClients();
  23.272 +			
  23.273 +			for (new i = 1; i < maxClients; i++)
  23.274 +			{
  23.275 +				if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
  23.276 +				{
  23.277 +					continue;
  23.278 +				}
  23.279 +				
  23.280 +				if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
  23.281 +				{
  23.282 +					continue;
  23.283 +				}
  23.284 +				
  23.285 +				new Float:pos[3];
  23.286 +				GetClientEyePosition(i, pos);
  23.287 +				
  23.288 +				new Float:distance = GetVectorDistance(vec, pos);
  23.289 +				
  23.290 +				if (distance > GetConVarFloat(g_FreezeBombRadius))
  23.291 +				{
  23.292 +					continue;
  23.293 +				}
  23.294 +				
  23.295 +				TE_SetupBeamPoints(vec, pos, g_BeamSprite2, g_HaloSprite, 0, 1, 0.7, 20.0, 50.0, 1, 1.5, blueColor, 10);
  23.296 +				TE_SendToAll();
  23.297 +				
  23.298 +				FreezeClient(i, GetConVarInt(g_FreezeDuration));
  23.299 +			}		
  23.300 +		}
  23.301 +	}
  23.302 +			
  23.303 +	return Plugin_Handled;
  23.304 +}
  23.305 +
  23.306 +public AdminMenu_Freeze(Handle:topmenu, 
  23.307 +					  TopMenuAction:action,
  23.308 +					  TopMenuObject:object_id,
  23.309 +					  param,
  23.310 +					  String:buffer[],
  23.311 +					  maxlength)
  23.312 +{
  23.313 +	if (action == TopMenuAction_DisplayOption)
  23.314 +	{
  23.315 +		Format(buffer, maxlength, "%T", "Freeze player", param);
  23.316 +	}
  23.317 +	else if (action == TopMenuAction_SelectOption)
  23.318 +	{
  23.319 +		DisplayFreezeMenu(param);
  23.320 +	}
  23.321 +}
  23.322 +
  23.323 +public AdminMenu_FreezeBomb(Handle:topmenu, 
  23.324 +					  TopMenuAction:action,
  23.325 +					  TopMenuObject:object_id,
  23.326 +					  param,
  23.327 +					  String:buffer[],
  23.328 +					  maxlength)
  23.329 +{
  23.330 +	if (action == TopMenuAction_DisplayOption)
  23.331 +	{
  23.332 +		Format(buffer, maxlength, "%T", "FreezeBomb player", param);
  23.333 +	}
  23.334 +	else if (action == TopMenuAction_SelectOption)
  23.335 +	{
  23.336 +		DisplayFreezeBombMenu(param);
  23.337 +	}
  23.338 +}
  23.339 +
  23.340 +DisplayFreezeMenu(client)
  23.341 +{
  23.342 +	new Handle:menu = CreateMenu(MenuHandler_Freeze);
  23.343 +	
  23.344 +	decl String:title[100];
  23.345 +	Format(title, sizeof(title), "%T:", "Freeze player", client);
  23.346 +	SetMenuTitle(menu, title);
  23.347 +	SetMenuExitBackButton(menu, true);
  23.348 +	
  23.349 +	AddTargetsToMenu(menu, client, true, true);
  23.350 +	
  23.351 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  23.352 +}
  23.353 +
  23.354 +DisplayFreezeBombMenu(client)
  23.355 +{
  23.356 +	new Handle:menu = CreateMenu(MenuHandler_FreezeBomb);
  23.357 +	
  23.358 +	decl String:title[100];
  23.359 +	Format(title, sizeof(title), "%T:", "FreezeBomb player", client);
  23.360 +	SetMenuTitle(menu, title);
  23.361 +	SetMenuExitBackButton(menu, true);
  23.362 +	
  23.363 +	AddTargetsToMenu(menu, client, true, true);
  23.364 +	
  23.365 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  23.366 +}
  23.367 +
  23.368 +public MenuHandler_Freeze(Handle:menu, MenuAction:action, param1, param2)
  23.369 +{
  23.370 +	if (action == MenuAction_End)
  23.371 +	{
  23.372 +		CloseHandle(menu);
  23.373 +	}
  23.374 +	else if (action == MenuAction_Cancel)
  23.375 +	{
  23.376 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  23.377 +		{
  23.378 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  23.379 +		}
  23.380 +	}
  23.381 +	else if (action == MenuAction_Select)
  23.382 +	{
  23.383 +		decl String:info[32];
  23.384 +		new userid, target;
  23.385 +		
  23.386 +		GetMenuItem(menu, param2, info, sizeof(info));
  23.387 +		userid = StringToInt(info);
  23.388 +
  23.389 +		if ((target = GetClientOfUserId(userid)) == 0)
  23.390 +		{
  23.391 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  23.392 +		}
  23.393 +		else if (!CanUserTarget(param1, target))
  23.394 +		{
  23.395 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  23.396 +		}
  23.397 +		else
  23.398 +		{
  23.399 +			new String:name[32];
  23.400 +			GetClientName(target, name, sizeof(name));
  23.401 +			
  23.402 +			PerformFreeze(param1, target, GetConVarInt(g_FreezeDuration));
  23.403 +			ShowActivity2(param1, "[SM] ", "%t", "Froze target", "_s", name);
  23.404 +		}
  23.405 +		
  23.406 +		/* Re-draw the menu if they're still valid */
  23.407 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  23.408 +		{
  23.409 +			DisplayFreezeMenu(param1);
  23.410 +		}
  23.411 +	}
  23.412 +}
  23.413 +
  23.414 +public MenuHandler_FreezeBomb(Handle:menu, MenuAction:action, param1, param2)
  23.415 +{
  23.416 +	if (action == MenuAction_End)
  23.417 +	{
  23.418 +		CloseHandle(menu);
  23.419 +	}
  23.420 +	else if (action == MenuAction_Cancel)
  23.421 +	{
  23.422 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  23.423 +		{
  23.424 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  23.425 +		}
  23.426 +	}
  23.427 +	else if (action == MenuAction_Select)
  23.428 +	{
  23.429 +		decl String:info[32];
  23.430 +		new userid, target;
  23.431 +		
  23.432 +		GetMenuItem(menu, param2, info, sizeof(info));
  23.433 +		userid = StringToInt(info);
  23.434 +
  23.435 +		if ((target = GetClientOfUserId(userid)) == 0)
  23.436 +		{
  23.437 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  23.438 +		}
  23.439 +		else if (!CanUserTarget(param1, target))
  23.440 +		{
  23.441 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  23.442 +		}
  23.443 +		else
  23.444 +		{
  23.445 +			new String:name[32];
  23.446 +			GetClientName(target, name, sizeof(name));
  23.447 +			
  23.448 +			PerformFreezeBomb(param1, target, 2);
  23.449 +			ShowActivity2(param1, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", name);
  23.450 +		}
  23.451 +		
  23.452 +		/* Re-draw the menu if they're still valid */
  23.453 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  23.454 +		{
  23.455 +			DisplayFreezeBombMenu(param1);
  23.456 +		}
  23.457 +	}
  23.458 +}
  23.459 +
  23.460 +public Action:Command_Freeze(client, args)
  23.461 +{
  23.462 +	if (args < 1)
  23.463 +	{
  23.464 +		ReplyToCommand(client, "[SM] Usage: sm_freeze <#userid|name> [time]");
  23.465 +		return Plugin_Handled;
  23.466 +	}
  23.467 +
  23.468 +	decl String:arg[65];
  23.469 +	GetCmdArg(1, arg, sizeof(arg));
  23.470 +	
  23.471 +	new seconds = GetConVarInt(g_FreezeDuration);
  23.472 +	
  23.473 +	if (args > 1)
  23.474 +	{
  23.475 +		decl String:time[20];
  23.476 +		GetCmdArg(2, time, sizeof(time));
  23.477 +		if (StringToIntEx(time, seconds) == 0)
  23.478 +		{
  23.479 +			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
  23.480 +			return Plugin_Handled;
  23.481 +		}
  23.482 +	}	
  23.483 +
  23.484 +	decl String:target_name[MAX_TARGET_LENGTH];
  23.485 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  23.486 +	
  23.487 +	if ((target_count = ProcessTargetString(
  23.488 +			arg,
  23.489 +			client,
  23.490 +			target_list,
  23.491 +			MAXPLAYERS,
  23.492 +			COMMAND_FILTER_ALIVE,
  23.493 +			target_name,
  23.494 +			sizeof(target_name),
  23.495 +			tn_is_ml)) <= 0)
  23.496 +	{
  23.497 +		ReplyToTargetError(client, target_count);
  23.498 +		return Plugin_Handled;
  23.499 +	}
  23.500 +	
  23.501 +	for (new i = 0; i < target_count; i++)
  23.502 +	{
  23.503 +		PerformFreeze(client, target_list[i], seconds);
  23.504 +	}
  23.505 +	
  23.506 +	if (tn_is_ml)
  23.507 +	{
  23.508 +		ShowActivity2(client, "[SM] ", "%t", "Froze target", target_name);
  23.509 +	}
  23.510 +	else
  23.511 +	{
  23.512 +		ShowActivity2(client, "[SM] ", "%t", "Froze target", "_s", target_name);
  23.513 +	}
  23.514 +	
  23.515 +	return Plugin_Handled;
  23.516 +}
  23.517 +
  23.518 +public Action:Command_FreezeBomb(client, args)
  23.519 +{
  23.520 +	if (args < 1)
  23.521 +	{
  23.522 +		ReplyToCommand(client, "[SM] Usage: sm_freezebomb <#userid|name> [0/1]");
  23.523 +		return Plugin_Handled;
  23.524 +	}
  23.525 +
  23.526 +	decl String:arg[65];
  23.527 +	GetCmdArg(1, arg, sizeof(arg));
  23.528 +	
  23.529 +	new toggle = 2;
  23.530 +	if (args > 1)
  23.531 +	{
  23.532 +		decl String:arg2[2];
  23.533 +		GetCmdArg(2, arg2, sizeof(arg2));
  23.534 +		if (arg2[0])
  23.535 +		{
  23.536 +			toggle = 1;
  23.537 +		}
  23.538 +		else
  23.539 +		{
  23.540 +			toggle = 0;
  23.541 +		}
  23.542 +	}
  23.543 +
  23.544 +	decl String:target_name[MAX_TARGET_LENGTH];
  23.545 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  23.546 +	
  23.547 +	if ((target_count = ProcessTargetString(
  23.548 +			arg,
  23.549 +			client,
  23.550 +			target_list,
  23.551 +			MAXPLAYERS,
  23.552 +			COMMAND_FILTER_ALIVE,
  23.553 +			target_name,
  23.554 +			sizeof(target_name),
  23.555 +			tn_is_ml)) <= 0)
  23.556 +	{
  23.557 +		ReplyToTargetError(client, target_count);
  23.558 +		return Plugin_Handled;
  23.559 +	}
  23.560 +	
  23.561 +	for (new i = 0; i < target_count; i++)
  23.562 +	{
  23.563 +		PerformFreezeBomb(client, target_list[i], toggle);
  23.564 +	}
  23.565 +	
  23.566 +	if (tn_is_ml)
  23.567 +	{
  23.568 +		ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", target_name);
  23.569 +	}
  23.570 +	else
  23.571 +	{
  23.572 +		ShowActivity2(client, "[SM] ", "%t", "Toggled FreezeBomb on target", "_s", target_name);
  23.573 +	}
  23.574 +	
  23.575 +	return Plugin_Handled;
  23.576 +}
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/plugins/funcommands/noclip.sp	Fri Feb 22 21:01:08 2008 +0000
    24.3 @@ -0,0 +1,175 @@
    24.4 +/**
    24.5 + * vim: set ts=4 :
    24.6 + * =============================================================================
    24.7 + * SourceMod Basefuncommands Plugin
    24.8 + * Provides noclip functionality
    24.9 + *
   24.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   24.11 + * =============================================================================
   24.12 + *
   24.13 + * This program is free software; you can redistribute it and/or modify it under
   24.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   24.15 + * Free Software Foundation.
   24.16 + * 
   24.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   24.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   24.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   24.20 + * details.
   24.21 + *
   24.22 + * You should have received a copy of the GNU General Public License along with
   24.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   24.24 + *
   24.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   24.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   24.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   24.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   24.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   24.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   24.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   24.32 + * or <http://www.sourcemod.net/license.php>.
   24.33 + *
   24.34 + * Version: $Id$
   24.35 + */
   24.36 + 
   24.37 +SetupNoClip()
   24.38 +{
   24.39 +	RegAdminCmd("sm_noclip", Command_NoClip, ADMFLAG_SLAY|ADMFLAG_CHEATS, "sm_noclip <#userid|name>");
   24.40 +}
   24.41 +
   24.42 +PerformNoClip(client, target)
   24.43 +{
   24.44 +	new MoveType:movetype = GetEntityMoveType(target);
   24.45 +
   24.46 +	if (movetype != MOVETYPE_NOCLIP)
   24.47 +	{
   24.48 +		SetEntityMoveType(target, MOVETYPE_NOCLIP);
   24.49 +	}
   24.50 +	else
   24.51 +	{
   24.52 +		SetEntityMoveType(target, MOVETYPE_WALK);
   24.53 +	}
   24.54 +	
   24.55 +	LogAction(client, target, "\"%L\" toggled noclip on \"%L\"", client, target);
   24.56 +}
   24.57 +
   24.58 +public AdminMenu_NoClip(Handle:topmenu, 
   24.59 +					  TopMenuAction:action,
   24.60 +					  TopMenuObject:object_id,
   24.61 +					  param,
   24.62 +					  String:buffer[],
   24.63 +					  maxlength)
   24.64 +{
   24.65 +	if (action == TopMenuAction_DisplayOption)
   24.66 +	{
   24.67 +		Format(buffer, maxlength, "%T", "NoClip player", param);
   24.68 +	}
   24.69 +	else if (action == TopMenuAction_SelectOption)
   24.70 +	{
   24.71 +		DisplayNoClipMenu(param);
   24.72 +	}
   24.73 +}
   24.74 +
   24.75 +DisplayNoClipMenu(client)
   24.76 +{
   24.77 +	new Handle:menu = CreateMenu(MenuHandler_NoClip);
   24.78 +	
   24.79 +	decl String:title[100];
   24.80 +	Format(title, sizeof(title), "%T:", "NoClip player", client);
   24.81 +	SetMenuTitle(menu, title);
   24.82 +	SetMenuExitBackButton(menu, true);
   24.83 +	
   24.84 +	AddTargetsToMenu(menu, client, true, true);
   24.85 +	
   24.86 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   24.87 +}
   24.88 +
   24.89 +public MenuHandler_NoClip(Handle:menu, MenuAction:action, param1, param2)
   24.90 +{
   24.91 +	if (action == MenuAction_End)
   24.92 +	{
   24.93 +		CloseHandle(menu);
   24.94 +	}
   24.95 +	else if (action == MenuAction_Cancel)
   24.96 +	{
   24.97 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   24.98 +		{
   24.99 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  24.100 +		}
  24.101 +	}
  24.102 +	else if (action == MenuAction_Select)
  24.103 +	{
  24.104 +		decl String:info[32];
  24.105 +		new userid, target;
  24.106 +		
  24.107 +		GetMenuItem(menu, param2, info, sizeof(info));
  24.108 +		userid = StringToInt(info);
  24.109 +
  24.110 +		if ((target = GetClientOfUserId(userid)) == 0)
  24.111 +		{
  24.112 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  24.113 +		}
  24.114 +		else if (!CanUserTarget(param1, target))
  24.115 +		{
  24.116 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  24.117 +		}
  24.118 +		else
  24.119 +		{
  24.120 +			new String:name[32];
  24.121 +			GetClientName(target, name, sizeof(name));
  24.122 +			
  24.123 +			PerformNoClip(param1, target);
  24.124 +			ShowActivity2(param1, "[SM] ", "%t", "Toggled noclip on target", "_s", name);
  24.125 +		}
  24.126 +		
  24.127 +		/* Re-draw the menu if they're still valid */
  24.128 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  24.129 +		{
  24.130 +			DisplayNoClipMenu(param1);
  24.131 +		}
  24.132 +	}
  24.133 +}
  24.134 +
  24.135 +public Action:Command_NoClip(client, args)
  24.136 +{
  24.137 +	if (args < 1)
  24.138 +	{
  24.139 +		ReplyToCommand(client, "[SM] Usage: sm_noclip <#userid|name>");
  24.140 +		return Plugin_Handled;
  24.141 +	}
  24.142 +
  24.143 +	decl String:arg[65];
  24.144 +	GetCmdArg(1, arg, sizeof(arg));
  24.145 +	
  24.146 +	decl String:target_name[MAX_TARGET_LENGTH];
  24.147 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  24.148 +	
  24.149 +	if ((target_count = ProcessTargetString(
  24.150 +			arg,
  24.151 +			client,
  24.152 +			target_list,
  24.153 +			MAXPLAYERS,
  24.154 +			COMMAND_FILTER_ALIVE,
  24.155 +			target_name,
  24.156 +			sizeof(target_name),
  24.157 +			tn_is_ml)) <= 0)
  24.158 +	{
  24.159 +		ReplyToTargetError(client, target_count);
  24.160 +		return Plugin_Handled;
  24.161 +	}
  24.162 +	
  24.163 +	for (new i = 0; i < target_count; i++)
  24.164 +	{
  24.165 +		PerformNoClip(client, target_list[i]);
  24.166 +	}
  24.167 +	
  24.168 +	if (tn_is_ml)
  24.169 +	{
  24.170 +		ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", target_name);
  24.171 +	}
  24.172 +	else
  24.173 +	{
  24.174 +		ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", "_s", target_name);
  24.175 +	}
  24.176 +	
  24.177 +	return Plugin_Handled;
  24.178 +}
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/plugins/funcommands/timebomb.sp	Fri Feb 22 21:01:08 2008 +0000
    25.3 @@ -0,0 +1,365 @@
    25.4 +/**
    25.5 + * vim: set ts=4 :
    25.6 + * =============================================================================
    25.7 + * SourceMod Basefuncommands Plugin
    25.8 + * Provides TimeBomb functionality
    25.9 + *
   25.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   25.11 + * =============================================================================
   25.12 + *
   25.13 + * This program is free software; you can redistribute it and/or modify it under
   25.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   25.15 + * Free Software Foundation.
   25.16 + * 
   25.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   25.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   25.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   25.20 + * details.
   25.21 + *
   25.22 + * You should have received a copy of the GNU General Public License along with
   25.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   25.24 + *
   25.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   25.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   25.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   25.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   25.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   25.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   25.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   25.32 + * or <http://www.sourcemod.net/license.php>.
   25.33 + *
   25.34 + * Version: $Id$
   25.35 + */
   25.36 +
   25.37 +new Handle:g_TimeBombTimers[MAXPLAYERS+1];
   25.38 +new g_TimeBombTracker[MAXPLAYERS+1];
   25.39 +
   25.40 +new Handle:g_TimeBombTicks = INVALID_HANDLE;
   25.41 +new Handle:g_TimeBombRadius = INVALID_HANDLE;
   25.42 +new Handle:g_TimeBombMode = INVALID_HANDLE;
   25.43 +
   25.44 +SetupTimeBomb()
   25.45 +{
   25.46 +	RegAdminCmd("sm_timebomb", Command_TimeBomb, ADMFLAG_SLAY, "sm_timebomb <#userid|name> [0/1]");	
   25.47 +	
   25.48 +	g_TimeBombTicks = CreateConVar("sm_timebomb_ticks", "10", "Sets how long the timebomb fuse is.", 0, true, 5.0, true, 120.0);
   25.49 +	g_TimeBombRadius = CreateConVar("sm_timebomb_radius", "600", "Sets the bomb blast radius.", 0, true, 50.0, true, 3000.0);
   25.50 +	g_TimeBombMode = CreateConVar("sm_timebomb_mode", "0", "Who is killed by the timebomb? 0 = Target only, 1 = Target's team, 2 = Everyone", 0, true, 0.0, true, 2.0);
   25.51 +}
   25.52 +
   25.53 +CreateTimeBomb(client)
   25.54 +{
   25.55 +	g_TimeBombTimers[client] = CreateTimer(1.0, Timer_TimeBomb, client, TIMER_REPEAT);
   25.56 +	g_TimeBombTracker[client] = GetConVarInt(g_TimeBombTicks);
   25.57 +}
   25.58 +
   25.59 +KillTimeBomb(client)
   25.60 +{
   25.61 +	KillTimer(g_TimeBombTimers[client]);
   25.62 +	g_TimeBombTimers[client] = INVALID_HANDLE;
   25.63 +}
   25.64 +
   25.65 +KillAllTimeBombs()
   25.66 +{
   25.67 +	new maxclients = GetMaxClients();
   25.68 +	for (new i = 1; i <= maxclients; i++)
   25.69 +	{
   25.70 +		if (g_TimeBombTimers[i] != INVALID_HANDLE)
   25.71 +		{
   25.72 +			KillTimeBomb(i);
   25.73 +		}
   25.74 +	}
   25.75 +}
   25.76 +
   25.77 +PerformTimeBomb(client, target, toggle)
   25.78 +{
   25.79 +	switch (toggle)
   25.80 +	{
   25.81 +		case (2):
   25.82 +		{
   25.83 +			if (g_TimeBombTimers[target] == INVALID_HANDLE)
   25.84 +			{
   25.85 +				CreateTimeBomb(target);
   25.86 +				LogAction(client, target, "\"%L\" set a TimeBomb on \"%L\"", client, target);
   25.87 +			}
   25.88 +			else
   25.89 +			{
   25.90 +				KillTimeBomb(target);
   25.91 +				SetEntityRenderColor(client, 255, 255, 255, 255);
   25.92 +				LogAction(client, target, "\"%L\" removed a TimeBomb on \"%L\"", client, target);
   25.93 +			}			
   25.94 +		}
   25.95 +
   25.96 +		case (1):
   25.97 +		{
   25.98 +			if (g_TimeBombTimers[target] == INVALID_HANDLE)
   25.99 +			{
  25.100 +				CreateTimeBomb(target);
  25.101 +				LogAction(client, target, "\"%L\" set a TimeBomb on \"%L\"", client, target);
  25.102 +			}			
  25.103 +		}
  25.104 +		
  25.105 +		case (0):
  25.106 +		{
  25.107 +			if (g_TimeBombTimers[target] != INVALID_HANDLE)
  25.108 +			{
  25.109 +				KillTimeBomb(target);
  25.110 +				SetEntityRenderColor(client, 255, 255, 255, 255);
  25.111 +				LogAction(client, target, "\"%L\" removed a TimeBomb on \"%L\"", client, target);
  25.112 +			}			
  25.113 +		}
  25.114 +	}
  25.115 +}
  25.116 +
  25.117 +public Action:Timer_TimeBomb(Handle:timer, any:client)
  25.118 +{
  25.119 +	if (!IsClientInGame(client) || !IsPlayerAlive(client))
  25.120 +	{
  25.121 +		KillTimeBomb(client);		
  25.122 +
  25.123 +		return Plugin_Handled;
  25.124 +	}
  25.125 +	
  25.126 +	g_TimeBombTracker[client]--;
  25.127 +	
  25.128 +	new Float:vec[3];
  25.129 +	GetClientEyePosition(client, vec);
  25.130 +	
  25.131 +	if (g_TimeBombTracker[client] > 0)
  25.132 +	{
  25.133 +		new color;
  25.134 +		
  25.135 +		if (g_TimeBombTracker[client] > 1)
  25.136 +		{
  25.137 +			color = RoundToFloor(g_TimeBombTracker[client] * (128.0 / GetConVarFloat(g_TimeBombTicks)));
  25.138 +			EmitAmbientSound(SOUND_BEEP, vec, client, SNDLEVEL_RAIDSIREN);	
  25.139 +		}
  25.140 +		else
  25.141 +		{
  25.142 +			color = 0;
  25.143 +			EmitAmbientSound(SOUND_FINAL, vec, client, SNDLEVEL_RAIDSIREN);
  25.144 +		}
  25.145 +		
  25.146 +		SetEntityRenderColor(client, 255, 128, color, 255);
  25.147 +
  25.148 +		decl String:name[64];
  25.149 +		GetClientName(client, name, sizeof(name));
  25.150 +		PrintCenterTextAll("%t", "Till Explodes", name, g_TimeBombTracker[client]);
  25.151 +		
  25.152 +		GetClientAbsOrigin(client, vec);
  25.153 +		vec[2] += 10;
  25.154 +
  25.155 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_TimeBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 15, 0.5, 5.0, 0.0, greyColor, 10, 0);
  25.156 +		TE_SendToAll();
  25.157 +		TE_SetupBeamRingPoint(vec, 10.0, GetConVarFloat(g_TimeBombRadius) / 3.0, g_BeamSprite, g_HaloSprite, 0, 10, 0.6, 10.0, 0.5, whiteColor, 10, 0);
  25.158 +		TE_SendToAll();
  25.159 +	}
  25.160 +	else
  25.161 +	{
  25.162 +		TE_SetupExplosion(vec, g_ExplosionSprite, 5.0, 1, 0, GetConVarInt(g_TimeBombRadius), 5000);
  25.163 +		TE_SendToAll();
  25.164 +
  25.165 +		EmitAmbientSound(SOUND_BOOM, vec, client, SNDLEVEL_RAIDSIREN);
  25.166 +
  25.167 +		ForcePlayerSuicide(client);
  25.168 +		KillTimeBomb(client);
  25.169 +		SetEntityRenderColor(client, 255, 255, 255, 255);
  25.170 +		
  25.171 +		if (GetConVarInt(g_TimeBombMode) > 0)
  25.172 +		{
  25.173 +			new teamOnly = ((GetConVarInt(g_TimeBombMode) == 1) ? true : false);
  25.174 +			new maxClients = GetMaxClients();
  25.175 +			
  25.176 +			//g_FilteredEntity = client;
  25.177 +			
  25.178 +			for (new i = 1; i < maxClients; i++)
  25.179 +			{
  25.180 +				if (!IsClientInGame(i) || !IsPlayerAlive(i) || i == client)
  25.181 +				{
  25.182 +					continue;
  25.183 +				}
  25.184 +				
  25.185 +				if (teamOnly && GetClientTeam(i) != GetClientTeam(client))
  25.186 +				{
  25.187 +					continue;
  25.188 +				}
  25.189 +				
  25.190 +				new Float:pos[3];
  25.191 +				GetClientEyePosition(i, pos);
  25.192 +				
  25.193 +				new Float:distance = GetVectorDistance(vec, pos);
  25.194 +				
  25.195 +				if (distance > GetConVarFloat(g_TimeBombRadius))
  25.196 +				{
  25.197 +					continue;
  25.198 +				}
  25.199 +				
  25.200 +				new damage = 220;
  25.201 +				damage = RoundToFloor(damage * ((GetConVarFloat(g_TimeBombRadius) - distance) / GetConVarFloat(g_TimeBombRadius)));
  25.202 +					
  25.203 +				SlapPlayer(i, damage, false);
  25.204 +				TE_SetupExplosion(pos, g_ExplosionSprite, 0.05, 1, 0, 1, 1);
  25.205 +				TE_SendToAll();				
  25.206 +				
  25.207 +				/*
  25.208 +				new Float:dir[3];
  25.209 +				SubtractVectors(vec, pos, dir);
  25.210 +				TR_TraceRayFilter(vec, dir, MASK_SOLID, RayType_Infinite, TR_Filter_Client);
  25.211 +
  25.212 +				if (i == TR_GetEntityIndex())
  25.213 +				{
  25.214 +					new damage = 100;
  25.215 +					new radius = GetConVarInt(g_TimeBombRadius) / 2;
  25.216 +					
  25.217 +					if (distance > radius)
  25.218 +					{
  25.219 +						distance -= radius;
  25.220 +						damage = RoundToFloor(damage * ((radius - distance) / radius));
  25.221 +					}
  25.222 +					
  25.223 +					SlapPlayer(i, damage, false);
  25.224 +				}
  25.225 +				*/
  25.226 +			}		
  25.227 +		}
  25.228 +	}
  25.229 +			
  25.230 +	return Plugin_Handled;
  25.231 +}
  25.232 +
  25.233 +public AdminMenu_TimeBomb(Handle:topmenu, 
  25.234 +					  TopMenuAction:action,
  25.235 +					  TopMenuObject:object_id,
  25.236 +					  param,
  25.237 +					  String:buffer[],
  25.238 +					  maxlength)
  25.239 +{
  25.240 +	if (action == TopMenuAction_DisplayOption)
  25.241 +	{
  25.242 +		Format(buffer, maxlength, "%T", "TimeBomb player", param);
  25.243 +	}
  25.244 +	else if (action == TopMenuAction_SelectOption)
  25.245 +	{
  25.246 +		DisplayTimeBombMenu(param);
  25.247 +	}
  25.248 +}
  25.249 +
  25.250 +DisplayTimeBombMenu(client)
  25.251 +{
  25.252 +	new Handle:menu = CreateMenu(MenuHandler_TimeBomb);
  25.253 +	
  25.254 +	decl String:title[100];
  25.255 +	Format(title, sizeof(title), "%T:", "TimeBomb player", client);
  25.256 +	SetMenuTitle(menu, title);
  25.257 +	SetMenuExitBackButton(menu, true);
  25.258 +	
  25.259 +	AddTargetsToMenu(menu, client, true, true);
  25.260 +	
  25.261 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
  25.262 +}
  25.263 +
  25.264 +public MenuHandler_TimeBomb(Handle:menu, MenuAction:action, param1, param2)
  25.265 +{
  25.266 +	if (action == MenuAction_End)
  25.267 +	{
  25.268 +		CloseHandle(menu);
  25.269 +	}
  25.270 +	else if (action == MenuAction_Cancel)
  25.271 +	{
  25.272 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  25.273 +		{
  25.274 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  25.275 +		}
  25.276 +	}
  25.277 +	else if (action == MenuAction_Select)
  25.278 +	{
  25.279 +		decl String:info[32];
  25.280 +		new userid, target;
  25.281 +		
  25.282 +		GetMenuItem(menu, param2, info, sizeof(info));
  25.283 +		userid = StringToInt(info);
  25.284 +
  25.285 +		if ((target = GetClientOfUserId(userid)) == 0)
  25.286 +		{
  25.287 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  25.288 +		}
  25.289 +		else if (!CanUserTarget(param1, target))
  25.290 +		{
  25.291 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  25.292 +		}
  25.293 +		else
  25.294 +		{
  25.295 +			new String:name[32];
  25.296 +			GetClientName(target, name, sizeof(name));
  25.297 +			
  25.298 +			PerformTimeBomb(param1, target, 2);
  25.299 +			ShowActivity2(param1, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", name);
  25.300 +		}
  25.301 +		
  25.302 +		/* Re-draw the menu if they're still valid */
  25.303 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
  25.304 +		{
  25.305 +			DisplayTimeBombMenu(param1);
  25.306 +		}
  25.307 +	}
  25.308 +}
  25.309 +
  25.310 +public Action:Command_TimeBomb(client, args)
  25.311 +{
  25.312 +	if (args < 1)
  25.313 +	{
  25.314 +		ReplyToCommand(client, "[SM] Usage: sm_timebomb <#userid|name> [0/1]");
  25.315 +		return Plugin_Handled;
  25.316 +	}
  25.317 +
  25.318 +	decl String:arg[65];
  25.319 +	GetCmdArg(1, arg, sizeof(arg));
  25.320 +	
  25.321 +	new toggle = 2;
  25.322 +	if (args > 1)
  25.323 +	{
  25.324 +		decl String:arg2[2];
  25.325 +		GetCmdArg(2, arg2, sizeof(arg2));
  25.326 +		if (arg2[0])
  25.327 +		{
  25.328 +			toggle = 1;
  25.329 +		}
  25.330 +		else
  25.331 +		{
  25.332 +			toggle = 0;
  25.333 +		}
  25.334 +	}
  25.335 +
  25.336 +	decl String:target_name[MAX_TARGET_LENGTH];
  25.337 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  25.338 +	
  25.339 +	if ((target_count = ProcessTargetString(
  25.340 +			arg,
  25.341 +			client,
  25.342 +			target_list,
  25.343 +			MAXPLAYERS,
  25.344 +			COMMAND_FILTER_ALIVE,
  25.345 +			target_name,
  25.346 +			sizeof(target_name),
  25.347 +			tn_is_ml)) <= 0)
  25.348 +	{
  25.349 +		ReplyToTargetError(client, target_count);
  25.350 +		return Plugin_Handled;
  25.351 +	}
  25.352 +	
  25.353 +	for (new i = 0; i < target_count; i++)
  25.354 +	{
  25.355 +		PerformTimeBomb(client, target_list[i], toggle);
  25.356 +	}
  25.357 +	
  25.358 +	if (tn_is_ml)
  25.359 +	{
  25.360 +		ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", target_name);
  25.361 +	}
  25.362 +	else
  25.363 +	{
  25.364 +		ShowActivity2(client, "[SM] ", "%t", "Toggled TimeBomb on target", "_s", target_name);
  25.365 +	}
  25.366 +	
  25.367 +	return Plugin_Handled;
  25.368 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/plugins/funvotes.sp	Fri Feb 22 21:01:08 2008 +0000
    26.3 @@ -0,0 +1,355 @@
    26.4 +/**
    26.5 + * vim: set ts=4 :
    26.6 + * =============================================================================
    26.7 + * SourceMod Fun Votes Plugin
    26.8 + * Implements extra fun vote commands.
    26.9 + *
   26.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   26.11 + * =============================================================================
   26.12 + *
   26.13 + * This program is free software; you can redistribute it and/or modify it under
   26.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   26.15 + * Free Software Foundation.
   26.16 + * 
   26.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   26.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   26.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   26.20 + * details.
   26.21 + *
   26.22 + * You should have received a copy of the GNU General Public License along with
   26.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   26.24 + *
   26.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   26.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   26.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   26.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   26.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   26.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   26.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   26.32 + * or <http://www.sourcemod.net/license.php>.
   26.33 + *
   26.34 + * Version: $Id$
   26.35 + */
   26.36 +
   26.37 +#pragma semicolon 1
   26.38 +
   26.39 +#include <sourcemod>
   26.40 +#include <sdktools>
   26.41 +
   26.42 +#undef REQUIRE_PLUGIN
   26.43 +#include <adminmenu>
   26.44 +
   26.45 +public Plugin:myinfo =
   26.46 +{
   26.47 +	name = "Fun Votes",
   26.48 +	author = "AlliedModders LLC",
   26.49 +	description = "Fun Vote Commands",
   26.50 +	version = SOURCEMOD_VERSION,
   26.51 +	url = "http://www.sourcemod.net/"
   26.52 +};
   26.53 +
   26.54 +#define VOTE_NO "###no###"
   26.55 +#define VOTE_YES "###yes###"
   26.56 +
   26.57 +new Handle:g_hVoteMenu = INVALID_HANDLE;
   26.58 +
   26.59 +new Handle:g_Cvar_Limits[5] = {INVALID_HANDLE, ...};
   26.60 +new Handle:g_Cvar_Gravity = INVALID_HANDLE;
   26.61 +new Handle:g_Cvar_Alltalk = INVALID_HANDLE;
   26.62 +new Handle:g_Cvar_FF = INVALID_HANDLE;
   26.63 +
   26.64 +// new Handle:g_Cvar_Show = INVALID_HANDLE;
   26.65 +
   26.66 +enum voteType
   26.67 +{
   26.68 +	gravity = 0,
   26.69 +	burn,
   26.70 +	slay,
   26.71 +	alltalk,
   26.72 +	ff
   26.73 +};
   26.74 +
   26.75 +new voteType:g_voteType = voteType:gravity;
   26.76 +
   26.77 +// Menu API does not provide us with a way to pass multiple peices of data with a single
   26.78 +// choice, so some globals are used to hold stuff.
   26.79 +//
   26.80 +#define VOTE_CLIENTID	0
   26.81 +#define VOTE_USERID	1
   26.82 +new g_voteClient[2];		/* Holds the target's client id and user id */
   26.83 +
   26.84 +#define VOTE_NAME	0
   26.85 +#define VOTE_AUTHID	1
   26.86 +#define	VOTE_IP		2
   26.87 +new String:g_voteInfo[3][65];	/* Holds the target's name, authid, and IP */
   26.88 +
   26.89 +new Handle:hTopMenu = INVALID_HANDLE;
   26.90 +
   26.91 +#include "funvotes/votegravity.sp"
   26.92 +#include "funvotes/voteburn.sp"
   26.93 +#include "funvotes/voteslay.sp"
   26.94 +#include "funvotes/votealltalk.sp"
   26.95 +#include "funvotes/voteff.sp"
   26.96 +
   26.97 +public OnPluginStart()
   26.98 +{
   26.99 +	if (FindPluginByFile("basefunvotes.smx") != INVALID_HANDLE)
  26.100 +	{
  26.101 +		ThrowError("This plugin replaces basefuncommands.  You cannot run both at once.");
  26.102 +	}
  26.103 +	
  26.104 +	LoadTranslations("common.phrases");
  26.105 +	LoadTranslations("basevotes.phrases");
  26.106 +	LoadTranslations("basefunvotes.phrases");
  26.107 +	LoadTranslations("basefuncommands.phrases");
  26.108 +	
  26.109 +	RegAdminCmd("sm_votegravity", Command_VoteGravity, ADMFLAG_VOTE, "sm_votegravity <amount> [amount2] ... [amount5]");
  26.110 +	RegAdminCmd("sm_voteburn", Command_VoteBurn, ADMFLAG_VOTE|ADMFLAG_SLAY, "sm_voteburn <player>");
  26.111 +	RegAdminCmd("sm_voteslay", Command_VoteSlay, ADMFLAG_VOTE|ADMFLAG_SLAY, "sm_voteslay <player>");
  26.112 +	RegAdminCmd("sm_votealltalk", Command_VoteAlltalk, ADMFLAG_VOTE, "sm_votealltalk");
  26.113 +	RegAdminCmd("sm_voteff", Command_VoteFF, ADMFLAG_VOTE, "sm_voteff");
  26.114 +
  26.115 +	g_Cvar_Limits[0] = CreateConVar("sm_vote_gravity", "0.60", "percent required for successful gravity vote.", 0, true, 0.05, true, 1.0);
  26.116 +	g_Cvar_Limits[1] = CreateConVar("sm_vote_burn", "0.60", "percent required for successful burn vote.", 0, true, 0.05, true, 1.0);
  26.117 +	g_Cvar_Limits[2] = CreateConVar("sm_vote_slay", "0.60", "percent required for successful slay vote.", 0, true, 0.05, true, 1.0);
  26.118 +	g_Cvar_Limits[3] = CreateConVar("sm_vote_alltalk", "0.60", "percent required for successful alltalk vote.", 0, true, 0.05, true, 1.0);
  26.119 +	g_Cvar_Limits[4] = CreateConVar("sm_vote_ff", "0.60", "percent required for successful friendly fire vote.", 0, true, 0.05, true, 1.0);
  26.120 +	
  26.121 +	g_Cvar_Gravity = FindConVar("sv_gravity");
  26.122 +	g_Cvar_Alltalk = FindConVar("sv_alltalk");
  26.123 +	g_Cvar_FF = FindConVar("mp_friendlyfire");
  26.124 +	
  26.125 +	/*
  26.126 +	g_Cvar_Show = FindConVar("sm_vote_show");
  26.127 +	if (g_Cvar_Show == INVALID_HANDLE)
  26.128 +	{
  26.129 +		g_Cvar_Show = CreateConVar("sm_vote_show", "1", "Show player's votes? Default on.", 0, true, 0.0, true, 1.0);
  26.130 +	}
  26.131 +	*/
  26.132 +	
  26.133 +	/* Account for late loading */
  26.134 +	new Handle:topmenu;
  26.135 +	if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
  26.136 +	{
  26.137 +		OnAdminMenuReady(topmenu);
  26.138 +	}
  26.139 +}
  26.140 +
  26.141 +public OnAdminMenuReady(Handle:topmenu)
  26.142 +{
  26.143 +	/* Block us from being called twice */
  26.144 +	if (topmenu == hTopMenu)
  26.145 +	{
  26.146 +		return;
  26.147 +	}
  26.148 +	
  26.149 +	/* Save the Handle */
  26.150 +	hTopMenu = topmenu;
  26.151 +	
  26.152 +	/* Build the "Voting Commands" category */
  26.153 +	new TopMenuObject:voting_commands = FindTopMenuCategory(hTopMenu, ADMINMENU_VOTINGCOMMANDS);
  26.154 +
  26.155 +	if (voting_commands != INVALID_TOPMENUOBJECT)
  26.156 +	{
  26.157 +		AddToTopMenu(hTopMenu,
  26.158 +			"sm_votegravity",
  26.159 +			TopMenuObject_Item,
  26.160 +			AdminMenu_VoteGravity,
  26.161 +			voting_commands,
  26.162 +			"sm_votegravity",
  26.163 +			ADMFLAG_VOTE);
  26.164 +			
  26.165 +		AddToTopMenu(hTopMenu,
  26.166 +			"sm_voteburn",
  26.167 +			TopMenuObject_Item,
  26.168 +			AdminMenu_VoteBurn,
  26.169 +			voting_commands,
  26.170 +			"sm_voteburn",
  26.171 +			ADMFLAG_VOTE|ADMFLAG_SLAY);
  26.172 +			
  26.173 +		AddToTopMenu(hTopMenu,
  26.174 +			"sm_voteslay",
  26.175 +			TopMenuObject_Item,
  26.176 +			AdminMenu_VoteSlay,
  26.177 +			voting_commands,
  26.178 +			"sm_voteslay",
  26.179 +			ADMFLAG_VOTE|ADMFLAG_SLAY);
  26.180 +			
  26.181 +		AddToTopMenu(hTopMenu,
  26.182 +			"sm_votealltalk",
  26.183 +			TopMenuObject_Item,
  26.184 +			AdminMenu_VoteAllTalk,
  26.185 +			voting_commands,
  26.186 +			"sm_votealltalk",
  26.187 +			ADMFLAG_VOTE);
  26.188 +			
  26.189 +		AddToTopMenu(hTopMenu,
  26.190 +			"sm_voteff",
  26.191 +			TopMenuObject_Item,
  26.192 +			AdminMenu_VoteFF,
  26.193 +			voting_commands,
  26.194 +			"sm_voteff",
  26.195 +			ADMFLAG_VOTE);
  26.196 +	}
  26.197 +}
  26.198 +
  26.199 +public Handler_VoteCallback(Handle:menu, MenuAction:action, param1, param2)
  26.200 +{
  26.201 +	if (action == MenuAction_End)
  26.202 +	{
  26.203 +		VoteMenuClose();
  26.204 +	}
  26.205 +	else if (action == MenuAction_Display)
  26.206 +	{
  26.207 +	 	decl String:title[64];
  26.208 +		GetMenuTitle(menu, title, sizeof(title));
  26.209 +
  26.210 +	 	decl String:buffer[255];
  26.211 +		Format(buffer, sizeof(buffer), "%T", title, param1, g_voteInfo[VOTE_NAME]);
  26.212 +
  26.213 +		new Handle:panel = Handle:param2;
  26.214 +		SetPanelTitle(panel, buffer);
  26.215 +	}
  26.216 +	else if (action == MenuAction_DisplayItem)
  26.217 +	{
  26.218 +		decl String:display[64];
  26.219 +		GetMenuItem(menu, param2, "", 0, _, display, sizeof(display));
  26.220 +	 
  26.221 +	 	if (strcmp(display, VOTE_NO) == 0 || strcmp(display, VOTE_YES) == 0)
  26.222 +	 	{
  26.223 +			decl String:buffer[255];
  26.224 +			Format(buffer, sizeof(buffer), "%T", display, param1);
  26.225 +
  26.226 +			return RedrawMenuItem(buffer);
  26.227 +		}
  26.228 +	}
  26.229 +	/* else if (action == MenuAction_Select)
  26.230 +	{
  26.231 +		VoteSelect(menu, param1, param2);
  26.232 +	}*/
  26.233 +	else if (action == MenuAction_VoteCancel && param1 == VoteCancel_NoVotes)
  26.234 +	{
  26.235 +		PrintToChatAll("[SM] %t", "No Votes Cast");
  26.236 +	}
  26.237 +	else if (action == MenuAction_VoteEnd)
  26.238 +	{
  26.239 +		decl String:item[64];
  26.240 +		new Float:percent, Float:limit, votes, totalVotes;
  26.241 +
  26.242 +		GetMenuVoteInfo(param2, votes, totalVotes);
  26.243 +		GetMenuItem(menu, param1, item, sizeof(item));
  26.244 +		
  26.245 +		if (strcmp(item, VOTE_NO) == 0 && param1 == 1)
  26.246 +		{
  26.247 +			votes = totalVotes - votes; // Reverse the votes to be in relation to the Yes option.
  26.248 +		}
  26.249 +		
  26.250 +		percent = GetVotePercent(votes, totalVotes);
  26.251 +		
  26.252 +		limit = GetConVarFloat(g_Cvar_Limits[g_voteType]);
  26.253 +		
  26.254 +		/* :TODO: g_voteClient[userid] needs to be checked.
  26.255 +		 */
  26.256 +
  26.257 +		// A multi-argument vote is "always successful", but have to check if its a Yes/No vote.
  26.258 +		if ((strcmp(item, VOTE_YES) == 0 && FloatCompare(percent,limit) < 0 && param1 == 0) || (strcmp(item, VOTE_NO) == 0 && param1 == 1))
  26.259 +		{
  26.260 +			/* :TODO: g_voteClient[userid] should be used here and set to -1 if not applicable.
  26.261 +			 */
  26.262 +			LogAction(-1, -1, "Vote failed.");
  26.263 +			PrintToChatAll("[SM] %t", "Vote Failed", RoundToNearest(100.0*limit), RoundToNearest(100.0*percent), totalVotes);
  26.264 +		}
  26.265 +		else
  26.266 +		{
  26.267 +			PrintToChatAll("[SM] %t", "Vote Successful", RoundToNearest(100.0*percent), totalVotes);
  26.268 +			
  26.269 +			switch (g_voteType)
  26.270 +			{
  26.271 +				case (voteType:gravity):
  26.272 +				{
  26.273 +					PrintToChatAll("[SM] %t", "Cvar changed", "sv_gravity", item);					
  26.274 +					LogAction(-1, -1, "Changing gravity to %s due to vote.", item);
  26.275 +					SetConVarInt(g_Cvar_Gravity, StringToInt(item));
  26.276 +				}
  26.277 +				
  26.278 +				case (voteType:burn):
  26.279 +				{
  26.280 +					PrintToChatAll("[SM] %t", "Set target on fire", "_s", g_voteInfo[VOTE_NAME]);					
  26.281 +					LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote burn successful, igniting \"%L\"", g_voteClient[VOTE_CLIENTID]);
  26.282 +					
  26.283 +					IgniteEntity(g_voteClient[VOTE_CLIENTID], 19.8);	
  26.284 +				}
  26.285 +				
  26.286 +				case (voteType:slay):
  26.287 +				{
  26.288 +					PrintToChatAll("[SM] %t", "Slayed player", g_voteInfo[VOTE_NAME]);					
  26.289 +					LogAction(-1, g_voteClient[VOTE_CLIENTID], "Vote slay successful, slaying \"%L\"", g_voteClient[VOTE_CLIENTID]);
  26.290 +					
  26.291 +					ExtinguishEntity(g_voteClient[VOTE_CLIENTID]);
  26.292 +					ForcePlayerSuicide(g_voteClient[VOTE_CLIENTID]);
  26.293 +				}
  26.294 +				
  26.295 +				case (voteType:alltalk):
  26.296 +				{
  26.297 +					PrintToChatAll("[SM] %t", "Cvar changed", "sv_alltalk", (GetConVarBool(g_Cvar_Alltalk) ? "0" : "1"));
  26.298 +					LogAction(-1, -1, "Changing alltalk to %s due to vote.", (GetConVarBool(g_Cvar_Alltalk) ? "0" : "1"));
  26.299 +					SetConVarBool(g_Cvar_Alltalk, !GetConVarBool(g_Cvar_Alltalk));
  26.300 +				}
  26.301 +				
  26.302 +				case (voteType:ff):
  26.303 +				{
  26.304 +					PrintToChatAll("[SM] %t", "Cvar changed", "mp_friendlyfire", (GetConVarBool(g_Cvar_FF) ? "0" : "1"));
  26.305 +					LogAction(-1, -1, "Changing friendly fire to %s due to vote.", (GetConVarBool(g_Cvar_FF) ? "0" : "1"));
  26.306 +					SetConVarBool(g_Cvar_FF, !GetConVarBool(g_Cvar_FF));
  26.307 +				}				
  26.308 +			}
  26.309 +		}
  26.310 +	}
  26.311 +	
  26.312 +	return 0;
  26.313 +}
  26.314 +
  26.315 +/*
  26.316 +VoteSelect(Handle:menu, param1, param2 = 0)
  26.317 +{
  26.318 +	if (GetConVarInt(g_Cvar_VoteShow) == 1)
  26.319 +	{
  26.320 +		decl String:voter[64], String:junk[64], String:choice[64];
  26.321 +		GetClientName(param1, voter, sizeof(voter));
  26.322 +		GetMenuItem(menu, param2, junk, sizeof(junk), _, choice, sizeof(choice));
  26.323 +		PrintToChatAll("[SM] %T", "Vote Select", LANG_SERVER, voter, choice);
  26.324 +	}
  26.325 +}
  26.326 +*/
  26.327 +
  26.328 +VoteMenuClose()
  26.329 +{
  26.330 +	CloseHandle(g_hVoteMenu);
  26.331 +	g_hVoteMenu = INVALID_HANDLE;
  26.332 +}
  26.333 +
  26.334 +Float:GetVotePercent(votes, totalVotes)
  26.335 +{
  26.336 +	return FloatDiv(float(votes),float(totalVotes));
  26.337 +}
  26.338 +
  26.339 +bool:TestVoteDelay(client)
  26.340 +{
  26.341 + 	new delay = CheckVoteDelay();
  26.342 + 	
  26.343 + 	if (delay > 0)
  26.344 + 	{
  26.345 + 		if (delay > 60)
  26.346 + 		{
  26.347 + 			ReplyToCommand(client, "[SM] %t", "Vote Delay Minutes", delay % 60);
  26.348 + 		}
  26.349 + 		else
  26.350 + 		{
  26.351 + 			ReplyToCommand(client, "[SM] %t", "Vote Delay Seconds", delay);
  26.352 + 		}
  26.353 + 		
  26.354 + 		return false;
  26.355 + 	}
  26.356 + 	
  26.357 +	return true;
  26.358 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/plugins/funvotes/votealltalk.sp	Fri Feb 22 21:01:08 2008 +0000
    27.3 @@ -0,0 +1,104 @@
    27.4 +/**
    27.5 + * vim: set ts=4 :
    27.6 + * =============================================================================
    27.7 + * SourceMod Basefunvotes Plugin
    27.8 + * Provides votealltalk functionality
    27.9 + *
   27.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   27.11 + * =============================================================================
   27.12 + *
   27.13 + * This program is free software; you can redistribute it and/or modify it under
   27.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   27.15 + * Free Software Foundation.
   27.16 + * 
   27.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   27.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   27.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   27.20 + * details.
   27.21 + *
   27.22 + * You should have received a copy of the GNU General Public License along with
   27.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   27.24 + *
   27.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   27.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   27.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   27.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   27.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   27.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   27.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   27.32 + * or <http://www.sourcemod.net/license.php>.
   27.33 + *
   27.34 + * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   27.35 + */
   27.36 +
   27.37 +DisplayVoteAllTalkMenu(client)
   27.38 +{
   27.39 +	if (IsVoteInProgress())
   27.40 +	{
   27.41 +		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
   27.42 +		return;
   27.43 +	}	
   27.44 +	
   27.45 +	if (!TestVoteDelay(client))
   27.46 +	{
   27.47 +		return;
   27.48 +	}
   27.49 +	
   27.50 +	LogAction(client, -1, "\"%L\" initiated an alltalk vote.", client);
   27.51 +	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Alltalk");
   27.52 +	
   27.53 +	g_voteType = voteType:alltalk;
   27.54 +	g_voteInfo[VOTE_NAME][0] = '\0';
   27.55 +
   27.56 +	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   27.57 +	
   27.58 +	if (GetConVarBool(g_Cvar_Alltalk))
   27.59 +	{
   27.60 +		SetMenuTitle(g_hVoteMenu, "Votealltalk Off");
   27.61 +	}
   27.62 +	else
   27.63 +	{
   27.64 +		SetMenuTitle(g_hVoteMenu, "Votealltalk On");
   27.65 +	}
   27.66 +	
   27.67 +	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
   27.68 +	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   27.69 +	SetMenuExitButton(g_hVoteMenu, false);
   27.70 +	VoteMenuToAll(g_hVoteMenu, 20);
   27.71 +}
   27.72 +
   27.73 +
   27.74 +public AdminMenu_VoteAllTalk(Handle:topmenu, 
   27.75 +							  TopMenuAction:action,
   27.76 +							  TopMenuObject:object_id,
   27.77 +							  param,
   27.78 +							  String:buffer[],
   27.79 +							  maxlength)
   27.80 +{
   27.81 +	if (action == TopMenuAction_DisplayOption)
   27.82 +	{
   27.83 +		Format(buffer, maxlength, "%T", "Alltalk vote", param);
   27.84 +	}
   27.85 +	else if (action == TopMenuAction_SelectOption)
   27.86 +	{
   27.87 +		DisplayVoteAllTalkMenu(param);
   27.88 +	}
   27.89 +	else if (action == TopMenuAction_DrawOption)
   27.90 +	{	
   27.91 +		/* disable this option if a vote is already running */
   27.92 +		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   27.93 +	}
   27.94 +}
   27.95 +
   27.96 +public Action:Command_VoteAlltalk(client, args)
   27.97 +{
   27.98 +	if (args > 0)
   27.99 +	{
  27.100 +		ReplyToCommand(client, "[SM] Usage: sm_votealltalk");
  27.101 +		return Plugin_Handled;	
  27.102 +	}
  27.103 +	
  27.104 +	DisplayVoteAllTalkMenu(client);
  27.105 +	
  27.106 +	return Plugin_Handled;
  27.107 +}
  27.108 \ No newline at end of file
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/plugins/funvotes/voteburn.sp	Fri Feb 22 21:01:08 2008 +0000
    28.3 @@ -0,0 +1,178 @@
    28.4 +/**
    28.5 + * vim: set ts=4 :
    28.6 + * =============================================================================
    28.7 + * SourceMod Basefunvotes Plugin
    28.8 + * Provides voteburn functionality
    28.9 + *
   28.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   28.11 + * =============================================================================
   28.12 + *
   28.13 + * This program is free software; you can redistribute it and/or modify it under
   28.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   28.15 + * Free Software Foundation.
   28.16 + * 
   28.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   28.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   28.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   28.20 + * details.
   28.21 + *
   28.22 + * You should have received a copy of the GNU General Public License along with
   28.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   28.24 + *
   28.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   28.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   28.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   28.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   28.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   28.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   28.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   28.32 + * or <http://www.sourcemod.net/license.php>.
   28.33 + *
   28.34 + * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   28.35 + */
   28.36 +
   28.37 +DisplayVoteBurnMenu(client, target, String:name[])
   28.38 +{
   28.39 +	if (!IsPlayerAlive(target))
   28.40 +	{
   28.41 +		ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
   28.42 +		return;
   28.43 +	}
   28.44 +	
   28.45 +	g_voteClient[VOTE_CLIENTID] = target;
   28.46 +	GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
   28.47 +
   28.48 +	LogAction(client, target, "\"%L\" initiated a burn vote against \"%L\"", client, target);
   28.49 +	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Burn", g_voteInfo[VOTE_NAME]);
   28.50 +	
   28.51 +	g_voteType = voteType:burn;
   28.52 +	
   28.53 +	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   28.54 +	SetMenuTitle(g_hVoteMenu, "Voteburn player");
   28.55 +	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
   28.56 +	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   28.57 +	SetMenuExitButton(g_hVoteMenu, false);
   28.58 +	VoteMenuToAll(g_hVoteMenu, 20);
   28.59 +}
   28.60 +
   28.61 +DisplayBurnTargetMenu(client)
   28.62 +{
   28.63 +	new Handle:menu = CreateMenu(MenuHandler_Burn);
   28.64 +	
   28.65 +	decl String:title[100];
   28.66 +	Format(title, sizeof(title), "%T:", "Burn vote", client);
   28.67 +	SetMenuTitle(menu, title);
   28.68 +	SetMenuExitBackButton(menu, true);
   28.69 +	
   28.70 +	AddTargetsToMenu(menu, client, true, true);
   28.71 +	
   28.72 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   28.73 +}
   28.74 +
   28.75 +public AdminMenu_VoteBurn(Handle:topmenu, 
   28.76 +							  TopMenuAction:action,
   28.77 +							  TopMenuObject:object_id,
   28.78 +							  param,
   28.79 +							  String:buffer[],
   28.80 +							  maxlength)
   28.81 +{
   28.82 +	if (action == TopMenuAction_DisplayOption)
   28.83 +	{
   28.84 +		Format(buffer, maxlength, "%T", "Burn vote", param);
   28.85 +	}
   28.86 +	else if (action == TopMenuAction_SelectOption)
   28.87 +	{
   28.88 +		DisplayBurnTargetMenu(param);
   28.89 +	}
   28.90 +	else if (action == TopMenuAction_DrawOption)
   28.91 +	{	
   28.92 +		/* disable this option if a vote is already running */
   28.93 +		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   28.94 +	}
   28.95 +}
   28.96 +
   28.97 +public MenuHandler_Burn(Handle:menu, MenuAction:action, param1, param2)
   28.98 +{
   28.99 +	if (action == MenuAction_End)
  28.100 +	{
  28.101 +		CloseHandle(menu);
  28.102 +	}
  28.103 +	else if (action == MenuAction_Cancel)
  28.104 +	{
  28.105 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  28.106 +		{
  28.107 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  28.108 +		}
  28.109 +	}
  28.110 +	else if (action == MenuAction_Select)
  28.111 +	{
  28.112 +		decl String:info[32], String:name[32];
  28.113 +		new userid, target;
  28.114 +		
  28.115 +		GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
  28.116 +		userid = StringToInt(info);
  28.117 +
  28.118 +		if ((target = GetClientOfUserId(userid)) == 0)
  28.119 +		{
  28.120 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  28.121 +		}
  28.122 +		else if (!CanUserTarget(param1, target))
  28.123 +		{
  28.124 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  28.125 +		}
  28.126 +		else if (!IsPlayerAlive(target))
  28.127 +		{
  28.128 +			PrintToChat(param1, "[SM] %t", "Player has since died");
  28.129 +		}
  28.130 +		else
  28.131 +		{
  28.132 +			DisplayVoteBurnMenu(param1, target, name);
  28.133 +		}
  28.134 +	}
  28.135 +}
  28.136 +
  28.137 +public Action:Command_VoteBurn(client, args)
  28.138 +{
  28.139 +	if (args < 1)
  28.140 +	{
  28.141 +		ReplyToCommand(client, "[SM] Usage: sm_voteburn <player>");
  28.142 +		return Plugin_Handled;	
  28.143 +	}
  28.144 +	
  28.145 +	if (IsVoteInProgress())
  28.146 +	{
  28.147 +		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
  28.148 +		return Plugin_Handled;
  28.149 +	}	
  28.150 +	
  28.151 +	if (!TestVoteDelay(client))
  28.152 +	{
  28.153 +		return Plugin_Handled;
  28.154 +	}
  28.155 +	
  28.156 +	decl String:text[256], String:arg[64];
  28.157 +	GetCmdArgString(text, sizeof(text));
  28.158 +	
  28.159 +	BreakString(text, arg, sizeof(arg));
  28.160 +	
  28.161 +	decl String:target_name[MAX_TARGET_LENGTH];
  28.162 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  28.163 +	
  28.164 +	if ((target_count = ProcessTargetString(
  28.165 +			arg,
  28.166 +			client,
  28.167 +			target_list,
  28.168 +			MAXPLAYERS,
  28.169 +			COMMAND_FILTER_NO_MULTI,
  28.170 +			target_name,
  28.171 +			sizeof(target_name),
  28.172 +			tn_is_ml)) <= 0)
  28.173 +	{
  28.174 +		ReplyToTargetError(client, target_count);
  28.175 +		return Plugin_Handled;
  28.176 +	}
  28.177 +
  28.178 +	DisplayVoteBurnMenu(client, target_list[0], arg);
  28.179 +	
  28.180 +	return Plugin_Handled;
  28.181 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/plugins/funvotes/voteff.sp	Fri Feb 22 21:01:08 2008 +0000
    29.3 @@ -0,0 +1,103 @@
    29.4 +/**
    29.5 + * vim: set ts=4 :
    29.6 + * =============================================================================
    29.7 + * SourceMod Basefunvotes Plugin
    29.8 + * Provides vote ff functionality
    29.9 + *
   29.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   29.11 + * =============================================================================
   29.12 + *
   29.13 + * This program is free software; you can redistribute it and/or modify it under
   29.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   29.15 + * Free Software Foundation.
   29.16 + * 
   29.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   29.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   29.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   29.20 + * details.
   29.21 + *
   29.22 + * You should have received a copy of the GNU General Public License along with
   29.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   29.24 + *
   29.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   29.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   29.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   29.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   29.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   29.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   29.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   29.32 + * or <http://www.sourcemod.net/license.php>.
   29.33 + *
   29.34 + * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   29.35 + */
   29.36 +
   29.37 +DisplayVoteFFMenu(client)
   29.38 +{
   29.39 +	if (IsVoteInProgress())
   29.40 +	{
   29.41 +		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
   29.42 +		return;
   29.43 +	}	
   29.44 +	
   29.45 +	if (!TestVoteDelay(client))
   29.46 +	{
   29.47 +		return;
   29.48 +	}
   29.49 +	
   29.50 +	LogAction(client, -1, "\"%L\" initiated a friendly fire vote.", client);
   29.51 +	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote FF");
   29.52 +	
   29.53 +	g_voteType = voteType:ff;
   29.54 +	g_voteInfo[VOTE_NAME][0] = '\0';
   29.55 +	
   29.56 +	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   29.57 +	
   29.58 +	if (GetConVarBool(g_Cvar_Alltalk))
   29.59 +	{
   29.60 +		SetMenuTitle(g_hVoteMenu, "Voteff Off");
   29.61 +	}
   29.62 +	else
   29.63 +	{
   29.64 +		SetMenuTitle(g_hVoteMenu, "Voteff On");
   29.65 +	}
   29.66 +	
   29.67 +	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
   29.68 +	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   29.69 +	SetMenuExitButton(g_hVoteMenu, false);
   29.70 +	VoteMenuToAll(g_hVoteMenu, 20);
   29.71 +}
   29.72 +
   29.73 +public AdminMenu_VoteFF(Handle:topmenu, 
   29.74 +							  TopMenuAction:action,
   29.75 +							  TopMenuObject:object_id,
   29.76 +							  param,
   29.77 +							  String:buffer[],
   29.78 +							  maxlength)
   29.79 +{
   29.80 +	if (action == TopMenuAction_DisplayOption)
   29.81 +	{
   29.82 +		Format(buffer, maxlength, "%T", "Vote FF", param);
   29.83 +	}
   29.84 +	else if (action == TopMenuAction_SelectOption)
   29.85 +	{
   29.86 +		DisplayVoteFFMenu(param);
   29.87 +	}
   29.88 +	else if (action == TopMenuAction_DrawOption)
   29.89 +	{	
   29.90 +		/* disable this option if a vote is already running */
   29.91 +		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   29.92 +	}
   29.93 +}
   29.94 +
   29.95 +public Action:Command_VoteFF(client, args)
   29.96 +{
   29.97 +	if (args > 0)
   29.98 +	{
   29.99 +		ReplyToCommand(client, "[SM] Usage: sm_voteff");
  29.100 +		return Plugin_Handled;	
  29.101 +	}
  29.102 +	
  29.103 +	DisplayVoteFFMenu(client);
  29.104 +	
  29.105 +	return Plugin_Handled;
  29.106 +}
  29.107 \ No newline at end of file
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/plugins/funvotes/votegravity.sp	Fri Feb 22 21:01:08 2008 +0000
    30.3 @@ -0,0 +1,139 @@
    30.4 +/**
    30.5 + * vim: set ts=4 :
    30.6 + * =============================================================================
    30.7 + * SourceMod Basefunvotes Plugin
    30.8 + * Provides votegravity functionality
    30.9 + *
   30.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   30.11 + * =============================================================================
   30.12 + *
   30.13 + * This program is free software; you can redistribute it and/or modify it under
   30.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   30.15 + * Free Software Foundation.
   30.16 + * 
   30.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   30.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   30.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   30.20 + * details.
   30.21 + *
   30.22 + * You should have received a copy of the GNU General Public License along with
   30.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   30.24 + *
   30.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   30.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   30.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   30.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   30.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   30.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   30.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   30.32 + * or <http://www.sourcemod.net/license.php>.
   30.33 + *
   30.34 + * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   30.35 + */
   30.36 +
   30.37 +
   30.38 +DisplayVoteGravityMenu(client,count,String:items[5][])
   30.39 +{
   30.40 +	LogAction(client, -1, "\"%L\" initiated a gravity vote.", client);
   30.41 +	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Gravity");
   30.42 +	
   30.43 +	g_voteType = voteType:gravity;
   30.44 +	
   30.45 +	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   30.46 +	
   30.47 +	if (count == 1)
   30.48 +	{
   30.49 +		strcopy(g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]), items[0]);
   30.50 +			
   30.51 +		SetMenuTitle(g_hVoteMenu, "Change Gravity To");
   30.52 +		AddMenuItem(g_hVoteMenu, items[0], "Yes");
   30.53 +		AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   30.54 +	}
   30.55 +	else
   30.56 +	{
   30.57 +		g_voteInfo[VOTE_NAME][0] = '\0';
   30.58 +		
   30.59 +		SetMenuTitle(g_hVoteMenu, "Gravity Vote");
   30.60 +		for (new i = 0; i < count; i++)
   30.61 +		{
   30.62 +			AddMenuItem(g_hVoteMenu, items[i], items[i]);
   30.63 +		}	
   30.64 +	}
   30.65 +	
   30.66 +	SetMenuExitButton(g_hVoteMenu, false);
   30.67 +	VoteMenuToAll(g_hVoteMenu, 20);
   30.68 +}
   30.69 +
   30.70 +public AdminMenu_VoteGravity(Handle:topmenu, 
   30.71 +							  TopMenuAction:action,
   30.72 +							  TopMenuObject:object_id,
   30.73 +							  param,
   30.74 +							  String:buffer[],
   30.75 +							  maxlength)
   30.76 +{
   30.77 +	if (action == TopMenuAction_DisplayOption)
   30.78 +	{
   30.79 +		Format(buffer, maxlength, "%T", "Gravity vote", param);
   30.80 +	}
   30.81 +	else if (action == TopMenuAction_SelectOption)
   30.82 +	{
   30.83 +		/* Might need a better way of selecting the list of pre-defined gravity choices */
   30.84 +		new String:items[5][5] ={"200","400","800","1600","3200"};
   30.85 +		DisplayVoteGravityMenu(param,5, items);
   30.86 +	}
   30.87 +	else if (action == TopMenuAction_DrawOption)
   30.88 +	{	
   30.89 +		/* disable this option if a vote is already running */
   30.90 +		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   30.91 +	}
   30.92 +}
   30.93 +
   30.94 +public Action:Command_VoteGravity(client, args)
   30.95 +{
   30.96 +	if (args < 1)
   30.97 +	{
   30.98 +		ReplyToCommand(client, "[SM] Usage: sm_votegravity <amount> [amount2] ... [amount5]");
   30.99 +		return Plugin_Handled;	
  30.100 +	}
  30.101 +	
  30.102 +	if (IsVoteInProgress())
  30.103 +	{
  30.104 +		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
  30.105 +		return Plugin_Handled;
  30.106 +	}
  30.107 +	
  30.108 +	if (!TestVoteDelay(client))
  30.109 +	{
  30.110 +		return Plugin_Handled;
  30.111 +	}
  30.112 +	
  30.113 +	decl String:text[256];
  30.114 +	GetCmdArgString(text, sizeof(text));
  30.115 +
  30.116 +	decl String:items[5][64];
  30.117 +	new count;	
  30.118 +	new len, pos;
  30.119 +	
  30.120 +	while (pos != -1 && count < 5)
  30.121 +	{	
  30.122 +		pos = BreakString(text[len], items[count], sizeof(items[]));
  30.123 +		
  30.124 +		decl Float:temp;
  30.125 +		if (StringToFloatEx(items[count], temp) == 0)
  30.126 +		{
  30.127 +			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
  30.128 +			return Plugin_Handled;
  30.129 +		}		
  30.130 +
  30.131 +		count++;
  30.132 +		
  30.133 +		if (pos != -1)
  30.134 +		{
  30.135 +			len += pos;
  30.136 +		}	
  30.137 +	}
  30.138 +	
  30.139 +	DisplayVoteGravityMenu(client, count, items);
  30.140 +	
  30.141 +	return Plugin_Handled;	
  30.142 +}
  30.143 \ No newline at end of file
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/plugins/funvotes/voteslay.sp	Fri Feb 22 21:01:08 2008 +0000
    31.3 @@ -0,0 +1,179 @@
    31.4 +/**
    31.5 + * vim: set ts=4 :
    31.6 + * =============================================================================
    31.7 + * SourceMod Basefunvotes Plugin
    31.8 + * Provides voteslay functionality
    31.9 + *
   31.10 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   31.11 + * =============================================================================
   31.12 + *
   31.13 + * This program is free software; you can redistribute it and/or modify it under
   31.14 + * the terms of the GNU General Public License, version 3.0, as published by the
   31.15 + * Free Software Foundation.
   31.16 + * 
   31.17 + * This program is distributed in the hope that it will be useful, but WITHOUT
   31.18 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   31.19 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   31.20 + * details.
   31.21 + *
   31.22 + * You should have received a copy of the GNU General Public License along with
   31.23 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   31.24 + *
   31.25 + * As a special exception, AlliedModders LLC gives you permission to link the
   31.26 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   31.27 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   31.28 + * by the Valve Corporation.  You must obey the GNU General Public License in
   31.29 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
   31.30 + * this exception to all derivative works.  AlliedModders LLC defines further
   31.31 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   31.32 + * or <http://www.sourcemod.net/license.php>.
   31.33 + *
   31.34 + * Version: $Id: admin-flatfile.sp 1438 2007-09-16 03:45:06Z dvander $
   31.35 + */
   31.36 +
   31.37 +
   31.38 +DisplayVoteSlayMenu(client, target, String:name[])
   31.39 +{
   31.40 +	if (!IsPlayerAlive(target))
   31.41 +	{
   31.42 +		ReplyToCommand(client, "[SM] %t", "Cannot be performed on dead", name);
   31.43 +		return;
   31.44 +	}
   31.45 +	
   31.46 +	g_voteClient[VOTE_CLIENTID] = target;
   31.47 +	GetClientName(target, g_voteInfo[VOTE_NAME], sizeof(g_voteInfo[]));
   31.48 +
   31.49 +	LogAction(client, target, "\"%L\" initiated a slay vote against \"%L\"", client, target);
   31.50 +	ShowActivity2(client, "[SM] ", "%t", "Initiated Vote Slay", g_voteInfo[VOTE_NAME]);
   31.51 +	
   31.52 +	g_voteType = voteType:slay;
   31.53 +	
   31.54 +	g_hVoteMenu = CreateMenu(Handler_VoteCallback, MenuAction:MENU_ACTIONS_ALL);
   31.55 +	SetMenuTitle(g_hVoteMenu, "Voteslay Player");
   31.56 +	AddMenuItem(g_hVoteMenu, VOTE_YES, "Yes");
   31.57 +	AddMenuItem(g_hVoteMenu, VOTE_NO, "No");
   31.58 +	SetMenuExitButton(g_hVoteMenu, false);
   31.59 +	VoteMenuToAll(g_hVoteMenu, 20);
   31.60 +}
   31.61 +
   31.62 +DisplaySlayTargetMenu(client)
   31.63 +{
   31.64 +	new Handle:menu = CreateMenu(MenuHandler_Slay);
   31.65 +	
   31.66 +	decl String:title[100];
   31.67 +	Format(title, sizeof(title), "%T:", "Slay vote", client);
   31.68 +	SetMenuTitle(menu, title);
   31.69 +	SetMenuExitBackButton(menu, true);
   31.70 +	
   31.71 +	AddTargetsToMenu(menu, client, true, true);
   31.72 +	
   31.73 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   31.74 +}
   31.75 +
   31.76 +public AdminMenu_VoteSlay(Handle:topmenu, 
   31.77 +							  TopMenuAction:action,
   31.78 +							  TopMenuObject:object_id,
   31.79 +							  param,
   31.80 +							  String:buffer[],
   31.81 +							  maxlength)
   31.82 +{
   31.83 +	if (action == TopMenuAction_DisplayOption)
   31.84 +	{
   31.85 +		Format(buffer, maxlength, "%T", "Slay vote", param);
   31.86 +	}
   31.87 +	else if (action == TopMenuAction_SelectOption)
   31.88 +	{
   31.89 +		DisplaySlayTargetMenu(param);
   31.90 +	}
   31.91 +	else if (action == TopMenuAction_DrawOption)
   31.92 +	{	
   31.93 +		/* disable this option if a vote is already running */
   31.94 +		buffer[0] = !IsNewVoteAllowed() ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT;
   31.95 +	}
   31.96 +}
   31.97 +
   31.98 +public MenuHandler_Slay(Handle:menu, MenuAction:action, param1, param2)
   31.99 +{
  31.100 +	if (action == MenuAction_End)
  31.101 +	{
  31.102 +		CloseHandle(menu);
  31.103 +	}
  31.104 +	else if (action == MenuAction_Cancel)
  31.105 +	{
  31.106 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
  31.107 +		{
  31.108 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
  31.109 +		}
  31.110 +	}
  31.111 +	else if (action == MenuAction_Select)
  31.112 +	{
  31.113 +		decl String:info[32], String:name[32];
  31.114 +		new userid, target;
  31.115 +		
  31.116 +		GetMenuItem(menu, param2, info, sizeof(info), _, name, sizeof(name));
  31.117 +		userid = StringToInt(info);
  31.118 +
  31.119 +		if ((target = GetClientOfUserId(userid)) == 0)
  31.120 +		{
  31.121 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
  31.122 +		}
  31.123 +		else if (!CanUserTarget(param1, target))
  31.124 +		{
  31.125 +			PrintToChat(param1, "[SM] %t", "Unable to target");
  31.126 +		}
  31.127 +		else if (!IsPlayerAlive(target))
  31.128 +		{
  31.129 +			PrintToChat(param1, "[SM] %t", "Player has since died");
  31.130 +		}
  31.131 +		else
  31.132 +		{
  31.133 +			DisplayVoteSlayMenu(param1, target, name);
  31.134 +		}
  31.135 +	}
  31.136 +}
  31.137 +
  31.138 +public Action:Command_VoteSlay(client, args)
  31.139 +{
  31.140 +	if (args < 1)
  31.141 +	{
  31.142 +		ReplyToCommand(client, "[SM] Usage: sm_voteslay <player>");
  31.143 +		return Plugin_Handled;	
  31.144 +	}
  31.145 +	
  31.146 +	if (IsVoteInProgress())
  31.147 +	{
  31.148 +		ReplyToCommand(client, "[SM] %t", "Vote in Progress");
  31.149 +		return Plugin_Handled;
  31.150 +	}	
  31.151 +	
  31.152 +	if (!TestVoteDelay(client))
  31.153 +	{
  31.154 +		return Plugin_Handled;
  31.155 +	}
  31.156 +	
  31.157 +	decl String:text[256], String:arg[64];
  31.158 +	GetCmdArgString(text, sizeof(text));
  31.159 +	
  31.160 +	BreakString(text, arg, sizeof(arg));
  31.161 +	
  31.162 +	decl String:target_name[MAX_TARGET_LENGTH];
  31.163 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
  31.164 +	
  31.165 +	if ((target_count = ProcessTargetString(
  31.166 +			arg,
  31.167 +			client,
  31.168 +			target_list,
  31.169 +			MAXPLAYERS,
  31.170 +			COMMAND_FILTER_NO_MULTI,
  31.171 +			target_name,
  31.172 +			sizeof(target_name),
  31.173 +			tn_is_ml)) <= 0)
  31.174 +	{
  31.175 +		ReplyToTargetError(client, target_count);
  31.176 +		return Plugin_Handled;
  31.177 +	}
  31.178 +
  31.179 +	DisplayVoteSlayMenu(client, target_list[0], arg);
  31.180 +	
  31.181 +	return Plugin_Handled;
  31.182 +}
    32.1 --- a/plugins/include/helpers.inc	Fri Feb 22 19:22:22 2008 +0000
    32.2 +++ b/plugins/include/helpers.inc	Fri Feb 22 21:01:08 2008 +0000
    32.3 @@ -202,6 +202,10 @@
    32.4  }
    32.5  
    32.6  /**
    32.7 + * This function is no longer supported.  It has been replaced with ReadMapList(), 
    32.8 + * which uses a more unified caching and configuration mechanism.  This function also 
    32.9 + * has a bug where if the cvar contents changes, the fileTime change won't be recognized.
   32.10 + * 
   32.11   * Loads a specified array with maps. The maps will be either loaded from mapcyclefile, or if supplied
   32.12   * a cvar containing a file name. If the file in the cvar is bad, it will use mapcyclefile. The fileTime
   32.13   * parameter is used to store a timestamp of the file. If specified, the file will only be reloaded if it
   32.14 @@ -210,8 +214,9 @@
   32.15   * @param array		Valid array handle, should be created with CreateArray(33) or larger. 
   32.16   * @param fileTime	Variable containing the "last changed" time of the file. Used to avoid needless reloading.
   32.17   * @param fileCvar	CVAR set to the file to be loaded. Optional.
   32.18 - * @return		Number of maps loaded or 0 if in error.
   32.19 + * @return			Number of maps loaded or 0 if in error.
   32.20   */
   32.21 +#pragma deprecated Use ReadMapList() instead. 
   32.22   stock LoadMaps(Handle:array, &fileTime = 0, Handle:fileCvar = INVALID_HANDLE)
   32.23   { 
   32.24   	decl String:mapPath[256], String:mapFile[64];
    33.1 --- a/plugins/mapchooser.sp	Fri Feb 22 19:22:22 2008 +0000
    33.2 +++ b/plugins/mapchooser.sp	Fri Feb 22 21:01:08 2008 +0000
    33.3 @@ -56,7 +56,6 @@
    33.4  new Handle:g_Cvar_ExtendTimeStep = INVALID_HANDLE;
    33.5  new Handle:g_Cvar_ExtendRoundStep = INVALID_HANDLE;
    33.6  new Handle:g_Cvar_ExtendFragStep = INVALID_HANDLE;
    33.7 -new Handle:g_Cvar_Mapfile = INVALID_HANDLE;
    33.8  new Handle:g_Cvar_ExcludeMaps = INVALID_HANDLE;
    33.9  new Handle:g_Cvar_IncludeMaps = INVALID_HANDLE;
   33.10  new Handle:g_Cvar_NoVoteMode = INVALID_HANDLE;
   33.11 @@ -74,7 +73,7 @@
   33.12  new g_Extends;
   33.13  new g_TotalRounds;
   33.14  new bool:g_HasVoteStarted;
   33.15 -new g_mapFileTime;
   33.16 +new g_mapFileSerial = -1;
   33.17  
   33.18  #define VOTE_EXTEND "##extend##"
   33.19  
   33.20 @@ -93,7 +92,6 @@
   33.21  	g_Cvar_ExtendTimeStep = CreateConVar("sm_extendmap_timestep", "15", "Specifies how much many more minutes each extension makes", _, true, 5.0);
   33.22  	g_Cvar_ExtendRoundStep = CreateConVar("sm_extendmap_roundstep", "5", "Specifies how many more rounds each extension makes", _, true, 5.0);
   33.23  	g_Cvar_ExtendFragStep = CreateConVar("sm_extendmap_fragstep", "10", "Specifies how many more frags are allowed when map is extended.", _, true, 5.0);	
   33.24 -	g_Cvar_Mapfile = CreateConVar("sm_mapvote_file", "configs/maps.ini", "Map file to use. (Def sourcemod/configs/maps.ini)");
   33.25  	g_Cvar_ExcludeMaps = CreateConVar("sm_mapvote_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
   33.26  	g_Cvar_IncludeMaps = CreateConVar("sm_mapvote_include", "5", "Specifies how many maps to include in the vote.", _, true, 2.0, true, 6.0);
   33.27  	g_Cvar_NoVoteMode = CreateConVar("sm_mapvote_novote", "1", "Specifies whether or not MapChooser should pick a map if no votes are received.", _, true, 0.0, true, 1.0);
   33.28 @@ -128,13 +126,23 @@
   33.29  		SetFailState("sm_nextmap not found");
   33.30  	}
   33.31  	
   33.32 -	if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_Mapfile))
   33.33 +	if (ReadMapList(g_MapList,
   33.34 +					 g_mapFileSerial, 
   33.35 +					 "mapchooser",
   33.36 +					 MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
   33.37 +		!= INVALID_HANDLE)
   33.38 +		
   33.39  	{
   33.40 -		CreateNextVote();
   33.41 -		SetupTimeleftTimer();
   33.42 -		SetConVarString(g_Cvar_Nextmap, "Pending Vote");
   33.43 +		if (g_mapFileSerial == -1)
   33.44 +		{
   33.45 +			LogError("Unable to create a valid map list.");
   33.46 +		}
   33.47  	}
   33.48  	
   33.49 +	CreateNextVote();
   33.50 +	SetupTimeleftTimer();
   33.51 +	SetConVarString(g_Cvar_Nextmap, "Pending Vote");
   33.52 +	
   33.53  	if (g_TeamScores != INVALID_HANDLE)
   33.54  	{
   33.55  		CloseHandle(g_TeamScores);
    34.1 --- a/plugins/randomcycle.sp	Fri Feb 22 19:22:22 2008 +0000
    34.2 +++ b/plugins/randomcycle.sp	Fri Feb 22 21:01:08 2008 +0000
    34.3 @@ -44,12 +44,11 @@
    34.4  };
    34.5  
    34.6  new Handle:g_Cvar_Nextmap = INVALID_HANDLE;
    34.7 -new Handle:g_Cvar_Mapfile = INVALID_HANDLE;
    34.8  new Handle:g_Cvar_ExcludeMaps = INVALID_HANDLE;
    34.9  
   34.10  new Handle:g_MapList = INVALID_HANDLE;
   34.11  new Handle:g_OldMapList = INVALID_HANDLE;
   34.12 -new g_mapFileTime;
   34.13 +new g_mapListSerial = -1;
   34.14  
   34.15  public OnPluginStart()
   34.16  {
   34.17 @@ -57,7 +56,6 @@
   34.18  	g_MapList = CreateArray(arraySize);
   34.19  	g_OldMapList = CreateArray(arraySize);
   34.20  
   34.21 -	g_Cvar_Mapfile = CreateConVar("sm_randomcycle_file", "configs/maps.ini", "Map file to use. (Def sourcemod/configs/maps.ini)");
   34.22  	g_Cvar_ExcludeMaps = CreateConVar("sm_randomcycle_exclude", "5", "Specifies how many past maps to exclude from the vote.", _, true, 0.0);
   34.23  	
   34.24  	AutoExecConfig(true, "randomcycle");
   34.25 @@ -73,10 +71,19 @@
   34.26  		SetFailState("sm_nextmap not found");
   34.27  	}
   34.28  	
   34.29 -	if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_Mapfile))
   34.30 +	if (ReadMapList(g_MapList, 
   34.31 +					g_mapListSerial, 
   34.32 +					"randomcycle", 
   34.33 +					MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
   34.34 +		== INVALID_HANDLE)
   34.35  	{
   34.36 -		CreateTimer(5.0, Timer_RandomizeNextmap); // Small delay to give Nextmap time to complete OnMapStart()
   34.37 +		if (g_mapListSerial == -1)
   34.38 +		{
   34.39 +			LogError("Unable to create a valid map list.");
   34.40 +		}
   34.41  	}
   34.42 +	
   34.43 +	CreateTimer(5.0, Timer_RandomizeNextmap); // Small delay to give Nextmap time to complete OnMapStart()
   34.44  }
   34.45  
   34.46  public Action:Timer_RandomizeNextmap(Handle:timer)
    35.1 --- a/plugins/rockthevote.sp	Fri Feb 22 19:22:22 2008 +0000
    35.2 +++ b/plugins/rockthevote.sp	Fri Feb 22 21:01:08 2008 +0000
    35.3 @@ -1,93 +1,91 @@
    35.4 -/**
    35.5 - * vim: set ts=4 :
    35.6 - * =============================================================================
    35.7 - * SourceMod Rock The Vote Plugin
    35.8 - * Creates a map vote when the required number of players have requested one.
    35.9 - *
   35.10 - * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   35.11 - * =============================================================================
   35.12 - *
   35.13 - * This program is free software; you can redistribute it and/or modify it under
   35.14 - * the terms of the GNU General Public License, version 3.0, as published by the
   35.15 - * Free Software Foundation.
   35.16 - * 
   35.17 - * This program is distributed in the hope that it will be useful, but WITHOUT
   35.18 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   35.19 - * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   35.20 - * details.
   35.21 - *
   35.22 - * You should have received a copy of the GNU General Public License along with
   35.23 - * this program.  If not, see <http://www.gnu.org/licenses/>.
   35.24 - *
   35.25 - * As a special exception, AlliedModders LLC gives you permission to link the
   35.26 - * code of this program (as well as its derivative works) to "Half-Life 2," the
   35.27 - * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   35.28 - * by the Valve Corporation.  You must obey the GNU General Public License in
   35.29 - * all respects for all other code used.  Additionally, AlliedModders LLC grants
   35.30 - * this exception to all derivative works.  AlliedModders LLC defines further
   35.31 - * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
   35.32 - * or <http://www.sourcemod.net/license.php>.
   35.33 - *
   35.34 - * Version: $Id$
   35.35 - */
   35.36 -
   35.37 -#include <sourcemod>
   35.38 -
   35.39 -#pragma semicolon 1
   35.40 -
   35.41 -public Plugin:myinfo =
   35.42 -{
   35.43 -	name = "Rock The Vote",
   35.44 -	author = "AlliedModders LLC",
   35.45 -	description = "Provides RTV Map Voting",
   35.46 -	version = SOURCEMOD_VERSION,
   35.47 -	url = "http://www.sourcemod.net/"
   35.48 -};
   35.49 -
   35.50 -new Handle:g_Cvar_Needed = INVALID_HANDLE;
   35.51 -new Handle:g_Cvar_File = INVALID_HANDLE;
   35.52 -new Handle:g_Cvar_Maps = INVALID_HANDLE;
   35.53 -new Handle:g_Cvar_Nominate = INVALID_HANDLE;
   35.54 -new Handle:g_Cvar_MinPlayers = INVALID_HANDLE;
   35.55 -
   35.56 -new Handle:g_MapList = INVALID_HANDLE;
   35.57 -new Handle:g_RTVMapList = INVALID_HANDLE;
   35.58 -new Handle:g_MapMenu = INVALID_HANDLE;
   35.59 -new Handle:g_RetryTimer = INVALID_HANDLE;
   35.60 -new g_mapFileTime;
   35.61 -
   35.62 -new bool:g_CanRTV = false;		// True if RTV loaded maps and is active.
   35.63 -new bool:g_RTVAllowed = false;	// True if RTV is available to players. Used to delay rtv votes.
   35.64 -new bool:g_RTVStarted = false;	// Indicates that the actual map vote has started
   35.65 -new bool:g_RTVEnded = false;	// Indicates that the actual map vote has concluded
   35.66 -new g_Voters = 0;				// Total voters connected. Doesn't include fake clients.
   35.67 -new g_Votes = 0;				// Total number of "say rtv" votes
   35.68 -new g_VotesNeeded = 0;			// Necessary votes before map vote begins. (voters * percent_needed)
   35.69 -new bool:g_Voted[MAXPLAYERS+1] = {false, ...};
   35.70 -new bool:g_Nominated[MAXPLAYERS+1] = {false, ...};
   35.71 -
   35.72 -public OnPluginStart()
   35.73 -{
   35.74 -	LoadTranslations("common.phrases");
   35.75 +/**
   35.76 + * vim: set ts=4 :
   35.77 + * =============================================================================
   35.78 + * SourceMod Rock The Vote Plugin
   35.79 + * Creates a map vote when the required number of players have requested one.
   35.80 + *
   35.81 + * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
   35.82 + * =============================================================================
   35.83 + *
   35.84 + * This program is free software; you can redistribute it and/or modify it under
   35.85 + * the terms of the GNU General Public License, version 3.0, as published by the
   35.86 + * Free Software Foundation.
   35.87 + * 
   35.88 + * This program is distributed in the hope that it will be useful, but WITHOUT
   35.89 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
   35.90 + * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
   35.91 + * details.
   35.92 + *
   35.93 + * You should have received a copy of the GNU General Public License along with
   35.94 + * this program.  If not, see <http://www.gnu.org/licenses/>.
   35.95 + *
   35.96 + * As a special exception, AlliedModders LLC gives you permission to link the
   35.97 + * code of this program (as well as its derivative works) to "Half-Life 2," the
   35.98 + * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
   35.99 + * by the Valve Corporation.  You must obey the GNU General Public License in
  35.100 + * all respects for all other code used.  Additionally, AlliedModders LLC grants
  35.101 + * this exception to all derivative works.  AlliedModders LLC defines further
  35.102 + * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
  35.103 + * or <http://www.sourcemod.net/license.php>.
  35.104 + *
  35.105 + * Version: $Id$
  35.106 + */
  35.107 +
  35.108 +#include <sourcemod>
  35.109 +
  35.110 +#pragma semicolon 1
  35.111 +
  35.112 +public Plugin:myinfo =
  35.113 +{
  35.114 +	name = "Rock The Vote",
  35.115 +	author = "AlliedModders LLC",
  35.116 +	description = "Provides RTV Map Voting",
  35.117 +	version = SOURCEMOD_VERSION,
  35.118 +	url = "http://www.sourcemod.net/"
  35.119 +};
  35.120 +
  35.121 +new Handle:g_Cvar_Needed = INVALID_HANDLE;
  35.122 +new Handle:g_Cvar_Maps = INVALID_HANDLE;
  35.123 +new Handle:g_Cvar_Nominate = INVALID_HANDLE;
  35.124 +new Handle:g_Cvar_MinPlayers = INVALID_HANDLE;
  35.125 +
  35.126 +new Handle:g_MapList = INVALID_HANDLE;
  35.127 +new Handle:g_RTVMapList = INVALID_HANDLE;
  35.128 +new Handle:g_MapMenu = INVALID_HANDLE;
  35.129 +new Handle:g_RetryTimer = INVALID_HANDLE;
  35.130 +new g_mapFileSerial = -1;
  35.131 +
  35.132 +new bool:g_CanRTV = false;		// True if RTV loaded maps and is active.
  35.133 +new bool:g_RTVAllowed = false;	// True if RTV is available to players. Used to delay rtv votes.
  35.134 +new bool:g_RTVStarted = false;	// Indicates that the actual map vote has started
  35.135 +new bool:g_RTVEnded = false;	// Indicates that the actual map vote has concluded
  35.136 +new g_Voters = 0;				// Total voters connected. Doesn't include fake clients.
  35.137 +new g_Votes = 0;				// Total number of "say rtv" votes
  35.138 +new g_VotesNeeded = 0;			// Necessary votes before map vote begins. (voters * percent_needed)
  35.139 +new bool:g_Voted[MAXPLAYERS+1] = {false, ...};
  35.140 +new bool:g_Nominated[MAXPLAYERS+1] = {false, ...};
  35.141 +
  35.142 +public OnPluginStart()
  35.143 +{
  35.144 +	LoadTranslations("common.phrases");
  35.145  	LoadTranslations("rockthevote.phrases");
  35.146  	
  35.147  	new arraySize = ByteCountToCells(33);	
  35.148  	g_MapList = CreateArray(arraySize);
  35.149 -	g_RTVMapList = CreateArray(arraySize);
  35.150 -	
  35.151 -	g_Cvar_Needed = CreateConVar("sm_rtv_needed", "0.60", "Percentage of players needed to rockthevote (Def 60%)", 0, true, 0.05, true, 1.0);
  35.152 -	g_Cvar_File = CreateConVar("sm_rtv_file", "configs/maps.ini", "Map file to use. (Def configs/maps.ini)");
  35.153 -	g_Cvar_Maps = CreateConVar("sm_rtv_maps", "4", "Number of maps to be voted on. 2 to 6. (Def 4)", 0, true, 2.0, true, 6.0);
  35.154 -	g_Cvar_Nominate = CreateConVar("sm_rtv_nominate", "1", "Enables nomination system.", 0, true, 0.0, true, 1.0);
  35.155 -	g_Cvar_MinPlayers = CreateConVar("sm_rtv_minplayers", "0", "Number of players required before RTV will be enabled.", 0, true, 0.0, true, float(MAXPLAYERS));
  35.156 -	
  35.157 -	RegConsoleCmd("say", Command_Say);
  35.158 -	RegConsoleCmd("say_team", Command_Say);
  35.159 -	
  35.160 +	g_RTVMapList = CreateArray(arraySize);
  35.161 +	
  35.162 +	g_Cvar_Needed = CreateConVar("sm_rtv_needed", "0.60", "Percentage of players needed to rockthevote (Def 60%)", 0, true, 0.05, true, 1.0);
  35.163 +	g_Cvar_Maps = CreateConVar("sm_rtv_maps", "4", "Number of maps to be voted on. 2 to 6. (Def 4)", 0, true, 2.0, true, 6.0);
  35.164 +	g_Cvar_Nominate = CreateConVar("sm_rtv_nominate", "1", "Enables nomination system.", 0, true, 0.0, true, 1.0);
  35.165 +	g_Cvar_MinPlayers = CreateConVar("sm_rtv_minplayers", "0", "Number of players required before RTV will be enabled.", 0, true, 0.0, true, float(MAXPLAYERS));
  35.166 +	
  35.167 +	RegConsoleCmd("say", Command_Say);
  35.168 +	RegConsoleCmd("say_team", Command_Say);
  35.169 +	
  35.170  	RegAdminCmd("sm_rtv_addmap", Command_Addmap, ADMFLAG_CHANGEMAP, "sm_rtv_addmap <mapname> - Forces a map to be on the RTV, and lowers the allowed nominations.");
  35.171  	
  35.172 -	AutoExecConfig(true, "rtv");
  35.173 -}
  35.174 +	AutoExecConfig(true, "rtv");
  35.175 +}
  35.176  
  35.177  public OnMapStart()
  35.178  {
  35.179 @@ -97,13 +95,13 @@
  35.180  	g_RTVStarted = false;
  35.181  	g_RTVEnded = false;
  35.182  }
  35.183 -
  35.184 -public OnMapEnd()
  35.185 +
  35.186 +public OnMapEnd()
  35.187  {
  35.188 -	g_CanRTV = false;	
  35.189 -	g_RTVAllowed = false;
  35.190 -}
  35.191 -
  35.192 +	g_CanRTV = false;	
  35.193 +	g_RTVAllowed = false;
  35.194 +}
  35.195 +
  35.196  public OnConfigsExecuted()
  35.197  {
  35.198  	if (g_RTVMapList != INVALID_HANDLE)
  35.199 @@ -111,239 +109,248 @@
  35.200  		ClearArray(g_RTVMapList);
  35.201  	}
  35.202  	
  35.203 -	if (LoadMaps(g_MapList, g_mapFileTime, g_Cvar_File))
  35.204 +	if (ReadMapList(g_MapList,
  35.205 +					g_mapFileSerial,
  35.206 +					"rockthevote",
  35.207 +					MAPLIST_FLAG_CLEARARRAY|MAPLIST_FLAG_MAPSFOLDER)
  35.208 +		== INVALID_HANDLE)
  35.209  	{
  35.210 -		BuildMapMenu();
  35.211 -		g_CanRTV = true;
  35.212 -		CreateTimer(30.0, Timer_DelayRTV);
  35.213 +		if (g_mapFileSerial == -1)
  35.214 +		{
  35.215 +			LogError("Unable to create a valid map list.");
  35.216 +		}
  35.217  	}
  35.218 +	
  35.219 +	BuildMapMenu();
  35.220 +	g_CanRTV = true;
  35.221 +	CreateTimer(30.0, Timer_DelayRTV);
  35.222  }
  35.223 -
  35.224 -public bool:OnClientConnect(client, String:rejectmsg[], maxlen)
  35.225 -{
  35.226 -	if(!g_CanRTV || IsFakeClient(client))
  35.227 -		return true;
  35.228 -	
  35.229 -	g_Voted[client] = false;
  35.230 -	g_Nominated[client] = false;
  35.231 -
  35.232 -	g_Voters++;
  35.233 -	g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
  35.234 -	
  35.235 -	return true;
  35.236 -}
  35.237 -
  35.238 -public OnClientDisconnect(client)
  35.239 -{
  35.240 -	if(!g_CanRTV || IsFakeClient(client))
  35.241 -		return;
  35.242 -	
  35.243 -	if(g_Voted[client])
  35.244 -	{
  35.245 -		g_Votes--;
  35.246 -	}
  35.247 -	
  35.248 -	g_Voters--;
  35.249 +
  35.250 +public bool:OnClientConnect(client, String:rejectmsg[], maxlen)
  35.251 +{
  35.252 +	if(!g_CanRTV || IsFakeClient(client))
  35.253 +		return true;
  35.254 +	
  35.255 +	g_Voted[client] = false;
  35.256 +	g_Nominated[client] = false;
  35.257 +
  35.258 +	g_Voters++;
  35.259 +	g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
  35.260 +	
  35.261 +	return true;
  35.262 +}
  35.263 +
  35.264 +public OnClientDisconnect(client)
  35.265 +{
  35.266 +	if(!g_CanRTV || IsFakeClient(client))
  35.267 +		return;
  35.268  	
  35.269 -	g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
  35.270 -	
  35.271 -	if (g_Votes && g_Voters && g_Votes >= g_VotesNeeded && g_RTVAllowed && !g_RTVStarted) 
  35.272 +	if(g_Voted[client])
  35.273 +	{
  35.274 +		g_Votes--;
  35.275 +	}
  35.276 +	
  35.277 +	g_Voters--;
  35.278 +	
  35.279 +	g_VotesNeeded = RoundToFloor(float(g_Voters) * GetConVarFloat(g_Cvar_Needed));
  35.280 +	
  35.281 +	if (g_Votes && g_Voters && g_Votes >= g_VotesNeeded && g_RTVAllowed && !g_RTVStarted) 
  35.282  	{
  35.283 -		g_RTVStarted = true;
  35.284 -		CreateTimer(2.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
  35.285 -	}	
  35.286 -}
  35.287 -
  35.288 -public Action:Command_Addmap(client, args)
  35.289 -{
  35.290 -	if (args < 1)
  35.291 -	{
  35.292 -		ReplyToCommand(client, "[SM] Usage: sm_rtv_addmap <mapname>");
  35.293 -		return Plugin_Handled;
  35.294 +		g_RTVStarted = true;
  35.295 +		CreateTimer(2.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
  35.296 +	}	
  35.297 +}
  35.298 +
  35.299 +public Action:Command_Addmap(client, args)
  35.300 +{
  35.301 +	if (args < 1)
  35.302 +	{
  35.303 +		ReplyToCommand(client, "[SM] Usage: sm_rtv_addmap <mapname>");
  35.304 +		return Plugin_Handled;
  35.305  	}
  35.306  	
  35.307  	if (!g_CanRTV)
  35.308  	{
  35.309  		ReplyToCommand(client, "[SM] RockTheVote is not available.");
  35.310  		return Plugin_Handled;
  35.311 -	}
  35.312 -	
  35.313 -	decl String:mapname[64];
  35.314 -	GetCmdArg(1, mapname, sizeof(mapname));
  35.315 -
  35.316 -	if (FindStringInArray(g_MapList, mapname) == -1)
  35.317 -	{
  35.318 -		ReplyToCommand(client, "%t", "Map was not found", mapname);
  35.319 -		return Plugin_Handled;
  35.320 -	}
  35.321 -	
  35.322 -	if (GetArraySize(g_RTVMapList) > 0)
  35.323 +	}
  35.324 +	
  35.325 +	decl String:mapname[64];
  35.326 +	GetCmdArg(1, mapname, sizeof(mapname));
  35.327 +
  35.328 +	if (FindStringInArray(g_MapList, mapname) == -1)
  35.329 +	{
  35.330 +		ReplyToCommand(client, "%t", "Map was not found", mapname);
  35.331 +		return Plugin_Handled;
  35.332 +	}
  35.333 +	
  35.334 +	if (GetArraySize(g_RTVMapList) > 0)
  35.335  	{
  35.336  		if (FindStringInArray(g_RTVMapList, mapname) != -1)
  35.337  		{
  35.338  			ReplyToCommand(client, "%t", "Map Already In Vote", mapname);
  35.339  			return Plugin_Handled;				
  35.340 -		}
  35.341 -		
  35.342 -		ShiftArrayUp(g_RTVMapList, 0);
  35.343 -		SetArrayString(g_RTVMapList, 0, mapname);
  35.344 -		
  35.345 -		while (GetArraySize(g_RTVMapList) > GetConVarInt(g_Cvar_Maps))
  35.346 -		{
  35.347 -			RemoveFromArray(g_RTVMapList, GetConVarInt(g_Cvar_Maps));
  35.348 -		}
  35.349 -	}
  35.350 -	else
  35.351 -	{
  35.352 -		PushArrayString(g_RTVMapList, mapname);
  35.353 -	}
  35.354 -		
  35.355 -	decl String:item[64];
  35.356 -	for (new i = 0; i < GetMenuItemCount(g_MapMenu); i++)
  35.357 -	{
  35.358 -		GetMenuItem(g_MapMenu, i, item, sizeof(item));
  35.359 -		if (strcmp(item, mapname) == 0)
  35.360 -		{
  35.361 -			RemoveMenuItem(g_MapMenu, i);
  35.362 -			break;
  35.363 -		}			
  35.364 -	}	
  35.365 -	
  35.366 -	ReplyToCommand(client, "%t", "Map Inserted", mapname);
  35.367 -	LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname);
  35.368 -
  35.369 -	return Plugin_Handled;		
  35.370 -}
  35.371 -
  35.372 -public Action:Command_Say(client, args)
  35.373 -{
  35.374 +		}
  35.375 +		
  35.376 +		ShiftArrayUp(g_RTVMapList, 0);
  35.377 +		SetArrayString(g_RTVMapList, 0, mapname);
  35.378 +		
  35.379 +		while (GetArraySize(g_RTVMapList) > GetConVarInt(g_Cvar_Maps))
  35.380 +		{
  35.381 +			RemoveFromArray(g_RTVMapList, GetConVarInt(g_Cvar_Maps));
  35.382 +		}
  35.383 +	}
  35.384 +	else
  35.385 +	{
  35.386 +		PushArrayString(g_RTVMapList, mapname);
  35.387 +	}
  35.388 +		
  35.389 +	decl String:item[64];
  35.390 +	for (new i = 0; i < GetMenuItemCount(g_MapMenu); i++)
  35.391 +	{
  35.392 +		GetMenuItem(g_MapMenu, i, item, sizeof(item));
  35.393 +		if (strcmp(item, mapname) == 0)
  35.394 +		{
  35.395 +			RemoveMenuItem(g_MapMenu, i);
  35.396 +			break;
  35.397 +		}			
  35.398 +	}	
  35.399 +	
  35.400 +	ReplyToCommand(client, "%t", "Map Inserted", mapname);
  35.401 +	LogAction(client, -1, "\"%L\" inserted map \"%s\".", client, mapname);
  35.402 +
  35.403 +	return Plugin_Handled;		
  35.404 +}
  35.405 +
  35.406 +public Action:Command_Say(client, args)
  35.407 +{
  35.408  	if (!g_CanRTV || !client)
  35.409 -	{
  35.410 +	{
  35.411 +		return Plugin_Continue;
  35.412 +	}
  35.413 +
  35.414 +	decl String:text[192];
  35.415 +	if (!GetCmdArgString(text, sizeof(text)))
  35.416 +	{
  35.417  		return Plugin_Continue;
  35.418 -	}
  35.419 -
  35.420 -	decl String:text[192];
  35.421 -	if (!GetCmdArgString(text, sizeof(text)))
  35.422 -	{
  35.423 -		return Plugin_Continue;
  35.424 -	}
  35.425 -	
  35.426 -	new startidx = 0;
  35.427 -	if(text[strlen(text)-1] == '"')
  35.428 -	{
  35.429 -		text[strlen(text)-1] = '\0';
  35.430 -		startidx = 1;
  35.431 -	}
  35.432 -	
  35.433 -	if (strcmp(text[startidx], "rtv", false) == 0 || strcmp(text[startidx], "rockthevote", false) == 0)
  35.434 -	{
  35.435 -		if (!g_RTVAllowed)
  35.436 -		{
  35.437 -			PrintToChat(client, "[SM] %t", "RTV Not Allowed");
  35.438 -			return Plugin_Continue;
  35.439 -		}
  35.440 -		
  35.441 -		if (g_RTVEnded)
  35.442 -		{
  35.443 -			PrintToChat(client, "[SM] %t", "RTV Ended");
  35.444 -			return Plugin_Continue;
  35.445 -		}
  35.446 -		
  35.447 -		if (g_RTVStarted)
  35.448 -		{
  35.449 -			PrintToChat(client, "[SM] %t", "RTV Started");
  35.450 -			return Plugin_Continue;
  35.451 -		}
  35.452 -		
  35.453 -		if (GetClientCount(true) < GetConVarInt(g_Cvar_MinPlayers) && g_Votes == 0) // Should we keep checking g_Votes here?
  35.454 -		{
  35.455 -			PrintToChat(client, "[SM] %t", "Minimal Players Not Met");
  35.456 -			return Plugin_Continue;			
  35.457 -		}
  35.458 -		
  35.459 -		if (g_Voted[client])
  35.460 -		{
  35.461 -			PrintToChat(client, "[SM] %t", "Already Voted");
  35.462 -			return Plugin_Continue;
  35.463 -		}	
  35.464 -		
  35.465 -		new String:name[64];
  35.466 -		GetClientName(client, name, sizeof(name));
  35.467 -		
  35.468 -		g_Votes++;
  35.469 -		g_Voted[client] = true;
  35.470 -		
  35.471 -		PrintToChatAll("[SM] %t", "RTV Requested", name, g_Votes, g_VotesNeeded);
  35.472 -		
  35.473 -		if (g_Votes >= g_VotesNeeded)
  35.474 +	}
  35.475 +	
  35.476 +	new startidx = 0;
  35.477 +	if(text[strlen(text)-1] == '"')
  35.478 +	{
  35.479 +		text[strlen(text)-1] = '\0';
  35.480 +		startidx = 1;
  35.481 +	}
  35.482 +	
  35.483 +	if (strcmp(text[startidx], "rtv", false) == 0 || strcmp(text[startidx], "rockthevote", false) == 0)
  35.484 +	{
  35.485 +		if (!g_RTVAllowed)
  35.486 +		{
  35.487 +			PrintToChat(client, "[SM] %t", "RTV Not Allowed");
  35.488 +			return Plugin_Continue;
  35.489 +		}
  35.490 +		
  35.491 +		if (g_RTVEnded)
  35.492 +		{
  35.493 +			PrintToChat(client, "[SM] %t", "RTV Ended");
  35.494 +			return Plugin_Continue;
  35.495 +		}
  35.496 +		
  35.497 +		if (g_RTVStarted)
  35.498 +		{
  35.499 +			PrintToChat(client, "[SM] %t", "RTV Started");
  35.500 +			return Plugin_Continue;
  35.501 +		}
  35.502 +		
  35.503 +		if (GetClientCount(true) < GetConVarInt(g_Cvar_MinPlayers) && g_Votes == 0) // Should we keep checking g_Votes here?
  35.504 +		{
  35.505 +			PrintToChat(client, "[SM] %t", "Minimal Players Not Met");
  35.506 +			return Plugin_Continue;			
  35.507 +		}
  35.508 +		
  35.509 +		if (g_Voted[client])
  35.510  		{
  35.511 -			g_RTVStarted = true;
  35.512 -			CreateTimer(2.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
  35.513 -		}
  35.514 -	}
  35.515 -	else if (GetConVarBool(g_Cvar_Nominate) && strcmp(text[startidx], "nominate", false) == 0)
  35.516 -	{
  35.517 -		if (g_RTVEnded)
  35.518 -		{
  35.519 -			PrintToChat(client, "[SM] %t", "RTV Ended");
  35.520 -			return Plugin_Continue;
  35.521 -		}		
  35.522 -		
  35.523 -		if (g_RTVStarted)
  35.524 -		{
  35.525 -			PrintToChat(client, "[SM] %t", "RTV Started");
  35.526 -			return Plugin_Continue;
  35.527 -		}
  35.528 -		
  35.529 -		if (g_Nominated[client])
  35.530 -		{
  35.531 -			PrintToChat(client, "[SM] %t", "Already Nominated");
  35.532 -			return Plugin_Continue;
  35.533 -		}
  35.534 -		
  35.535 -		if (GetArraySize(g_RTVMapList) >= GetConVarInt(g_Cvar_Maps))
  35.536 -		{
  35.537 -			PrintToChat(client, "[SM] %t", "Max Nominations");
  35.538 -			return Plugin_Continue;			
  35.539 -		}
  35.540 -		
  35.541 -		DisplayMenu(g_MapMenu, client, MENU_TIME_FOREVER);		
  35.542 -	}
  35.543 -	
  35.544 -	return Plugin_Continue;	
  35.545 -}
  35.546 -
  35.547 -public Action:Timer_DelayRTV(Handle:timer)
  35.548 -{
  35.549 +			PrintToChat(client, "[SM] %t", "Already Voted");
  35.550 +			return Plugin_Continue;
  35.551 +		}	
  35.552 +		
  35.553 +		new String:name[64];
  35.554 +		GetClientName(client, name, sizeof(name));
  35.555 +		
  35.556 +		g_Votes++;
  35.557 +		g_Voted[client] = true;
  35.558 +		
  35.559 +		PrintToChatAll("[SM] %t", "RTV Requested", name, g_Votes, g_VotesNeeded);
  35.560 +		
  35.561 +		if (g_Votes >= g_VotesNeeded)
  35.562 +		{
  35.563 +			g_RTVStarted = true;
  35.564 +			CreateTimer(2.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
  35.565 +		}
  35.566 +	}
  35.567 +	else if (GetConVarBool(g_Cvar_Nominate) && strcmp(text[startidx], "nominate", false) == 0)
  35.568 +	{
  35.569 +		if (g_RTVEnded)
  35.570 +		{
  35.571 +			PrintToChat(client, "[SM] %t", "RTV Ended");
  35.572 +			return Plugin_Continue;
  35.573 +		}		
  35.574 +		
  35.575 +		if (g_RTVStarted)
  35.576 +		{
  35.577 +			PrintToChat(client, "[SM] %t", "RTV Started");
  35.578 +			return Plugin_Continue;
  35.579 +		}
  35.580 +		
  35.581 +		if (g_Nominated[client])
  35.582 +		{
  35.583 +			PrintToChat(client, "[SM] %t", "Already Nominated");
  35.584 +			return Plugin_Continue;
  35.585 +		}
  35.586 +		
  35.587 +		if (GetArraySize(g_RTVMapList) >= GetConVarInt(g_Cvar_Maps))
  35.588 +		{
  35.589 +			PrintToChat(client, "[SM] %t", "Max Nominations");
  35.590 +			return Plugin_Continue;			
  35.591 +		}
  35.592 +		
  35.593 +		DisplayMenu(g_MapMenu, client, MENU_TIME_FOREVER);		
  35.594 +	}
  35.595 +	
  35.596 +	return Plugin_Continue;	
  35.597 +}
  35.598 +
  35.599 +public Action:Timer_DelayRTV(Handle:timer)
  35.600 +{
  35.601  	g_RTVAllowed = true;
  35.602  	g_RTVStarted = false;
  35.603 -	g_RTVEnded = false;	
  35.604 -}
  35.605 -
  35.606 -public Action:Timer_StartRTV(Handle:timer)
  35.607 -{
  35.608 -	if (timer == g_RetryTimer)
  35.609 -	{
  35.610 -		g_RetryTimer = INVALID_HANDLE;
  35.611 -	}
  35.612 -	
  35.613 -	if (g_RetryTimer != INVALID_HANDLE)
  35.614 -	{
  35.615 -		return;
  35.616 -	}
  35.617 -
  35.618 -	if (IsVoteInProgress())
  35.619 -	{
  35.620 -		// Can't start a vote, try again in 5 seconds.
  35.621 -		g_RetryTimer = CreateTimer(5.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
  35.622 -		return;
  35.623 -	}			
  35.624 -	
  35.625 -	PrintToChatAll("[SM] %t", "RTV Vote Ready");
  35.626 -		
  35.627 -	new Handle:MapVoteMenu = CreateMenu(Handler_MapMapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
  35.628 -	SetMenuTitle(MapVoteMenu, "Rock The Vote");
  35.629 -	
  35.630 +	g_RTVEnded = false;	
  35.631 +}
  35.632 +
  35.633 +public Action:Timer_StartRTV(Handle:timer)
  35.634 +{
  35.635 +	if (timer == g_RetryTimer)
  35.636 +	{
  35.637 +		g_RetryTimer = INVALID_HANDLE;
  35.638 +	}
  35.639 +	
  35.640 +	if (g_RetryTimer != INVALID_HANDLE)
  35.641 +	{
  35.642 +		return;
  35.643 +	}
  35.644 +
  35.645 +	if (IsVoteInProgress())
  35.646 +	{
  35.647 +		// Can't start a vote, try again in 5 seconds.
  35.648 +		g_RetryTimer = CreateTimer(5.0, Timer_StartRTV, TIMER_FLAG_NO_MAPCHANGE);
  35.649 +		return;
  35.650 +	}			
  35.651 +	
  35.652 +	PrintToChatAll("[SM] %t", "RTV Vote Ready");
  35.653 +		
  35.654 +	new Handle:MapVoteMenu = CreateMenu(Handler_MapMapVoteMenu, MenuAction:MENU_ACTIONS_ALL);
  35.655 +	SetMenuTitle(MapVoteMenu, "Rock The Vote");
  35.656 +	
  35.657  	new Handle:tempMaps  = CloneArray(g_MapList);
  35.658  	decl String:map[32];
  35.659  
  35.660 @@ -383,44 +390,44 @@
  35.661  	}	
  35.662  	
  35.663  	CloseHandle(tempMaps);
  35.664 -	
  35.665 -	AddMenuItem(MapVoteMenu, "Don't Change", "Don't Change");
  35.666 -		
  35.667 -	SetMenuExitButton(MapVoteMenu, false);
  35.668 -	VoteMenuToAll(MapVoteMenu, 20);
  35.669 -		
  35.670 -	LogMessage("[SM] Rockthevote was successfully started.");
  35.671 -}
  35.672 -
  35.673 -public Action:Timer_ChangeMap(Handle:hTimer, Handle:dp)
  35.674 -{
  35.675 -	new String:map[65];
  35.676 -	
  35.677 -	ResetPack(dp);
  35.678 -	ReadPackString(dp, map, sizeof(map));
  35.679 -	
  35.680 -	ServerCommand("changelevel \"%s\"", map);
  35.681 -	
  35.682 -	return Plugin_Stop;
  35.683 -}
  35.684 -
  35.685 -public Handler_MapMapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
  35.686 -{
  35.687 -	switch (action)
  35.688 -	{
  35.689 -		case MenuAction_End:
  35.690 -		{
  35.691 -			CloseHandle(menu);
  35.692 -		}
  35.693 -		
  35.694 -		case MenuAction_Display:
  35.695 -		{
  35.696 +	
  35.697 +	AddMenuItem(MapVoteMenu, "Don't Change", "Don't Change");
  35.698 +		
  35.699 +	SetMenuExitButton(MapVoteMenu, false);
  35.700 +	VoteMenuToAll(MapVoteMenu, 20);
  35.701 +		
  35.702 +	LogMessage("[SM] Rockthevote was successfully started.");
  35.703 +}
  35.704 +
  35.705 +public Action:Timer_ChangeMap(Handle:hTimer, Handle:dp)
  35.706 +{
  35.707 +	new String:map[65];
  35.708 +	
  35.709 +	ResetPack(dp);
  35.710 +	ReadPackString(dp, map, sizeof(map));
  35.711 +	
  35.712 +	ServerCommand("changelevel \"%s\"", map);
  35.713 +	
  35.714 +	return Plugin_Stop;
  35.715 +}
  35.716 +
  35.717 +public Handler_MapMapVoteMenu(Handle:menu, MenuAction:action, param1, param2)
  35.718 +{
  35.719 +	switch (action)
  35.720 +	{
  35.721 +		case MenuAction_End:
  35.722 +		{
  35.723 +			CloseHandle(menu);
  35.724 +		}
  35.725 +		
  35.726 +		case MenuAction_Display:
  35.727 +		{
  35.728  	 		decl String:oldTitle[255], String:buffer[255];
  35.729 -			GetMenuTitle(menu, oldTitle, sizeof(oldTitle));
  35.730 -			Format(buffer, sizeof(buffer), "%T", oldTitle, param1);
  35.731 -
  35.732 -			new Handle:panel = Handle:param2;
  35.733 -			SetPanelTitle(panel, buffer);
  35.734 +			GetMenuTitle(menu, oldTitle, sizeof(oldTitle));
  35.735 +			Format(buffer, sizeof(buffer), "%T", oldTitle, param1);
  35.736 +
  35.737 +			new Handle:panel = Handle:param2;
  35.738 +			SetPanelTitle(panel, buffer);
  35.739  		}
  35.740  		
  35.741  		case MenuAction_DisplayItem:
  35.742 @@ -431,105 +438,105 @@
  35.743  				Format(buffer, sizeof(buffer), "%T", "Don't Change", param1);
  35.744  				return RedrawMenuItem(buffer);
  35.745  			}
  35.746 -		}		
  35.747 -
  35.748 -		// Why am I commented out? Because BAIL hasn't decided yet if
  35.749 -		// vote notification will be built into the Vote API.
  35.750 -		/*case MenuAction_Select:
  35.751 -		{
  35.752 -			decl String:Name[32], String:Map[32];
  35.753 -			GetClientName(param1, Name, sizeof(Name));
  35.754 -			GetMenuItem(menu, param2, Map, sizeof(Map));
  35.755 -
  35.756 -			PrintToChatAll("[SM] %s has voted for map '%s'", Name, Map);
  35.757 -		}*/
  35.758 -		
  35.759 -		case MenuAction_VoteCancel:
  35.760 -		{
  35.761 -			if (param1 == VoteCancel_NoVotes)
  35.762 -			{
  35.763 +		}		
  35.764 +
  35.765 +		// Why am I commented out? Because BAIL hasn't decided yet if
  35.766 +		// vote notification will be built into the Vote API.
  35.767 +		/*case MenuAction_Select:
  35.768 +		{
  35.769 +			decl String:Name[32], String:Map[32];
  35.770 +			GetClientName(param1, Name, sizeof(Name));
  35.771 +			GetMenuItem(menu, param2, Map, sizeof(Map));
  35.772 +
  35.773 +			PrintToChatAll("[SM] %s has voted for map '%s'", Name, Map);
  35.774 +		}*/
  35.775 +		
  35.776 +		case MenuAction_VoteCancel:
  35.777 +		{
  35.778 +			if (param1 == VoteCancel_NoVotes)
  35.779 +			{
  35.780  				PrintToChatAll("[SM] %t", "No Votes");
  35.781 -				g_RTVEnded = true;
  35.782 -			}
  35.783 -		}
  35.784 -
  35.785 -		case MenuAction_VoteEnd:
  35.786 -		{
  35.787 -			new String:map[64];
  35.788 -			
  35.789 -			GetMenuItem(menu, param1, map, sizeof(map));
  35.790 -			
  35.791 -			if (GetMenuItemCount(menu) - 1 == param1) // This should always match the "Keep Current" option
  35.792 -			{
  35.793 -				PrintToChatAll("[SM] %t", "Current Map Stays");
  35.794 -				LogMessage("[SM] Rockthevote has ended, current map kept.");
  35.795 -			}
  35.796 -			else
  35.797 -			{
  35.798 -				PrintToChatAll("[SM] %t", "Changing Maps", map);
  35.799 -				LogMessage("[SM] Rockthevote has ended, changing to map %s.", map);
  35.800 -				new Handle:dp;
  35.801 -				CreateDataTimer(5.0, Timer_ChangeMap, dp);
  35.802 -				WritePackString(dp, map);
  35.803 -			}
  35.804 -			
  35.805 -			g_RTVEnded = true;
  35.806 -		}
  35.807 +				g_RTVEnded = true;
  35.808 +			}
  35.809 +		}
  35.810 +
  35.811 +		case MenuAction_VoteEnd:
  35.812 +		{
  35.813 +			new String:map[64];
  35.814 +			
  35.815 +			GetMenuItem(menu, param1, map, sizeof(map));
  35.816 +			
  35.817 +			if (GetMenuItemCount(menu) - 1 == param1) // This should always match the "Keep Current" option
  35.818 +			{
  35.819 +				PrintToChatAll("[SM] %t", "Current Map Stays");
  35.820 +				LogMessage("[SM] Rockthevote has ended, current map kept.");
  35.821 +			}
  35.822 +			else
  35.823 +			{
  35.824 +				PrintToChatAll("[SM] %t", "Changing Maps", map);
  35.825 +				LogMessage("[SM] Rockthevote has ended, changing to map %s.", map);
  35.826 +				new Handle:dp;
  35.827 +				CreateDataTimer(5.0, Timer_ChangeMap, dp);
  35.828 +				WritePackString(dp, map);
  35.829 +			}
  35.830 +			
  35.831 +			g_RTVEnded = true;
  35.832 +		}
  35.833  	}
  35.834  	
  35.835 -	return 0;
  35.836 -}
  35.837 -
  35.838 -public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2)
  35.839 -{
  35.840 -	switch (action)
  35.841 -	{
  35.842 -		case MenuAction_Select:
  35.843 -		{
  35.844 -			if (GetArraySize(g_RTVMapList) >= GetConVarInt(g_Cvar_Maps)) 
  35.845 -			{
  35.846 -				PrintToChat(param1, "[SM] %t", "Max Nominations");
  35.847 -				return;	
  35.848 -			}
  35.849 -			
  35.850 -			decl String:map[64], String:name[64];
  35.851 -			GetMenuItem(menu, param2, map, sizeof(map));
  35.852 -			
  35.853 -			if (FindStringInArray(g_RTVMapList, map) != -1)
  35.854 -			{
  35.855 -				PrintToChat(param1, "[SM] %t", "Map Already Nominated");
  35.856 -				return;
  35.857 -			}
  35.858 -			
  35.859 -			GetClientName(param1, name, 64);
  35.860 -
  35.861 -			PushArrayString(g_RTVMapList, map);
  35.862 -			RemoveMenuItem(menu, param2);
  35.863 -			
  35.864 -			g_Nominated[param1] = true;
  35.865 -			
  35.866 -			PrintToChatAll("[SM] %t", "Map Nominated", name, map);
  35.867 -		}
  35.868 -	}
  35.869 -}
  35.870 -
  35.871 -BuildMapMenu()
  35.872 -{
  35.873 -	if (g_MapMenu != INVALID_HANDLE)
  35.874 -	{
  35.875 -		CloseHandle(g_MapMenu);
  35.876 -		g_MapMenu = INVALID_HANDLE;
  35.877 -	}
  35.878 -	
  35.879 -	g_MapMenu = CreateMenu(Handler_MapSelectMenu);
  35.880 -	SetMenuTitle(g_MapMenu, "%t", "Nominate Title");
  35.881 -
  35.882 -	decl String:map[64];		
  35.883 -	for (new i = 0; i < GetArraySize(g_MapList); i++)
  35.884 -	{
  35.885 -		GetArrayString(g_MapList, i, map, sizeof(map));
  35.886 -		AddMenuItem(g_MapMenu, map, map);
  35.887 -	}
  35.888 -	
  35.889 -	SetMenuExitButton(g_MapMenu, false);
  35.890 +	return 0;
  35.891 +}
  35.892 +
  35.893 +public Handler_MapSelectMenu(Handle:menu, MenuAction:action, param1, param2)
  35.894 +{
  35.895 +	switch (action)
  35.896 +	{
  35.897 +		case MenuAction_Select:
  35.898 +		{
  35.899 +			if (GetArraySize(g_RTVMapList) >= GetConVarInt(g_Cvar_Maps)) 
  35.900 +			{
  35.901 +				PrintToChat(param1, "[SM] %t", "Max Nominations");
  35.902 +				return;	
  35.903 +			}
  35.904 +			
  35.905 +			decl String:map[64], String:name[64];
  35.906 +			GetMenuItem(menu, param2, map, sizeof(map));
  35.907 +			
  35.908 +			if (FindStringInArray(g_RTVMapList, map) != -1)
  35.909 +			{
  35.910 +				PrintToChat(param1, "[SM] %t", "Map Already Nominated");
  35.911 +				return;
  35.912 +			}
  35.913 +			
  35.914 +			GetClientName(param1, name, 64);
  35.915 +
  35.916 +			PushArrayString(g_RTVMapList, map);
  35.917 +			RemoveMenuItem(menu, param2);
  35.918 +			
  35.919 +			g_Nominated[param1] = true;
  35.920 +			
  35.921 +			PrintToChatAll("[SM] %t", "Map Nominated", name, map);
  35.922 +		}
  35.923 +	}
  35.924 +}
  35.925 +
  35.926 +BuildMapMenu()
  35.927 +{
  35.928 +	if (g_MapMenu != INVALID_HANDLE)
  35.929 +	{
  35.930 +		CloseHandle(g_MapMenu);
  35.931 +		g_MapMenu = INVALID_HANDLE;
  35.932 +	}
  35.933 +	
  35.934 +	g_MapMenu = CreateMenu(Handler_MapSelectMenu);
  35.935 +	SetMenuTitle(g_MapMenu, "%t", "Nominate Title");
  35.936 +
  35.937 +	decl String:map[64];		
  35.938 +	for (new i = 0; i < GetArraySize(g_MapList); i++)
  35.939 +	{
  35.940 +		GetArrayString(g_MapList, i, map, sizeof(map));
  35.941 +		AddMenuItem(g_MapMenu, map, map);
  35.942 +	}
  35.943 +	
  35.944 +	SetMenuExitButton(g_MapMenu, false);
  35.945  }
  35.946 \ No newline at end of file