Ok so here goes, i'm making this fireworks plugin and i'm creating env_shooter alot in it. Now it works prefectly, it does the things i want it to do but it has 1 side effect. When it is shooting and i let it spawn alot of times, it removes weapons or grenades that are beeing trown. Most of the times it is when the round restarts and then env_shooter is beeing created alot of times and then sometimes weapons get removed from players.
Now does anyone know how to fix this?
I linked the env_shooter code.
Thanks in advance!
PHP Code:
stock env_shooter(client ,Float:Angles[3], Float:iGibs, Float:Delay, Float:GibAngles[3], Float:Velocity, Float:Variance, Float:Giblife, Float:Location[3] )
{
decl Ent;
//Initialize:
Ent = CreateEntityByName("env_shooter");
//Spawn:
if (Ent == -1)
return;
if (Ent>0)
{
//Properties:
//DispatchKeyValue(Ent, "targetname", "flare");
// Gib Direction (Pitch Yaw Roll) - The direction the gibs will fly.
DispatchKeyValueVector(Ent, "angles", Angles);
// Number of Gibs - Total number of gibs to shoot each time it's activated
DispatchKeyValueFloat(Ent, "m_iGibs", iGibs);
// Delay between shots - Delay (in seconds) between shooting each gib. If 0, all gibs shoot at once.
DispatchKeyValueFloat(Ent, "delay", Delay);
// <angles> Gib Angles (Pitch Yaw Roll) - The orientation of the spawned gibs.
DispatchKeyValueVector(Ent, "gibangles", GibAngles);
// Gib Velocity - Speed of the fired gibs.
DispatchKeyValueFloat(Ent, "m_flVelocity", Velocity);
// Course Variance - How much variance in the direction gibs are fired.
DispatchKeyValueFloat(Ent, "m_flVariance", Variance);
// Gib Life - Time in seconds for gibs to live +/- 5%.
DispatchKeyValueFloat(Ent, "m_flGibLife", Giblife);
// <choices> Used to set a non-standard rendering mode on this entity. See also 'FX Amount' and 'FX Color'.
DispatchKeyValue(Ent, "rendermode", "5");
// Model - Thing to shoot out. Can be a .mdl (model) or a .vmt (material/sprite).
new rand = GetRandomInt(0,4);
switch(rand)
{
case 0: DispatchKeyValue(Ent, "shootmodel", "materials/sprites/blueflare1.vmt");
case 1: DispatchKeyValue(Ent, "shootmodel", "materials/effects/redflare.vmt");
case 2: DispatchKeyValue(Ent, "shootmodel", "materials/sprites/yellowflare.vmt");
case 3: DispatchKeyValue(Ent, "shootmodel", "materials/sprites/orangeflare1.vmt");
case 4: DispatchKeyValue(Ent, "shootmodel", "materials/sprites/flare1.vmt");
}
// <choices> Material Sound
DispatchKeyValue(Ent, "shootsounds", "-1"); // No sound
// <choices> Simulate, no idea what it realy does tbh...
// could find out but to lazy and not worth it...
//DispatchKeyValue(Ent, "simulation", "1");
SetVariantString("spawnflags 4");
AcceptEntityInput(Ent,"AddOutput");
//Input:
// Shoot!
AcceptEntityInput(Ent, "Shoot", client);
//Send:
TeleportEntity(Ent, Location, NULL_VECTOR, NULL_VECTOR);
//Delete:
CreateTimer(2.5, KillEnt, Ent);
}
}
public Action:KillEnt(Handle:Timer, any:Ent)
{
//Kill:
if(IsValidEdict(Ent)) AcceptEntityInput(Ent, "Kill");
}
__________________