Sorry if i'm doing wrong. This is my first time to post scripting room.
So basically i'm editing and combining
Everyone vomit,
Showdamage as fortnite and
[L4D1/2]Critical Shot
To make sure i can also hear custom sound effect from common infected from shot + random chance to vomit
But when i test i keep getting this annoying spam error and i don't know how to fix it
HTML Code:
L 07/30/2021 - 09:19:15: [SM] Exception reported: Client index 0 is invalid
L 07/30/2021 - 09:19:15: [SM] Blaming: l4d_crit.smx
L 07/30/2021 - 09:19:15: [SM] Call stack trace:
L 07/30/2021 - 09:19:15: [SM] [0] EmitSound
L 07/30/2021 - 09:19:15: [SM] [1] Line 433, include/sdktools_sound.inc::EmitSoundToClient
L 07/30/2021 - 09:19:15: [SM] [2] Line 116, plugin.sp::IHurtDamage
I don't see Line 433 since my script total lines are 298
Here's around line 116
HTML Code:
public Action:IHurtDamage(Handle:event, const String:name[], bool:dontBroadcast)
{
new attacker = GetClientOfUserId(GetEventInt(event, "attacker"));
new TempChance = GetRandomInt(0, 100);
int iHitgroup = GetEventInt(event, "hitgroup");
EmitSoundToClient(attacker, SOUNDER); // emit sound
if(iHitgroup == 1) // headshot
EmitSoundToClient(attacker, SOUNDERS); // emit sound LINE 116
if (TempChance < GetConVarInt(cvarCritChance))
{
if (GetClientTeam(attacker) == 2)
{
new infected = GetEventInt(event, "entityid");
decl String:class[20];
GetEntityNetClass(infected, class, 20);
new compare;
compare = strcmp(class, "Witch");
if(compare == 0)
{
return Plugin_Continue;
}
else
{
// IgniteEntity(infected, 100.0, false);
damage = GetEventInt(event, "dmg_health");
damagebonus = damage * damagechance;
VomitEntity(infected);
EmitSoundToAll (SOUNDS, true);
new Float:x[3];
new Float:z[3];
new Float:j[3];
new String:tName[32];
new particle = CreateEntityByName("info_particle_system");
DispatchKeyValue(particle, "effect_name", "boomer_explode_d");
DispatchSpawn(particle);
ActivateEntity(particle);
AcceptEntityInput(particle, "Start");
Format(tName, sizeof(tName), "part%d", infected);
DispatchKeyValue(infected, "targetname", tName);
SetVariantString(tName);
AcceptEntityInput(particle, "SetParent", particle, particle, 0);
SetVariantString("eyes");
AcceptEntityInput(particle, "SetParentAttachment");
TeleportEntity(particle, x, j, NULL_VECTOR);
z[2]=z[2]-2;
CreateTimer(0.1, DeleteParticles, EntIndexToEntRef(particle));
}
}
}
return Plugin_Continue;
}
Should i also post full sp script file here?
I would greatly happy and appreciate if someone can improve all my noob script and fix it