merged in selected changesets from 1.1 branch

--HG--
branch : sourcemod-1.0.x
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/branches/sourcemod-1.0.x%401990
This commit is contained in:
David Anderson
2008-04-06 05:40:11 +00:00
parent 0b731c9bc0
commit 54754f9e83
80 changed files with 8275 additions and 378 deletions
+59
View File
@@ -0,0 +1,59 @@
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "Entity Output Hook Testing",
author = "AlliedModders LLC",
description = "Test suite for Entity Output Hooks",
version = "1.0.0.0",
url = "http://www.sourcemod.net/"
};
public OnPluginStart()
{
HookEntityOutput("point_spotlight", "OnLightOn", OutputHook);
HookEntityOutput("func_door", "OnOpen", OutputHook);
HookEntityOutput("func_door_rotating", "OnOpen", OutputHook);
HookEntityOutput("func_door", "OnClose", OutputHook);
HookEntityOutput("func_door_rotating", "OnClose", OutputHook);
}
public OutputHook(const String:name[], caller, activator, Float:delay)
{
LogMessage("[ENTOUTPUT] %s", name);
}
public OnMapStart()
{
new ent = FindEntityByClassname(-1, "point_spotlight");
if (ent == -1)
{
LogError("Could not find a point_spotlight");
ent = CreateEntityByName("point_spotlight");
DispatchSpawn(ent);
}
HookSingleEntityOutput(ent, "OnLightOn", OutputHook, true);
HookSingleEntityOutput(ent, "OnLightOff", OutputHook, true);
AcceptEntityInput(ent, "LightOff", ent, ent);
AcceptEntityInput(ent, "LightOn", ent, ent);
AcceptEntityInput(ent, "LightOff", ent, ent);
AcceptEntityInput(ent, "LightOn", ent, ent);
HookSingleEntityOutput(ent, "OnLightOn", OutputHook, false);
HookSingleEntityOutput(ent, "OnLightOff", OutputHook, false);
AcceptEntityInput(ent, "LightOff", ent, ent);
AcceptEntityInput(ent, "LightOn", ent, ent);
AcceptEntityInput(ent, "LightOff", ent, ent);
AcceptEntityInput(ent, "LightOn", ent, ent);
//Comment these out (and reload the plugin heaps) to test for leaks on plugin unload
UnhookSingleEntityOutput(ent, "OnLightOn", OutputHook);
UnhookSingleEntityOutput(ent, "OnLightOff", OutputHook);
}
+167
View File
@@ -0,0 +1,167 @@
#include <sourcemod>
#include <sdktools>
#include <tf2>
#include <tf2_stocks>
public Plugin:myinfo =
{
name = "TF2 Test",
author = "pRED*",
description = "Test of Tf2 functions",
version = "1.0",
url = "www.sourcemod.net"
}
public OnPluginStart()
{
RegConsoleCmd("sm_burnme", Command_Burn);
RegConsoleCmd("sm_invuln", Command_Invuln);
RegConsoleCmd("sm_respawn", Command_Respawn);
RegConsoleCmd("sm_disguise", Command_Disguise);
RegConsoleCmd("sm_remdisguise", Command_RemDisguise);
RegConsoleCmd("sm_class", Command_Class);
RegConsoleCmd("sm_remove", Command_Remove);
RegConsoleCmd("sm_changeclass", Command_ChangeClass);
}
public Action:Command_Class(client, args)
{
TF2_RemoveAllWeapons(client);
decl String:text[10];
GetCmdArg(1, text, sizeof(text));
new one = StringToInt(text);
TF2_EquipPlayerClassWeapons(client, TFClassType:one);
PrintToChat(client, "Test: sniper's classnum is %i (should be %i)", TF2_GetClass("sniper"), TFClass_Sniper);
return Plugin_Handled;
}
public Action:Command_Remove(client, args)
{
decl String:text[10];
GetCmdArg(1, text, sizeof(text));
new one = StringToInt(text);
TF2_RemoveWeaponSlot(client, one);
PrintToChat(client, "Test: heavy's classnum is %i (should be %i)", TF2_GetClass("heavy"), TFClass_Heavy);
new doms = TF2_GetPlayerResourceData(client, TFResource_Dominations);
PrintToChat(client, "Dominations read test: %i", doms);
TF2_SetPlayerResourceData(client, TFResource_Dominations, doms + 10);
doms = TF2_GetPlayerResourceData(client, TFResource_Dominations);
PrintToChat(client, "Dominations write test: %i", doms);
/* Note: This didn't appear to change my dominations value when I pressed tab. */
return Plugin_Handled;
}
public Action:Command_ChangeClass(client, args)
{
decl String:text[10];
GetCmdArg(1, text, sizeof(text));
new one = StringToInt(text);
PrintToChat(client, "Current class is :%i", TF2_GetPlayerClass(client));
TF2_SetPlayerClass(client, TFClassType:one);
PrintToChat(client, "New class is :%i", TF2_GetPlayerClass(client));
return Plugin_Handled;
}
public Action:Command_Burn(client, args)
{
if (client == 0)
{
return Plugin_Handled;
}
TF2_IgnitePlayer(client, client);
return Plugin_Handled;
}
public Action:Command_Invuln(client, args)
{
if (client == 0)
{
return Plugin_Handled;
}
if (args < 1)
{
return Plugin_Handled;
}
decl String:text[10];
GetCmdArg(1, text, sizeof(text));
new bool:one = !!StringToInt(text);
TF2_SetPlayerInvuln(client, one)
return Plugin_Handled;
}
public Action:Command_Disguise(client, args)
{
if (client == 0)
{
return Plugin_Handled;
}
if (args < 2)
{
return Plugin_Handled;
}
decl String:text[10];
decl String:text2[10];
GetCmdArg(1, text, sizeof(text));
GetCmdArg(2, text2, sizeof(text2));
new one = StringToInt(text);
new two = StringToInt(text2);
TF2_DisguisePlayer(client, TFTeam:one, TFClassType:two);
return Plugin_Handled;
}
public Action:Command_RemDisguise(client, args)
{
if (client == 0)
{
return Plugin_Handled;
}
TF2_RemovePlayerDisguise(client);
return Plugin_Handled;
}
public Action:Command_Respawn(client, args)
{
if (client == 0)
{
return Plugin_Handled;
}
TF2_RespawnPlayer(client);
return Plugin_Handled;
}