Thanks, I did not quite understand how I would use those flags, but I tested some stuff.
I just copypasted the SetEntProp and changed it to m_SpawnFlags", 16 (for fixed orientation?) in both places where EntityProperties are set. here are the code:
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
new bool:g_bLateLoad;
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
g_bLateLoad = late;
return APLRes_Success;
}
public OnConfigsExecuted()
{
if(g_bLateLoad)
{
decl String:sClassname[32];
for(new i = MaxClients; i <= 2047; i++)
{
if(IsValidEntity(i) && IsValidEdict(i))
{
GetEntityClassname(i, sClassname, sizeof(sClassname));
if(StrEqual(sClassname, "func_tanktrain") || StrEqual(sClassname, "path_track"))
{
new iState = GetEntProp(i, Prop_Data, "m_eOrientationType");
PrintToChatAll("%s %d OnConfigsExecuted with orientationtype %d", sClassname, i, iState);
LogError("%s %d OnConfigsExecuted with orientationtype %d", sClassname, i, iState);
if(iState)
{
SetEntProp(i, Prop_Data, "m_eOrientationType", 0);
SetEntProp(i, Prop_Data, "m_spawnflags", 16);
CreateTimer(2.0, Timer_Check, EntIndexToEntRef(i), TIMER_FLAG_NO_MAPCHANGE);
}
}
}
}
g_bLateLoad = false;
}
}
public OnEntityCreated(entity, const String:classname[])
{
if (StrEqual(classname, "func_tanktrain") || StrEqual(classname, "path_track"))
{
SDKHook(entity, SDKHook_SpawnPost, OnSpawnPost);
}
}
public OnSpawnPost(entity)
{
decl String:sClassname[32];
GetEntityClassname(entity, sClassname, sizeof(sClassname));
new iState = GetEntProp(entity, Prop_Data, "m_eOrientationType");
PrintToChatAll("%s %d SpawnPost with orientationtype %d", sClassname, entity, iState);
LogError("%s %d SpawnPost with orientationtype %d", sClassname, entity, iState);
if(iState)
{
SetEntProp(entity, Prop_Data, "m_eOrientationType", 0);
SetEntProp(entity, Prop_Data, "m_SpawnFlags", 16);
CreateTimer(2.0, Timer_Check, EntIndexToEntRef(entity), TIMER_FLAG_NO_MAPCHANGE);
}
}
public Action:Timer_Check(Handle:hTimer, any:ref)
{
new entity = EntRefToEntIndex(ref);
if(entity != INVALID_ENT_REFERENCE)
{
decl String:sClassname[32];
GetEntityClassname(entity, sClassname, sizeof(sClassname));
new iState = GetEntProp(entity, Prop_Data, "m_eOrientationType");
PrintToChatAll("%s %d Timer_Check with orientationtype %d", sClassname, entity, iState);
LogError("%s %d Timer_Check with orientationtype %d", sClassname, entity, iState);
}
}
I alsed tried changing the
"m_SpawnFlags" to
"m_spawnflags" and
"m_fFlags" with no luck.
Did I get it wrong? Compile says
"Warning 217: Loose indentation" on the lines I added the
"SetEntProp(entity, Prop_Data, "m_SpawnFlags", 16);" and the line starting with
"CreateTimer" after those. I am not really sure how to use that information to edit the flags. Did some googling and this is what I came up with. What did I do wrong?
Thanks again!!