Quote:
Originally Posted by Halt
Now I don't want any code, I just want to know if I'm on the right track & what I might do to better improve it.
PLEASE DONT GIVE ME FINISHED CODE
PHP Code:
#include <sourcemod> #include <sdkhooks>
public void OnPluginStart() { HookEvent("OnEntityCreated", Event_EntityCreated); }
public Action Event_EntityCreated(Handle event, int iEntity, const char[] EntityName) { if (iEntity == "grenade_projectile") { int iGrenadeUser = GetEntProp(iEntity, Prop_Data, "m_hThrower"); //Gets user for killfeed SetEntProp(iEntity, "color", "255 0 0"); //Sets Smoke Grenade to Red } }
|
iEntity is an integer (entity index), "grenade_projectile" is a string (entity classname)
You should use
GetEntityClassname EntityName and see if it's equal to grenade_projectile using StrEqual function.
You cannot check for m_hThrower at entity creation because it's not set, it is set only after it's spawned and this is where SDKHook comes to to play.
Also, I think m_hThrower is a sendprop so you should use Prop_Send, with the function GetEntPropEnt because it's checking for an entity of the thrower (a player). basically any m_h* is a handle to an entity.