I was wondering how i would trigger a grenade to explode in Day of Defeat Source. Any ideas? My code so far should cause a german rifle grenade to explode instantly after they fire it, however it does not do anything.
Code so far:
Code:
new Handle:hDetonate
new gEnt
public OnPluginStart()
{
StartPrepSDKCall(SDKCall_Entity)
PrepSDKCall_SetVirtual(284)
hDetonate = EndPrepSDKCall()
HookEventEx("dod_stats_weapon_attack", FireWeapon)
}
public Action:FireWeapon(Handle:event, const String:name[], bool:dontBroadcast)
{
gEnt = -1
while ((gEnt = FindEntityByClassname(gEnt, "weapon_riflegren_ger")) != -1)
{
PrintToChatAll("rgent == %i", gEnt)
SDKCall(hDetonate, gEnt)
}
}