I have a knife damage plugin:
Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <zombiereloaded>
public Plugin:myinfo =
{
name = "[CSGO] ZR - Knife Damage",
author = "Cherry, edited by somebody.",
description = "ZR - Knife Damage",
version = "1.0",
url = "http://sourcemod.net"
}
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_TraceAttack, OnTraceAttackOnTakeDamage);
}
public Action OnTraceAttackOnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &ammotype, int hitbox, int hitgroup)
{
if(ZR_IsClientHuman(attacker))
{
char classname[32];
GetClientWeapon(attacker, classname, 32);
if(StrEqual(classname, "weapon_knife"))
{
if(damage < 50.0)
{
damage = 1000.0;
}
else if(damage > 100.0)
{
damage = 2000.0;
}
else
{
damage = 1000.0;
}
}
return Plugin_Changed;
}
else
{
return Plugin_Continue;
}
return Plugin_Continue;
}
Sometimes it works, some time not and theese are the errors in log:
Code:
[SM] Exception reported: Invalid client index. (308)
[SM] Blaming: zombiereloaded.smx
[SM] Call stack trace:
[SM] [0] ThrowNativeError
[SM] [1] Line 74, zr/api/api.inc::APIValidateClientIndex
[SM] [2] Line 84, zr/api/infect.api.inc::APIIsClientHuman
[SM] [4] ZR_IsClientHuman
[SM] [5] Line 25, zr_knife.sp::OnTraceAttackOnTakeDamage
Can somebody fix it please?
__________________