Hi,
Trying to add grenade trails. I've taken some of this code from other grenade trail plugins however I can't seem to get it to work within my own code.
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
new g_iBeamSprite;
new GrenadeTrailColor[] = {0, 128, 0, 0};
public OnMapStart()
{
g_iBeamSprite = PrecacheModel("materials/sprites/laserbeam.vmt");
}
public void OnEntityCreated(int entity, const char[] classname)
{
PrintToChatAll("DEBUG: entity created");
if(StrContains(classname, "hegrenade") != -1 && IsValidEntity(entity))
{
PrintToChatAll("DEBUG: hegrenade identified");
TE_SetupBeamFollow(entity, g_iBeamSprite, 0, 20.0, 10.0, 10.0, 2, GrenadeTrailColor);
TE_SendToAll();
}
}
I've put two PrintToChatAll() messages in there to make sure that the OnEntityCreated is firing when a grenade is thrown and making sure it's a hegrenade.