Greetings, I'm trying to get env_spritetrail to work with CS:GO. It worked "a bit" few updates back. It would spawn for a few seconds after creation and then disappear. (entity would still exist, it would just be invisible)
Here is the code I've written trying to test it. I've tested it in CS:S, works really well. Not so in CSGO sadly.
PHP Code:
#include <SDKTools>
#define TailModel "materials/sprites/laserbeam.vmt"
new tail;
public OnPluginStart()
{
RegAdminCmd("sm_tt", TailTest, ADMFLAG_ROOT);
PrecacheModel(TailModel, true);
}
public Action:TailTest(client,args)
{
if(IsValidEntity(tail))
{
PrintToChat(client, "Killed your tail");
AcceptEntityInput(tail, "Kill");
tail = -1;
return;
}
tail = CreateEntityByName("env_spritetrail");
if (!IsValidEdict(tail))
{
LogError("Can't create entity Client:%N Index:%i", client, tail);
tail = -1;
return;
}
decl String:parentName[64], Float:vPosClient[3];
GetClientName(client, parentName, sizeof( parentName ));
PrintToChat(client, "Attaching tail %i to %N", tail, client);
Format(parentName, sizeof(parentName), "%i:%s", client, parentName);
DispatchKeyValue(client, "targetname", parentName);
DispatchKeyValue(tail, "parentname", "A tail");
DispatchKeyValue(tail, "lifetime", "5");
DispatchKeyValue(tail, "startwidth", "10");
DispatchKeyValue(tail, "endwidth", "1");
DispatchKeyValue(tail, "spritename", TailModel);
DispatchKeyValue(tail, "renderamt", "255");
DispatchKeyValue(tail, "rendercolor", "255 255 255");
DispatchKeyValue(tail, "rendermode", "4");
DispatchSpawn(tail);
GetClientAbsOrigin(client, vPosClient);
TeleportEntity(tail, vPosClient, NULL_VECTOR, NULL_VECTOR);
SetVariantString(parentName);
AcceptEntityInput(tail, "SetParent");
SetVariantString("grenade0");
AcceptEntityInput(tail, "SetParentAttachmentMaintainOffset");
return;
}
public OnPLuginEnd()
{
if(IsValidEntity(tail))
AcceptEntityInput(tail, "Kill");
}
I get no errors, warnings whatsoever. The entity gets spawned, but isn't visible.