PHP Code:
// setup explosion
SetEntPropEnt(entity, Prop_Data, "m_hLastAttacker", client);
Makes sure the person dropping the balloon gets credit for any kills.
PHP Code:
// send "kill" event to the event queue
new String:addoutput[64];
Format(addoutput, sizeof(addoutput), "OnUser1 !self:break::%f:1", GetConVarFloat(cvLife));
SetVariantString(addoutput);
AcceptEntityInput(entity, "AddOutput");
AcceptEntityInput(entity, "FireUser1");
Adds the "break" input to the entity queue so the balloon will explode after XX seconds (determined by the cvLive convar handle).
PHP Code:
GetConVarString(cvRadius, tmp, sizeof(tmp));
DispatchKeyValue(entity, "ExplodeRadius", tmp);
GetConVarString(cvDamage, tmp, sizeof(tmp));
DispatchKeyValue(entity, "ExplodeDamage", tmp);
Format(tmp, sizeof(tmp), "!self,Break,,0,-1");
DispatchKeyValue(entity, "OnHealthChanged", tmp);
Format(tmp, sizeof(tmp), "!self,Kill,,0,-1");
DispatchKeyValue(entity, "OnBreak", tmp);
Sets the radius and damage. Sets the OnHealthChanged input to break the entity (so it explodes when shot). Sets the OnBreak input to delete the entity when it breaks (explodes).
Quote:
I try to add a PrintHintTextToAll("%s", "A Balloon just exploded") for the same time when this entity explodes but I am somehow not able to do so . I guess that we need to add another event queue?... much thanks for help
|
The code above sets the entity up so that the game engine handles the explosion of the balloon. No code in the plugin is running when it explodes. You could probably use a SM entity output hook to catch the OnBreak event and send a message, but there isn't any function already in the plugin that runs when it explodes.
__________________