Added sm_blind, sm_drug, sm_gravity, sm_noclip
authorMichael McKoy <ferret99gt@gmail.com>
Mon Dec 24 00:45:28 2007 +0000 (2007-12-24)
changeset 1821214e212a8c04
parent 1820 8e1bbd65f7c2
child 1822 cb4bb315da60
Added sm_blind, sm_drug, sm_gravity, sm_noclip
Fixed the duration of sm_freeze when used from the menu
plugins/basefuncommands.sp
plugins/basefuncommands/blind.sp
plugins/basefuncommands/drug.sp
plugins/basefuncommands/gravity.sp
plugins/basefuncommands/ice.sp
plugins/basefuncommands/noclip.sp
translations/basefuncommands.phrases.txt
     1.1 --- a/plugins/basefuncommands.sp	Mon Dec 24 00:44:48 2007 +0000
     1.2 +++ b/plugins/basefuncommands.sp	Mon Dec 24 00:45:28 2007 +0000
     1.3 @@ -47,6 +47,23 @@
     1.4  	url = "http://www.sourcemod.net/"
     1.5  };
     1.6  
     1.7 +// -------------------------------------------------------------------------------
     1.8 +// Set any of these to 0 and recompile to completely disable those commands
     1.9 +// -------------------------------------------------------------------------------
    1.10 +#define BEACON		1
    1.11 +#define TIMEBOMB	1
    1.12 +#define FIRE		1
    1.13 +#define ICE			1
    1.14 +#define GRAVITY		1
    1.15 +#define BLIND		1
    1.16 +#define NOCLIP		1
    1.17 +#define DRUG		1
    1.18 +#define TELEPORT	1
    1.19 +#define HEALTH		1
    1.20 +#define COLORS		1
    1.21 +#define CASH		1
    1.22 +// -------------------------------------------------------------------------------
    1.23 +
    1.24  new Handle:hTopMenu = INVALID_HANDLE;
    1.25  
    1.26  // Sounds
    1.27 @@ -71,34 +88,77 @@
    1.28  new whiteColor[4] = {255, 255, 255, 255};
    1.29  new greyColor[4] = {128, 128, 128, 255};
    1.30  
    1.31 -// Used for some trace rays.
    1.32 -/*
    1.33 -new g_FilteredEntity = -1;
    1.34 -public bool:TR_Filter_Client(ent, contentMask)
    1.35 -{
    1.36 -   return (ent == g_FilteredEntity) ? false : true;
    1.37 -}
    1.38 -*/
    1.39 +// UserMessageId for Fade.
    1.40 +new UserMsg:g_FadeUserMsgId;
    1.41  
    1.42  // Include various commands and supporting functions
    1.43 +#if BEACON
    1.44  #include "basefuncommands/beacon.sp"
    1.45 +#endif
    1.46 +#if TIMEBOMB
    1.47  #include "basefuncommands/timebomb.sp"
    1.48 +#endif
    1.49 +#if FIRE
    1.50  #include "basefuncommands/fire.sp"
    1.51 +#endif
    1.52 +#if ICE
    1.53  #include "basefuncommands/ice.sp"
    1.54 +#endif
    1.55 +#if GRAVITY
    1.56 +#include "basefuncommands/gravity.sp"
    1.57 +#endif
    1.58 +#if BLIND
    1.59 +#include "basefuncommands/blind.sp"
    1.60 +#endif
    1.61 +#if NOCLIP
    1.62 +#include "basefuncommands/noclip.sp"
    1.63 +#endif
    1.64 +#if DRUG
    1.65 +#include "basefuncommands/drug.sp"
    1.66 +#endif
    1.67  
    1.68  public OnPluginStart()
    1.69  {
    1.70  	LoadTranslations("common.phrases");
    1.71  	LoadTranslations("basefuncommands.phrases");
    1.72  
    1.73 +	g_FadeUserMsgId = GetUserMessageId("Fade");
    1.74 +	
    1.75  	RegAdminCmd("sm_play", Command_Play, ADMFLAG_GENERIC, "sm_play <#userid|name> <filename>");
    1.76  
    1.77  	HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);	
    1.78  
    1.79 +	#if BEACON
    1.80  	SetupBeacon();		// sm_beacon
    1.81 +	#endif
    1.82 +	
    1.83 +	#if TIMEBOMB
    1.84  	SetupTimeBomb();	// sm_timebomb
    1.85 +	#endif
    1.86 +	
    1.87 +	#if FIRE
    1.88  	SetupFire();		// sm_burn and sm_firebomb
    1.89 +	#endif
    1.90 +	
    1.91 +	#if ICE
    1.92  	SetupIce();			// sm_freeze and sm_freezebomb
    1.93 +	#endif
    1.94 +	
    1.95 +	#if GRAVITY
    1.96 +	SetupGravity();		// sm_gravity
    1.97 +	#endif
    1.98 +	
    1.99 +	#if BLIND
   1.100 +	SetupBlind();		// sm_blind
   1.101 +	#endif
   1.102 +	
   1.103 +	#if NOCLIP
   1.104 +	SetupNoClip();		// sm_noclip
   1.105 +	#endif
   1.106 +	
   1.107 +	#if DRUG
   1.108 +	SetupDrugs();		// sm_drug
   1.109 +	#endif
   1.110  	
   1.111  	AutoExecConfig(true, "funcommands");
   1.112  	
   1.113 @@ -127,18 +187,40 @@
   1.114  
   1.115  public OnMapEnd()
   1.116  {
   1.117 +	#if BEACON
   1.118  	KillAllBeacons();
   1.119 +	#endif
   1.120 +	#if TIMEBOMB
   1.121  	KillAllTimeBombs();
   1.122 +	#endif
   1.123 +	#if FIRE
   1.124  	KillAllFireBombs();
   1.125 +	#endif
   1.126 +	#if ICE
   1.127  	KillAllFreezes();
   1.128 +	#endif
   1.129 +	#if DRUG
   1.130 +	KillAllDrugs();
   1.131 +	#endif
   1.132  }
   1.133  
   1.134  public Action:Event_RoundEnd(Handle:event,const String:name[],bool:dontBroadcast)
   1.135  {
   1.136 +	#if BEACON
   1.137  	KillAllBeacons();
   1.138 +	#endif
   1.139 +	#if TIMEBOMB
   1.140  	KillAllTimeBombs();
   1.141 +	#endif
   1.142 +	#if FIRE
   1.143  	KillAllFireBombs();
   1.144 +	#endif
   1.145 +	#if ICE
   1.146  	KillAllFreezes();
   1.147 +	#endif
   1.148 +	#if DRUG
   1.149 +	KillAllDrugs();
   1.150 +	#endif
   1.151  	
   1.152  	return Plugin_Handled;
   1.153  }
   1.154 @@ -159,6 +241,7 @@
   1.155  
   1.156  	if (player_commands != INVALID_TOPMENUOBJECT)
   1.157  	{
   1.158 +		#if BEACON
   1.159  		AddToTopMenu(hTopMenu,
   1.160  			"sm_beacon",
   1.161  			TopMenuObject_Item,
   1.162 @@ -166,7 +249,19 @@
   1.163  			player_commands,
   1.164  			"sm_beacon",
   1.165  			ADMFLAG_SLAY);
   1.166 +		#endif
   1.167  		
   1.168 +		#if TIMEBOMB
   1.169 +		AddToTopMenu(hTopMenu,
   1.170 +			"sm_timebomb",
   1.171 +			TopMenuObject_Item,
   1.172 +			AdminMenu_TimeBomb,
   1.173 +			player_commands,
   1.174 +			"sm_timebomb",
   1.175 +			ADMFLAG_SLAY);
   1.176 +		#endif
   1.177 +		
   1.178 +		#if FIRE
   1.179  		AddToTopMenu(hTopMenu,
   1.180  			"sm_burn",
   1.181  			TopMenuObject_Item,
   1.182 @@ -176,28 +271,22 @@
   1.183  			ADMFLAG_SLAY);
   1.184  			
   1.185  		AddToTopMenu(hTopMenu,
   1.186 +			"sm_firebomb",
   1.187 +			TopMenuObject_Item,
   1.188 +			AdminMenu_FireBomb,
   1.189 +			player_commands,
   1.190 +			"sm_firebomb",
   1.191 +			ADMFLAG_SLAY);
   1.192 +		#endif
   1.193 +		
   1.194 +		#if ICE
   1.195 +		AddToTopMenu(hTopMenu,
   1.196  			"sm_freeze",
   1.197  			TopMenuObject_Item,
   1.198  			AdminMenu_Freeze,
   1.199  			player_commands,
   1.200  			"sm_freeze",
   1.201  			ADMFLAG_SLAY);
   1.202 -
   1.203 -		AddToTopMenu(hTopMenu,
   1.204 -			"sm_timebomb",
   1.205 -			TopMenuObject_Item,
   1.206 -			AdminMenu_TimeBomb,
   1.207 -			player_commands,
   1.208 -			"sm_timebomb",
   1.209 -			ADMFLAG_SLAY);	
   1.210 -			
   1.211 -		AddToTopMenu(hTopMenu,
   1.212 -			"sm_firebomb",
   1.213 -			TopMenuObject_Item,
   1.214 -			AdminMenu_FireBomb,
   1.215 -			player_commands,
   1.216 -			"sm_firebomb",
   1.217 -			ADMFLAG_SLAY);
   1.218  			
   1.219  		AddToTopMenu(hTopMenu,
   1.220  			"sm_freezebomb",
   1.221 @@ -206,6 +295,47 @@
   1.222  			player_commands,
   1.223  			"sm_freezebomb",
   1.224  			ADMFLAG_SLAY);
   1.225 +		#endif
   1.226 +			
   1.227 +		#if GRAVITY
   1.228 +		AddToTopMenu(hTopMenu,
   1.229 +			"sm_gravity",
   1.230 +			TopMenuObject_Item,
   1.231 +			AdminMenu_Gravity,
   1.232 +			player_commands,
   1.233 +			"sm_gravity",
   1.234 +			ADMFLAG_SLAY);
   1.235 +		#endif
   1.236 +			
   1.237 +		#if BLIND
   1.238 +		AddToTopMenu(hTopMenu,
   1.239 +			"sm_blind",
   1.240 +			TopMenuObject_Item,
   1.241 +			AdminMenu_Blind,
   1.242 +			player_commands,
   1.243 +			"sm_blind",
   1.244 +			ADMFLAG_SLAY);
   1.245 +		#endif
   1.246 +		
   1.247 +		#if NOCLIP
   1.248 +		AddToTopMenu(hTopMenu,
   1.249 +			"sm_noclip",
   1.250 +			TopMenuObject_Item,
   1.251 +			AdminMenu_NoClip,
   1.252 +			player_commands,
   1.253 +			"sm_noclip",
   1.254 +			ADMFLAG_SLAY);
   1.255 +		#endif
   1.256 +		
   1.257 +		#if DRUG
   1.258 +		AddToTopMenu(hTopMenu,
   1.259 +			"sm_drug",
   1.260 +			TopMenuObject_Item,
   1.261 +			AdminMenu_Drug,
   1.262 +			player_commands,
   1.263 +			"sm_drug",
   1.264 +			ADMFLAG_SLAY);
   1.265 +		#endif		
   1.266  	}
   1.267  }
   1.268  
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/plugins/basefuncommands/blind.sp	Mon Dec 24 00:45:28 2007 +0000
     2.3 @@ -0,0 +1,279 @@
     2.4 +/**
     2.5 + * vim: set ts=4 :
     2.6 + * =============================================================================
     2.7 + * SourceMod Basefuncommands Plugin
     2.8 + * Provides blind functionality
     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 +new g_BlindTarget[MAXPLAYERS+1];
    2.38 +
    2.39 +SetupBlind()
    2.40 +{
    2.41 +	RegAdminCmd("sm_blind", Command_Blind, ADMFLAG_SLAY, "sm_blind <#userid|name> [amount] - Leave amount off to reset.");
    2.42 +}
    2.43 +
    2.44 +PerformBlind(client, target, amount)
    2.45 +{
    2.46 +	new targets[2];
    2.47 +	targets[0] = target;
    2.48 +	
    2.49 +	new Handle:message = StartMessageEx(g_FadeUserMsgId, targets, 1);
    2.50 +	BfWriteShort(message, 1536);
    2.51 +	BfWriteShort(message, 1536);
    2.52 +	
    2.53 +	if (amount == 0)
    2.54 +	{
    2.55 +		BfWriteShort(message, (0x0001 | 0x0010));
    2.56 +	}
    2.57 +	else
    2.58 +	{
    2.59 +		BfWriteShort(message, (0x0002 | 0x0008));
    2.60 +	}
    2.61 +	
    2.62 +	BfWriteByte(message, 0);
    2.63 +	BfWriteByte(message, 0);
    2.64 +	BfWriteByte(message, 0);
    2.65 +	BfWriteByte(message, amount);
    2.66 +	
    2.67 +	EndMessage();
    2.68 +
    2.69 +	LogAction(client, target, "\"%L\" set blind on \"%L\", amount %d.", client, target, amount);
    2.70 +}
    2.71 +
    2.72 +public AdminMenu_Blind(Handle:topmenu, 
    2.73 +					  TopMenuAction:action,
    2.74 +					  TopMenuObject:object_id,
    2.75 +					  param,
    2.76 +					  String:buffer[],
    2.77 +					  maxlength)
    2.78 +{
    2.79 +	if (action == TopMenuAction_DisplayOption)
    2.80 +	{
    2.81 +		Format(buffer, maxlength, "%T", "Blind player", param);
    2.82 +	}
    2.83 +	else if (action == TopMenuAction_SelectOption)
    2.84 +	{
    2.85 +		DisplayBlindMenu(param);
    2.86 +	}
    2.87 +	else if (action == TopMenuAction_DrawOption)
    2.88 +	{	
    2.89 +		// Disable if we could not find the user message id for Fade.
    2.90 +		buffer[0] = ((g_FadeUserMsgId == INVALID_MESSAGE_ID) ? ITEMDRAW_IGNORE : ITEMDRAW_DEFAULT);
    2.91 +	}	
    2.92 +}
    2.93 +
    2.94 +DisplayBlindMenu(client)
    2.95 +{
    2.96 +	new Handle:menu = CreateMenu(MenuHandler_Blind);
    2.97 +	
    2.98 +	decl String:title[100];
    2.99 +	Format(title, sizeof(title), "%T:", "Blind player", client);
   2.100 +	SetMenuTitle(menu, title);
   2.101 +	SetMenuExitBackButton(menu, true);
   2.102 +	
   2.103 +	AddTargetsToMenu(menu, client, true, true);
   2.104 +	
   2.105 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   2.106 +}
   2.107 +
   2.108 +DisplayAmountMenu(client)
   2.109 +{
   2.110 +	new Handle:menu = CreateMenu(MenuHandler_Amount);
   2.111 +	
   2.112 +	decl String:title[100];
   2.113 +	Format(title, sizeof(title), "%T:", "Blind amount", client);
   2.114 +	SetMenuTitle(menu, title);
   2.115 +	SetMenuExitBackButton(menu, true);
   2.116 +	
   2.117 +	AddMenuItem(menu, "255", "Fully blind");
   2.118 +	AddMenuItem(menu, "240", "Half blind");
   2.119 +	AddMenuItem(menu, "0", "No blind");
   2.120 +	
   2.121 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   2.122 +}
   2.123 +
   2.124 +public MenuHandler_Blind(Handle:menu, MenuAction:action, param1, param2)
   2.125 +{
   2.126 +	if (action == MenuAction_End)
   2.127 +	{
   2.128 +		CloseHandle(menu);
   2.129 +	}
   2.130 +	else if (action == MenuAction_Cancel)
   2.131 +	{
   2.132 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   2.133 +		{
   2.134 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   2.135 +		}
   2.136 +	}
   2.137 +	else if (action == MenuAction_Select)
   2.138 +	{
   2.139 +		decl String:info[32];
   2.140 +		new userid, target;
   2.141 +		
   2.142 +		GetMenuItem(menu, param2, info, sizeof(info));
   2.143 +		userid = StringToInt(info);
   2.144 +
   2.145 +		if ((target = GetClientOfUserId(userid)) == 0)
   2.146 +		{
   2.147 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
   2.148 +		}
   2.149 +		else if (!CanUserTarget(param1, target))
   2.150 +		{
   2.151 +			PrintToChat(param1, "[SM] %t", "Unable to target");
   2.152 +		}
   2.153 +		else
   2.154 +		{
   2.155 +			g_BlindTarget[param1] = userid;
   2.156 +			DisplayAmountMenu(param1);
   2.157 +			return;	// Return, because we went to a new menu and don't want the re-draw to occur.
   2.158 +		}
   2.159 +		
   2.160 +		/* Re-draw the menu if they're still valid */
   2.161 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   2.162 +		{
   2.163 +			DisplayBlindMenu(param1);
   2.164 +		}
   2.165 +	}
   2.166 +	
   2.167 +	return;
   2.168 +}
   2.169 +
   2.170 +public MenuHandler_Amount(Handle:menu, MenuAction:action, param1, param2)
   2.171 +{
   2.172 +	if (action == MenuAction_End)
   2.173 +	{
   2.174 +		CloseHandle(menu);
   2.175 +	}
   2.176 +	else if (action == MenuAction_Cancel)
   2.177 +	{
   2.178 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   2.179 +		{
   2.180 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   2.181 +		}
   2.182 +	}
   2.183 +	else if (action == MenuAction_Select)
   2.184 +	{
   2.185 +		decl String:info[32];
   2.186 +		new amount, target;
   2.187 +		
   2.188 +		GetMenuItem(menu, param2, info, sizeof(info));
   2.189 +		amount = StringToInt(info);
   2.190 +
   2.191 +		if ((target = GetClientOfUserId(g_BlindTarget[param1])) == 0)
   2.192 +		{
   2.193 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
   2.194 +		}
   2.195 +		else if (!CanUserTarget(param1, target))
   2.196 +		{
   2.197 +			PrintToChat(param1, "[SM] %t", "Unable to target");
   2.198 +		}
   2.199 +		else
   2.200 +		{
   2.201 +			new String:name[32];
   2.202 +			GetClientName(target, name, sizeof(name));
   2.203 +			
   2.204 +			PerformBlind(param1, target, amount);
   2.205 +			ShowActivity2(param1, "[SM] ", "%t", "Set blind on target", "_s", name, amount);
   2.206 +		}
   2.207 +		
   2.208 +		/* Re-draw the menu if they're still valid */
   2.209 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   2.210 +		{
   2.211 +			DisplayBlindMenu(param1);
   2.212 +		}
   2.213 +	}
   2.214 +}
   2.215 +
   2.216 +
   2.217 +public Action:Command_Blind(client, args)
   2.218 +{
   2.219 +	if (args < 1)
   2.220 +	{
   2.221 +		ReplyToCommand(client, "[SM] Usage: sm_blind <#userid|name> [amount]");
   2.222 +		return Plugin_Handled;
   2.223 +	}
   2.224 +
   2.225 +	decl String:arg[65];
   2.226 +	GetCmdArg(1, arg, sizeof(arg));
   2.227 +	
   2.228 +	new amount = 0;
   2.229 +	if (args > 1)
   2.230 +	{
   2.231 +		decl String:arg2[20];
   2.232 +		GetCmdArg(2, arg2, sizeof(arg2));
   2.233 +		if (StringToIntEx(arg2, amount) == 0)
   2.234 +		{
   2.235 +			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   2.236 +			return Plugin_Handled;
   2.237 +		}
   2.238 +		
   2.239 +		if (amount < 0)
   2.240 +		{
   2.241 +			amount = 0;
   2.242 +		}
   2.243 +		
   2.244 +		if (amount > 255)
   2.245 +		{
   2.246 +			amount = 255;
   2.247 +		}
   2.248 +	}
   2.249 +
   2.250 +	decl String:target_name[MAX_TARGET_LENGTH];
   2.251 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   2.252 +	
   2.253 +	if ((target_count = ProcessTargetString(
   2.254 +			arg,
   2.255 +			client,
   2.256 +			target_list,
   2.257 +			MAXPLAYERS,
   2.258 +			COMMAND_FILTER_ALIVE,
   2.259 +			target_name,
   2.260 +			sizeof(target_name),
   2.261 +			tn_is_ml)) <= 0)
   2.262 +	{
   2.263 +		ReplyToTargetError(client, target_count);
   2.264 +		return Plugin_Handled;
   2.265 +	}
   2.266 +	
   2.267 +	for (new i = 0; i < target_count; i++)
   2.268 +	{
   2.269 +		PerformBlind(client, target_list[i], amount);
   2.270 +	}
   2.271 +	
   2.272 +	if (tn_is_ml)
   2.273 +	{
   2.274 +		ShowActivity2(client, "[SM] ", "%t", "Set blind on target", target_name);
   2.275 +	}
   2.276 +	else
   2.277 +	{
   2.278 +		ShowActivity2(client, "[SM] ", "%t", "Set blind on target", "_s", target_name);
   2.279 +	}
   2.280 +	
   2.281 +	return Plugin_Handled;
   2.282 +}
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/plugins/basefuncommands/drug.sp	Mon Dec 24 00:45:28 2007 +0000
     3.3 @@ -0,0 +1,296 @@
     3.4 +/**
     3.5 + * vim: set ts=4 :
     3.6 + * =============================================================================
     3.7 + * SourceMod Basefuncommands Plugin
     3.8 + * Provides drug 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_DrugTimers[MAXPLAYERS+1];
    3.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};
    3.39 +
    3.40 +SetupDrugs()
    3.41 +{
    3.42 +	RegAdminCmd("sm_drug", Command_Drug, ADMFLAG_SLAY, "sm_drug <#userid|name> [0/1]");
    3.43 +}
    3.44 +
    3.45 +CreateDrug(client)
    3.46 +{
    3.47 +	g_DrugTimers[client] = CreateTimer(1.0, Timer_Drug, client, TIMER_REPEAT);	
    3.48 +}
    3.49 +
    3.50 +KillDrug(client)
    3.51 +{
    3.52 +	KillTimer(g_DrugTimers[client]);
    3.53 +	g_DrugTimers[client] = INVALID_HANDLE;
    3.54 +	
    3.55 +	new Float:pos[3];
    3.56 +	GetClientAbsOrigin(client, pos);
    3.57 +	new Float:angs[3];
    3.58 +	GetClientEyeAngles(client, angs);
    3.59 +	
    3.60 +	angs[2] = 0.0;
    3.61 +	
    3.62 +	TeleportEntity(client, pos, angs, NULL_VECTOR);	
    3.63 +	
    3.64 +	new clients[2];
    3.65 +	clients[0] = client;	
    3.66 +	
    3.67 +	new Handle:message = StartMessageEx(g_FadeUserMsgId, clients, 1);
    3.68 +	BfWriteShort(message, 1536);
    3.69 +	BfWriteShort(message, 1536);
    3.70 +	BfWriteShort(message, (0x0001 | 0x0010));
    3.71 +	BfWriteByte(message, 0);
    3.72 +	BfWriteByte(message, 0);
    3.73 +	BfWriteByte(message, 0);
    3.74 +	BfWriteByte(message, 0);
    3.75 +	EndMessage();	
    3.76 +}
    3.77 +
    3.78 +KillAllDrugs()
    3.79 +{
    3.80 +	new maxclients = GetMaxClients();
    3.81 +	for (new i = 1; i <= maxclients; i++)
    3.82 +	{
    3.83 +		if (g_DrugTimers[i] != INVALID_HANDLE)
    3.84 +		{
    3.85 +			KillDrug(i);
    3.86 +		}
    3.87 +	}
    3.88 +}
    3.89 +
    3.90 +PerformDrug(client, target, toggle)
    3.91 +{
    3.92 +	switch (toggle)
    3.93 +	{
    3.94 +		case (2):
    3.95 +		{
    3.96 +			if (g_DrugTimers[target] == INVALID_HANDLE)
    3.97 +			{
    3.98 +				CreateDrug(target);
    3.99 +				LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
   3.100 +			}
   3.101 +			else
   3.102 +			{
   3.103 +				KillDrug(target);
   3.104 +				LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
   3.105 +			}			
   3.106 +		}
   3.107 +
   3.108 +		case (1):
   3.109 +		{
   3.110 +			if (g_DrugTimers[target] == INVALID_HANDLE)
   3.111 +			{
   3.112 +				CreateDrug(target);
   3.113 +				LogAction(client, target, "\"%L\" drugged \"%L\"", client, target);
   3.114 +			}			
   3.115 +		}
   3.116 +		
   3.117 +		case (0):
   3.118 +		{
   3.119 +			if (g_DrugTimers[target] != INVALID_HANDLE)
   3.120 +			{
   3.121 +				KillDrug(target);
   3.122 +				LogAction(client, target, "\"%L\" undrugged \"%L\"", client, target);
   3.123 +			}			
   3.124 +		}
   3.125 +	}
   3.126 +}
   3.127 +
   3.128 +public Action:Timer_Drug(Handle:timer, any:client)
   3.129 +{
   3.130 +	if (!IsClientInGame(client) || !IsPlayerAlive(client))
   3.131 +	{
   3.132 +		KillDrug(client);		
   3.133 +
   3.134 +		return Plugin_Handled;
   3.135 +	}
   3.136 +	
   3.137 +	new Float:pos[3];
   3.138 +	GetClientAbsOrigin(client, pos);
   3.139 +	
   3.140 +	new Float:angs[3];
   3.141 +	GetClientEyeAngles(client, angs);
   3.142 +	
   3.143 +	angs[2] = g_DrugAngles[GetRandomInt(0,100) % 20];
   3.144 +	
   3.145 +	TeleportEntity(client, pos, angs, NULL_VECTOR);
   3.146 +	
   3.147 +	new clients[2];
   3.148 +	clients[0] = client;	
   3.149 +	
   3.150 +	new Handle:message = StartMessageEx(g_FadeUserMsgId, clients, 1);
   3.151 +	BfWriteShort(message, 255);
   3.152 +	BfWriteShort(message, 255);
   3.153 +	BfWriteShort(message, (0x0002));
   3.154 +	BfWriteByte(message, GetRandomInt(0,255));
   3.155 +	BfWriteByte(message, GetRandomInt(0,255));
   3.156 +	BfWriteByte(message, GetRandomInt(0,255));
   3.157 +	BfWriteByte(message, 128);
   3.158 +	
   3.159 +	EndMessage();	
   3.160 +		
   3.161 +	return Plugin_Handled;
   3.162 +}
   3.163 +
   3.164 +public AdminMenu_Drug(Handle:topmenu, 
   3.165 +					  TopMenuAction:action,
   3.166 +					  TopMenuObject:object_id,
   3.167 +					  param,
   3.168 +					  String:buffer[],
   3.169 +					  maxlength)
   3.170 +{
   3.171 +	if (action == TopMenuAction_DisplayOption)
   3.172 +	{
   3.173 +		Format(buffer, maxlength, "%T", "Drug player", param);
   3.174 +	}
   3.175 +	else if (action == TopMenuAction_SelectOption)
   3.176 +	{
   3.177 +		DisplayDrugMenu(param);
   3.178 +	}
   3.179 +}
   3.180 +
   3.181 +DisplayDrugMenu(client)
   3.182 +{
   3.183 +	new Handle:menu = CreateMenu(MenuHandler_Drug);
   3.184 +	
   3.185 +	decl String:title[100];
   3.186 +	Format(title, sizeof(title), "%T:", "Drug player", client);
   3.187 +	SetMenuTitle(menu, title);
   3.188 +	SetMenuExitBackButton(menu, true);
   3.189 +	
   3.190 +	AddTargetsToMenu(menu, client, true, true);
   3.191 +	
   3.192 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   3.193 +}
   3.194 +
   3.195 +public MenuHandler_Drug(Handle:menu, MenuAction:action, param1, param2)
   3.196 +{
   3.197 +	if (action == MenuAction_End)
   3.198 +	{
   3.199 +		CloseHandle(menu);
   3.200 +	}
   3.201 +	else if (action == MenuAction_Cancel)
   3.202 +	{
   3.203 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   3.204 +		{
   3.205 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   3.206 +		}
   3.207 +	}
   3.208 +	else if (action == MenuAction_Select)
   3.209 +	{
   3.210 +		decl String:info[32];
   3.211 +		new userid, target;
   3.212 +		
   3.213 +		GetMenuItem(menu, param2, info, sizeof(info));
   3.214 +		userid = StringToInt(info);
   3.215 +
   3.216 +		if ((target = GetClientOfUserId(userid)) == 0)
   3.217 +		{
   3.218 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
   3.219 +		}
   3.220 +		else if (!CanUserTarget(param1, target))
   3.221 +		{
   3.222 +			PrintToChat(param1, "[SM] %t", "Unable to target");
   3.223 +		}
   3.224 +		else
   3.225 +		{
   3.226 +			new String:name[32];
   3.227 +			GetClientName(target, name, sizeof(name));
   3.228 +			
   3.229 +			PerformDrug(param1, target, 2);
   3.230 +			ShowActivity2(param1, "[SM] ", "%t", "Toggled drug on target", "_s", name);
   3.231 +		}
   3.232 +		
   3.233 +		/* Re-draw the menu if they're still valid */
   3.234 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   3.235 +		{
   3.236 +			DisplayDrugMenu(param1);
   3.237 +		}
   3.238 +	}
   3.239 +}
   3.240 +
   3.241 +public Action:Command_Drug(client, args)
   3.242 +{
   3.243 +	if (args < 1)
   3.244 +	{
   3.245 +		ReplyToCommand(client, "[SM] Usage: sm_drug <#userid|name> [0/1]");
   3.246 +		return Plugin_Handled;
   3.247 +	}
   3.248 +
   3.249 +	decl String:arg[65];
   3.250 +	GetCmdArg(1, arg, sizeof(arg));
   3.251 +	
   3.252 +	new toggle = 2;
   3.253 +	if (args > 1)
   3.254 +	{
   3.255 +		decl String:arg2[2];
   3.256 +		GetCmdArg(2, arg2, sizeof(arg2));
   3.257 +		if (arg2[0])
   3.258 +		{
   3.259 +			toggle = 1;
   3.260 +		}
   3.261 +		else
   3.262 +		{
   3.263 +			toggle = 0;
   3.264 +		}
   3.265 +	}
   3.266 +
   3.267 +	decl String:target_name[MAX_TARGET_LENGTH];
   3.268 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   3.269 +	
   3.270 +	if ((target_count = ProcessTargetString(
   3.271 +			arg,
   3.272 +			client,
   3.273 +			target_list,
   3.274 +			MAXPLAYERS,
   3.275 +			COMMAND_FILTER_ALIVE,
   3.276 +			target_name,
   3.277 +			sizeof(target_name),
   3.278 +			tn_is_ml)) <= 0)
   3.279 +	{
   3.280 +		ReplyToTargetError(client, target_count);
   3.281 +		return Plugin_Handled;
   3.282 +	}
   3.283 +	
   3.284 +	for (new i = 0; i < target_count; i++)
   3.285 +	{
   3.286 +		PerformDrug(client, target_list[i], toggle);
   3.287 +	}
   3.288 +	
   3.289 +	if (tn_is_ml)
   3.290 +	{
   3.291 +		ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", target_name);
   3.292 +	}
   3.293 +	else
   3.294 +	{
   3.295 +		ShowActivity2(client, "[SM] ", "%t", "Toggled drug on target", "_s", target_name);
   3.296 +	}
   3.297 +	
   3.298 +	return Plugin_Handled;
   3.299 +}
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/plugins/basefuncommands/gravity.sp	Mon Dec 24 00:45:28 2007 +0000
     4.3 @@ -0,0 +1,252 @@
     4.4 +/**
     4.5 + * vim: set ts=4 :
     4.6 + * =============================================================================
     4.7 + * SourceMod Basefuncommands Plugin
     4.8 + * Provides gravity 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_GravityTarget[MAXPLAYERS+1];
    4.38 +
    4.39 +SetupGravity()
    4.40 +{
    4.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");
    4.42 +}
    4.43 +
    4.44 +PerformGravity(client, target, Float:amount)
    4.45 +{
    4.46 +	new offset = FindDataMapOffs(client, "m_flGravity");
    4.47 +	new Float:temp = GetEntDataFloat(client, offset);
    4.48 +	PrintToChatAll("Gravity check %f", temp);
    4.49 +	
    4.50 +	SetEntityGravity(target, amount);
    4.51 +	LogAction(client, target, "\"%L\" set gravity on \"%L\" to %d.", client, target, amount);
    4.52 +}
    4.53 +
    4.54 +public AdminMenu_Gravity(Handle:topmenu, 
    4.55 +					  TopMenuAction:action,
    4.56 +					  TopMenuObject:object_id,
    4.57 +					  param,
    4.58 +					  String:buffer[],
    4.59 +					  maxlength)
    4.60 +{
    4.61 +	if (action == TopMenuAction_DisplayOption)
    4.62 +	{
    4.63 +		Format(buffer, maxlength, "%T", "Gravity player", param);
    4.64 +	}
    4.65 +	else if (action == TopMenuAction_SelectOption)
    4.66 +	{
    4.67 +		DisplayGravityMenu(param);
    4.68 +	}
    4.69 +}
    4.70 +
    4.71 +DisplayGravityMenu(client)
    4.72 +{
    4.73 +	new Handle:menu = CreateMenu(MenuHandler_Gravity);
    4.74 +	
    4.75 +	decl String:title[100];
    4.76 +	Format(title, sizeof(title), "%T:", "Gravity player", client);
    4.77 +	SetMenuTitle(menu, title);
    4.78 +	SetMenuExitBackButton(menu, true);
    4.79 +	
    4.80 +	AddTargetsToMenu(menu, client, true, true);
    4.81 +	
    4.82 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    4.83 +}
    4.84 +
    4.85 +DisplayGravityAmountMenu(client)
    4.86 +{
    4.87 +	new Handle:menu = CreateMenu(MenuHandler_GravityAmount);
    4.88 +	
    4.89 +	decl String:title[100];
    4.90 +	Format(title, sizeof(title), "%T:", "Gravity amount", client);
    4.91 +	SetMenuTitle(menu, title);
    4.92 +	SetMenuExitBackButton(menu, true);
    4.93 +	
    4.94 +	AddMenuItem(menu, "4.0", "Gravity Very High");
    4.95 +	AddMenuItem(menu, "2.0", "Gravity High");
    4.96 +	AddMenuItem(menu, "1.0", "Gravity Normal");
    4.97 +	AddMenuItem(menu, "0.5", "Gravity Low");
    4.98 +	AddMenuItem(menu, "0.1", "Gravity Very Low");
    4.99 +	
   4.100 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
   4.101 +}
   4.102 +
   4.103 +public MenuHandler_Gravity(Handle:menu, MenuAction:action, param1, param2)
   4.104 +{
   4.105 +	if (action == MenuAction_End)
   4.106 +	{
   4.107 +		CloseHandle(menu);
   4.108 +	}
   4.109 +	else if (action == MenuAction_Cancel)
   4.110 +	{
   4.111 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   4.112 +		{
   4.113 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   4.114 +		}
   4.115 +	}
   4.116 +	else if (action == MenuAction_Select)
   4.117 +	{
   4.118 +		decl String:info[32];
   4.119 +		new userid, target;
   4.120 +		
   4.121 +		GetMenuItem(menu, param2, info, sizeof(info));
   4.122 +		userid = StringToInt(info);
   4.123 +
   4.124 +		if ((target = GetClientOfUserId(userid)) == 0)
   4.125 +		{
   4.126 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
   4.127 +		}
   4.128 +		else if (!CanUserTarget(param1, target))
   4.129 +		{
   4.130 +			PrintToChat(param1, "[SM] %t", "Unable to target");
   4.131 +		}
   4.132 +		else
   4.133 +		{
   4.134 +			g_GravityTarget[param1] = userid;
   4.135 +			DisplayGravityAmountMenu(param1);
   4.136 +			return;	// Return, because we went to a new menu and don't want the re-draw to occur.
   4.137 +		}
   4.138 +		
   4.139 +		/* Re-draw the menu if they're still valid */
   4.140 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   4.141 +		{
   4.142 +			DisplayGravityMenu(param1);
   4.143 +		}
   4.144 +	}
   4.145 +	
   4.146 +	return;
   4.147 +}
   4.148 +
   4.149 +public MenuHandler_GravityAmount(Handle:menu, MenuAction:action, param1, param2)
   4.150 +{
   4.151 +	if (action == MenuAction_End)
   4.152 +	{
   4.153 +		CloseHandle(menu);
   4.154 +	}
   4.155 +	else if (action == MenuAction_Cancel)
   4.156 +	{
   4.157 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
   4.158 +		{
   4.159 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   4.160 +		}
   4.161 +	}
   4.162 +	else if (action == MenuAction_Select)
   4.163 +	{
   4.164 +		decl String:info[32];
   4.165 +		new Float:amount, target;
   4.166 +		
   4.167 +		GetMenuItem(menu, param2, info, sizeof(info));
   4.168 +		amount = StringToFloat(info);
   4.169 +
   4.170 +		if ((target = GetClientOfUserId(g_GravityTarget[param1])) == 0)
   4.171 +		{
   4.172 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
   4.173 +		}
   4.174 +		else if (!CanUserTarget(param1, target))
   4.175 +		{
   4.176 +			PrintToChat(param1, "[SM] %t", "Unable to target");
   4.177 +		}
   4.178 +		else
   4.179 +		{
   4.180 +			new String:name[32];
   4.181 +			GetClientName(target, name, sizeof(name));
   4.182 +			
   4.183 +			PerformGravity(param1, target, amount);
   4.184 +			ShowActivity2(param1, "[SM] ", "%t", "Set gravity on target", "_s", name, amount);
   4.185 +		}
   4.186 +		
   4.187 +		/* Re-draw the menu if they're still valid */
   4.188 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   4.189 +		{
   4.190 +			DisplayGravityMenu(param1);
   4.191 +		}
   4.192 +	}
   4.193 +}
   4.194 +
   4.195 +public Action:Command_Gravity(client, args)
   4.196 +{
   4.197 +	if (args < 1)
   4.198 +	{
   4.199 +		ReplyToCommand(client, "[SM] Usage: sm_gravity <#userid|name> [amount]");
   4.200 +		return Plugin_Handled;
   4.201 +	}
   4.202 +
   4.203 +	decl String:arg[65];
   4.204 +	GetCmdArg(1, arg, sizeof(arg));
   4.205 +	
   4.206 +	new Float:amount = 1.0;
   4.207 +	if (args > 1)
   4.208 +	{
   4.209 +		decl String:arg2[20];
   4.210 +		GetCmdArg(2, arg2, sizeof(arg2));
   4.211 +		if (StringToFloatEx(arg2, amount) == 0)
   4.212 +		{
   4.213 +			ReplyToCommand(client, "[SM] %t", "Invalid Amount");
   4.214 +			return Plugin_Handled;
   4.215 +		}
   4.216 +		
   4.217 +		if (amount < 0.0)
   4.218 +		{
   4.219 +			amount = 0.0;
   4.220 +		}
   4.221 +	}
   4.222 +
   4.223 +	decl String:target_name[MAX_TARGET_LENGTH];
   4.224 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   4.225 +	
   4.226 +	if ((target_count = ProcessTargetString(
   4.227 +			arg,
   4.228 +			client,
   4.229 +			target_list,
   4.230 +			MAXPLAYERS,
   4.231 +			COMMAND_FILTER_ALIVE,
   4.232 +			target_name,
   4.233 +			sizeof(target_name),
   4.234 +			tn_is_ml)) <= 0)
   4.235 +	{
   4.236 +		ReplyToTargetError(client, target_count);
   4.237 +		return Plugin_Handled;
   4.238 +	}
   4.239 +	
   4.240 +	for (new i = 0; i < target_count; i++)
   4.241 +	{
   4.242 +		PerformGravity(client, target_list[i], amount);
   4.243 +	}
   4.244 +	
   4.245 +	if (tn_is_ml)
   4.246 +	{
   4.247 +		ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", target_name);
   4.248 +	}
   4.249 +	else
   4.250 +	{
   4.251 +		ShowActivity2(client, "[SM] ", "%t", "Set gravity on target", "_s", target_name);
   4.252 +	}
   4.253 +	
   4.254 +	return Plugin_Handled;
   4.255 +}
     5.1 --- a/plugins/basefuncommands/ice.sp	Mon Dec 24 00:44:48 2007 +0000
     5.2 +++ b/plugins/basefuncommands/ice.sp	Mon Dec 24 00:45:28 2007 +0000
     5.3 @@ -374,7 +374,7 @@
     5.4  			new String:name[32];
     5.5  			GetClientName(target, name, sizeof(name));
     5.6  			
     5.7 -			PerformFreeze(param1, target, 2);
     5.8 +			PerformFreeze(param1, target, GetConVarInt(g_FreezeDuration));
     5.9  			ShowActivity2(param1, "[SM] ", "%t", "Froze target", "_s", name);
    5.10  		}
    5.11  		
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/plugins/basefuncommands/noclip.sp	Mon Dec 24 00:45:28 2007 +0000
     6.3 @@ -0,0 +1,175 @@
     6.4 +/**
     6.5 + * vim: set ts=4 :
     6.6 + * =============================================================================
     6.7 + * SourceMod Basefuncommands Plugin
     6.8 + * Provides noclip 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 +SetupNoClip()
    6.38 +{
    6.39 +	RegAdminCmd("sm_noclip", Command_NoClip, ADMFLAG_SLAY|ADMFLAG_CHEATS, "sm_noclip <#userid|name>");
    6.40 +}
    6.41 +
    6.42 +PerformNoClip(client, target)
    6.43 +{
    6.44 +	new movetype = GetEntityMovetype(target);
    6.45 +	PrintToChatAll("movetype was %d", movetype);
    6.46 +	if (movetype != MOVETYPE_NOCLIP)
    6.47 +	{
    6.48 +		SetEntityMovetype(target, MOVETYPE_NOCLIP);
    6.49 +	}
    6.50 +	else
    6.51 +	{
    6.52 +		SetEntityMovetype(target, MOVETYPE_WALK);
    6.53 +	}
    6.54 +	
    6.55 +	LogAction(client, target, "\"%L\" toggled noclip on \"%L\"", client, target);
    6.56 +}
    6.57 +
    6.58 +public AdminMenu_NoClip(Handle:topmenu, 
    6.59 +					  TopMenuAction:action,
    6.60 +					  TopMenuObject:object_id,
    6.61 +					  param,
    6.62 +					  String:buffer[],
    6.63 +					  maxlength)
    6.64 +{
    6.65 +	if (action == TopMenuAction_DisplayOption)
    6.66 +	{
    6.67 +		Format(buffer, maxlength, "%T", "NoClip player", param);
    6.68 +	}
    6.69 +	else if (action == TopMenuAction_SelectOption)
    6.70 +	{
    6.71 +		DisplayNoClipMenu(param);
    6.72 +	}
    6.73 +}
    6.74 +
    6.75 +DisplayNoClipMenu(client)
    6.76 +{
    6.77 +	new Handle:menu = CreateMenu(MenuHandler_NoClip);
    6.78 +	
    6.79 +	decl String:title[100];
    6.80 +	Format(title, sizeof(title), "%T:", "NoClip player", client);
    6.81 +	SetMenuTitle(menu, title);
    6.82 +	SetMenuExitBackButton(menu, true);
    6.83 +	
    6.84 +	AddTargetsToMenu(menu, client, true, true);
    6.85 +	
    6.86 +	DisplayMenu(menu, client, MENU_TIME_FOREVER);
    6.87 +}
    6.88 +
    6.89 +public MenuHandler_NoClip(Handle:menu, MenuAction:action, param1, param2)
    6.90 +{
    6.91 +	if (action == MenuAction_End)
    6.92 +	{
    6.93 +		CloseHandle(menu);
    6.94 +	}
    6.95 +	else if (action == MenuAction_Cancel)
    6.96 +	{
    6.97 +		if (param2 == MenuCancel_ExitBack && hTopMenu != INVALID_HANDLE)
    6.98 +		{
    6.99 +			DisplayTopMenu(hTopMenu, param1, TopMenuPosition_LastCategory);
   6.100 +		}
   6.101 +	}
   6.102 +	else if (action == MenuAction_Select)
   6.103 +	{
   6.104 +		decl String:info[32];
   6.105 +		new userid, target;
   6.106 +		
   6.107 +		GetMenuItem(menu, param2, info, sizeof(info));
   6.108 +		userid = StringToInt(info);
   6.109 +
   6.110 +		if ((target = GetClientOfUserId(userid)) == 0)
   6.111 +		{
   6.112 +			PrintToChat(param1, "[SM] %t", "Player no longer available");
   6.113 +		}
   6.114 +		else if (!CanUserTarget(param1, target))
   6.115 +		{
   6.116 +			PrintToChat(param1, "[SM] %t", "Unable to target");
   6.117 +		}
   6.118 +		else
   6.119 +		{
   6.120 +			new String:name[32];
   6.121 +			GetClientName(target, name, sizeof(name));
   6.122 +			
   6.123 +			PerformNoClip(param1, target);
   6.124 +			ShowActivity2(param1, "[SM] ", "%t", "Toggled noclip on target", "_s", name);
   6.125 +		}
   6.126 +		
   6.127 +		/* Re-draw the menu if they're still valid */
   6.128 +		if (IsClientInGame(param1) && !IsClientInKickQueue(param1))
   6.129 +		{
   6.130 +			DisplayNoClipMenu(param1);
   6.131 +		}
   6.132 +	}
   6.133 +}
   6.134 +
   6.135 +public Action:Command_NoClip(client, args)
   6.136 +{
   6.137 +	if (args < 1)
   6.138 +	{
   6.139 +		ReplyToCommand(client, "[SM] Usage: sm_noclip <#userid|name>");
   6.140 +		return Plugin_Handled;
   6.141 +	}
   6.142 +
   6.143 +	decl String:arg[65];
   6.144 +	GetCmdArg(1, arg, sizeof(arg));
   6.145 +	
   6.146 +	decl String:target_name[MAX_TARGET_LENGTH];
   6.147 +	decl target_list[MAXPLAYERS], target_count, bool:tn_is_ml;
   6.148 +	
   6.149 +	if ((target_count = ProcessTargetString(
   6.150 +			arg,
   6.151 +			client,
   6.152 +			target_list,
   6.153 +			MAXPLAYERS,
   6.154 +			COMMAND_FILTER_ALIVE,
   6.155 +			target_name,
   6.156 +			sizeof(target_name),
   6.157 +			tn_is_ml)) <= 0)
   6.158 +	{
   6.159 +		ReplyToTargetError(client, target_count);
   6.160 +		return Plugin_Handled;
   6.161 +	}
   6.162 +	
   6.163 +	for (new i = 0; i < target_count; i++)
   6.164 +	{
   6.165 +		PerformNoClip(client, target_list[i]);
   6.166 +	}
   6.167 +	
   6.168 +	if (tn_is_ml)
   6.169 +	{
   6.170 +		ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", target_name);
   6.171 +	}
   6.172 +	else
   6.173 +	{
   6.174 +		ShowActivity2(client, "[SM] ", "%t", "Toggled noclip on target", "_s", target_name);
   6.175 +	}
   6.176 +	
   6.177 +	return Plugin_Handled;
   6.178 +}
     7.1 --- a/translations/basefuncommands.phrases.txt	Mon Dec 24 00:44:48 2007 +0000
     7.2 +++ b/translations/basefuncommands.phrases.txt	Mon Dec 24 00:45:28 2007 +0000
     7.3 @@ -34,7 +34,77 @@
     7.4  	"Beacon player"
     7.5  	{
     7.6  		"en"			"Beacon player"
     7.7 -	}	
     7.8 +	}
     7.9 +	
    7.10 +	"NoClip player"
    7.11 +	{
    7.12 +		"en"			"NoClip player"
    7.13 +	}
    7.14 +	
    7.15 +	"Blind player"
    7.16 +	{
    7.17 +		"en"			"Blind player"
    7.18 +	}
    7.19 +	
    7.20 +	"Drug player"
    7.21 +	{
    7.22 +		"en"			"Drug player"
    7.23 +	}
    7.24 +	
    7.25 +	"Gravity player"
    7.26 +	{
    7.27 +		"en"			"Gravity player"
    7.28 +	}
    7.29 +	
    7.30 +	"Blind amount"
    7.31 +	{
    7.32 +		"en"			"How blind?"
    7.33 +	}
    7.34 +	
    7.35 +	"Fully blind"
    7.36 +	{
    7.37 +		"en"			"Fully blind"
    7.38 +	}
    7.39 +	
    7.40 +	"Half blind"
    7.41 +	{
    7.42 +		"en"			"Half blind"
    7.43 +	}
    7.44 +	
    7.45 +	"No blind"
    7.46 +	{
    7.47 +		"en"			"No blind"
    7.48 +	}
    7.49 +	
    7.50 +	"Gravity amount"
    7.51 +	{
    7.52 +		"en"			"Gravity?"
    7.53 +	}
    7.54 +	
    7.55 +	"Gravity Very High"
    7.56 +	{
    7.57 +		"en"			"Gravity Very High"
    7.58 +	}
    7.59 +	
    7.60 +	"Gravity High"
    7.61 +	{
    7.62 +		"en"			"Gravity High"
    7.63 +	}
    7.64 +	
    7.65 +	"Gravity Normal"
    7.66 +	{
    7.67 +		"en"			"Gravity Normal"
    7.68 +	}
    7.69 +	
    7.70 +	"Gravity Low"
    7.71 +	{
    7.72 +		"en"			"Gravity Low"
    7.73 +	}
    7.74 +	
    7.75 +	"Gravity Very Low"
    7.76 +	{
    7.77 +		"en"			"Gravity Very Low"
    7.78 +	}
    7.79  	
    7.80  	"Set target on fire"
    7.81  	{
    7.82 @@ -45,7 +115,7 @@
    7.83  	"Toggled FireBomb on target"
    7.84  	{
    7.85  		"#format"		"{1:t}"
    7.86 -		"en"			"set a firebomb on {1}."
    7.87 +		"en"			"toggled firebomb on {1}."
    7.88  	}	
    7.89  
    7.90  	"Froze target"
    7.91 @@ -57,7 +127,7 @@
    7.92  	"Toggled FreezeBomb on target"
    7.93  	{
    7.94  		"#format"		"{1:t}"
    7.95 -		"en"			"set a freezebomb on {1}."
    7.96 +		"en"			"toggled freezebomb on {1}."
    7.97  	}	
    7.98  	
    7.99  	"Toggled beacon on target"
   7.100 @@ -69,7 +139,31 @@
   7.101  	"Toggled TimeBomb on target"
   7.102  	{
   7.103  		"#format"		"{1:t}"
   7.104 -		"en"			"set a timebomb on {1}."
   7.105 +		"en"			"toggled timebomb on {1}."
   7.106 +	}
   7.107 +
   7.108 +	"Toggled noclip on target"
   7.109 +	{
   7.110 +		"#format"		"{1:t}"
   7.111 +		"en"			"toggled noclip on {1}."
   7.112 +	}
   7.113 +	
   7.114 +	"Toggled drug on target"
   7.115 +	{
   7.116 +		"#format"		"{1:t}"
   7.117 +		"en"			"toggled drugs on {1}."
   7.118 +	}	
   7.119 +	
   7.120 +	"Set blind on target"
   7.121 +	{
   7.122 +		"#format"		"{1:t}"
   7.123 +		"en"			"used blind on {1}."
   7.124 +	}
   7.125 +	
   7.126 +	"Set gravity on target"
   7.127 +	{
   7.128 +		"#format"		"{1:t}"
   7.129 +		"en"			"set {1}'s gravity."
   7.130  	}	
   7.131  	
   7.132  	"Till Explodes"