Quote:
Originally Posted by Darkness_
Try it out.
|
Sourcemod online compiler forced me to edit my codes like this
Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
public OnPluginStart()
{
for (new client = 1; client <= MaxClients; client++)
{
if (IsClientInGame(client))
{
SDKHook(client, SDKHook_OnTakeDamage, TakeDamageHook);
}
}
}
public OnClientPutInServer(client)
{
SDKHook(client, SDKHook_OnTakeDamage, TakeDamageHook);
}
public Action:TakeDamageHook(client, &attacker, &inflictor, &Float:damage, &damagetype)
{
if ( (client>=1) && (client<=MaxClients) && (attacker>=1) && (attacker<=MaxClients) && (attacker==inflictor) )
{
decl String:WeaponName[64];
GetClientWeapon(attacker, WeaponName, sizeof(WeaponName));
if StrContains(WeaponName, "knife", false) != 0 *then
{
damage *= 0;
return Plugin_Changed;
}
}
return Plugin_Continue;
}
But it blocks all damage, from weapons etc, no one takes damage lol.
When i tried compile the code above it said:
/groups/sourcemod/upload_tmp/textb4WfFB.sp(2
: error 001: expected token: "*then", but found ")"
/groups/sourcemod/upload_tmp/textb4WfFB.sp(2
: error 029: invalid expression, assumed zero
/groups/sourcemod/upload_tmp/textb4WfFB.sp(30) : warning 215: expression has no effect