Currently trying to get trails working for my replay bots (so players can simply follow the bot's trail), which works for the most part.
Meaning, that if you first spawn, you correctly see the bot's trail. Once you go spec and back into a team, it's gone.
Same also happens if you change spectate targets, the trail just disappears.
I have already tried making the timer repeat, which solves the disappearing issue, but makes the trail "unsmooth". To be more precise, it behaves like a "normal" laser (just straight lines, breaking, or even 4-5 lines at once).
Is there any way to get this working properly? Already tried a env_spritetrail, which spawns a trail, but is just straight all the time and doesn't move (meaning you will have a solid line between your spawn point and where you currently are).
Current code:
PHP Code:
public void OnMapStart()
{
g_iTrailIndex = PrecacheModel(TRAIL_MODEL, true);
}
public Action Event_PlayerSpawn(Handle event, const char[] name, bool dontBroadcast)
{
int userid = GetEventInt(event, "userid");
int client = GetClientOfUserId(userid);
if(IsFakeClient(client) && FindTrackForClient(client) > -1)
{
CreateTimer(1.0, Timer_Trail, userid);
}
return Plugin_Continue;
}
public Action Timer_Trail(Handle timer, any serial)
{
int client = GetClientOfUserId(serial);
if(!IsClientInGame(client) || !IsFakeClient(client) || FindTrackForClient(client) == -1)
{
return Plugin_Stop;
}
TE_SetupBeamFollow(client, g_iTrailIndex, 0, 3.0, 5.0, 5.0, 1, g_arrTrailColors[FindTrackForClient(client)]);
TE_SendToAll();
return Plugin_Continue;
}
Event_PlayerSpawn is hooked in OnPluginStart().
Thanks in advance!
</span>
__________________
Stopped hosting servers as of November 2018, no longer active around here.