Hejter
xor ebx, ebx
- Сообщения
- 1,759
- Реакции
- 393
PHP:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
new bool:bAntiknife;
public OnPluginStart()
{
for(new i = 1; i <= MaxClients; i++)
{
if(IsClientValid(i))
{
SDKHook(i, SDKHook_TraceAttack, OnTraceAttack);
}
}
RegConsoleCmd("sm_antiknife", AntiKnife);
RegConsoleCmd("sm_anti_knife", AntiKnife);
RegConsoleCmd("sm_anti-knife", AntiKnife);
}
public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_TraceAttack, OnTraceAttack);
}
public Action:AntiKnife(client, args)
{
bAntiknife = true;
}
public Action:OnTraceAttack(victim, &attacker, &inflictor, &Float:damage, &damagetype, &ammotype, hitbox, hitgroup)
{
if(bAntiknife == true)
{
if(IsClientValid(attacker) && IsClientValid(victim))
{
decl String:sWeapon[32];
GetClientWeapon(attacker, sWeapon, sizeof(sWeapon));
if(StrEqual(sWeapon[7], "knife", false))
{
return Plugin_Handled;
}
}
return Plugin_Continue;
}
}
stock bool:IsClientValid(client)
{
if(client > 0 && client <= MaxClients && IsClientInGame(client))
{
return true;
}
return false;
}
Оффтоп
Фикс. Быстро, решительно.