View Single Post
Peace-Maker
SourceMod Plugin Approver
Join Date: Aug 2008
Location: Germany
Old 03-24-2011 , 09:50   Re: Smoke grenade questions
Reply With Quote #8

Haven't tested this though. Could be, that the client is in m_hOwnerEntity instead of m_hThrower. I'm sure blodia knows, if there is something wrong;)

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

public OnEntityCreated(entity, const String:classname[])
{
    if(
StrEqual(classname"smokegrenade_projectile"false))
    {
        
SetEntProp(entityProp_Send"m_nNextThinkTick", -1);
        
SDKHook(entitySDKHook_ThinkPostHook_OnThinkPost);
    }
}

public 
Hook_OnThinkPost(entity)
{
    new 
Float:fVelocity[3];
    
GetEntPropVector(entityProp_Send"m_vecVelocity"fVelocity);
    if(
fVelocity[0] == 0.0 && fVelocity[1] == 0.0 && fVelocity[2] == 0.0)
    {
        new 
client GetEntPropEnt(entityProp_Send"m_hThrower");
        
        new 
Float:fOrigin[3];
        
GetEntPropVector(entityProp_Send"m_vecOrigin"fOrigin);
        
        
AcceptEntityInput(entity"Kill");
        
        
// Blast ioncannon at fOrigin!
    
}

__________________
Peace-Maker is offline