Permalink
Browse files

Fix precache crash without gotv

  • Loading branch information...
Bara committed Nov 15, 2018
1 parent 20fc8cc commit 0956244174916d5ff34f337476138768e63e45e6
@@ -6,3 +6,4 @@ addons/sourcemod/scripting/include/accelerator.inc
addons/sourcemod/scripting/include/vphysics.inc
addons/sourcemod/scripting/tests/vphysics.sp
addons/sourcemod/scripting/tests/accelerator.sp
addons/sourcemod/scripting/ttt/ttt_ranking.sp
@@ -21,11 +21,6 @@ float g_fStart[MAXPLAYERS + 1][3];
int g_iSprite = -1;
public void OnPluginStart()
{
g_iSprite = PrecacheModel(MODEL_SPRITE);
}
public void OnMapStart()
{
g_iSprite = PrecacheModel(MODEL_SPRITE);
@@ -0,0 +1,35 @@
#include <sourcemod>
#include <sdkhooks>
#include <ttt>
public void OnPluginStart()
{
LoopValidClients(i)
{
OnClientPutInServer(i);
}
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_OnTakeDamageAlive, OnTakeDamageAlive);
}
public Action OnTakeDamageAlive(int victim, int& attacker, int& inflictor, float& damage, int& damagetype)
{
if (TTT_IsClientValid(attacker))
{
PrintToChat(attacker, "Damage Type: %d", damagetype);
if (damagetype & (1 << 30))
{
PrintToChat(attacker, "Damage Type is 1 << 30");
}
else if (damagetype & (1 << 31))
{
PrintToChat(attacker, "Damage Type is 1 << 31");
}
}
return Plugin_Continue;
}
@@ -59,7 +59,7 @@ public void OnPluginEnd()
}
}
public void OnConfigsExecuted()
public void OnMapStart()
{
char sBuffer[PLATFORM_MAX_PATH];
@@ -17,6 +17,8 @@
#define PLUGIN_NAME TTT_PLUGIN_NAME ... " - Knockout"
#define SHORT_NAME "knockout"
#define MODEL_BLACKOUT "models/blackout.mdl"
ConVar g_cPrice = null;
ConVar g_cPrio = null;
ConVar g_cLongName = null;
@@ -124,6 +126,11 @@ public void OnLibraryRemoved(const char[] name)
}
}
public void OnMapStart()
{
PrecacheModel(MODEL_BLACKOUT, true);
}
public void TTT_OnShopReady()
{
RegisterItem();
@@ -387,10 +394,6 @@ void ResetKnockout(int client)
bool SpawnCamAndAttach(int client, int ragdoll)
{
char sModel[64];
Format(sModel, sizeof(sModel), "models/blackout.mdl");
PrecacheModel(sModel, true);
char sModelName[64];
Format(sModelName, sizeof(sModelName), "fpd_ragdoll%d", client);
DispatchKeyValue(ragdoll, "targetname", sModelName);
@@ -406,7 +409,7 @@ bool SpawnCamAndAttach(int client, int ragdoll)
DispatchKeyValue(entity, "targetname", sEntityName);
DispatchKeyValue(entity, "parentname", sModelName);
DispatchKeyValue(entity, "model", sModel);
DispatchKeyValue(entity, "model", MODEL_BLACKOUT);
DispatchKeyValue(entity, "solid", "0");
DispatchKeyValue(entity, "rendermode", "10");
DispatchKeyValue(entity, "disableshadows", "1");
@@ -416,7 +419,7 @@ bool SpawnCamAndAttach(int client, int ragdoll)
Format(CamTargetAngles, 64, "%f %f %f", angles[0], angles[1], angles[2]);
DispatchKeyValue(entity, "angles", CamTargetAngles);
SetEntityModel(entity, sModel);
SetEntityModel(entity, MODEL_BLACKOUT);
DispatchSpawn(entity);
SetVariantString(sModelName);

0 comments on commit 0956244

Please sign in to comment.