Raised This Month: $51 Target: $400
 12% 

No Terrorist knife Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ehsank1768
Member
Join Date: Aug 2022
Old 05-10-2023 , 15:08   No Terrorist knife Damage
Reply With Quote #1

hi everyone, can someone make a plugin that disables the knife damage received from terrorists? so no longer they can use their knives in combat,
and they have to run away from CTs, i want this for HnS
ehsank1768 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 05-11-2023 , 13:49   Re: No Terrorist knife Damage
Reply With Quote #2

you can try this code: https://forums.alliedmods.net/showpo...7&postcount=10

or this:
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdkhooks>

bool g_bLate;

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    
g_bLate late;
    return 
APLRes_Success;
}

public 
void OnPluginStart()
{
    if(
g_bLate)
    {
        for(
int i 1<= MaxClientsi++) if(IsClientInGame(i)) SDKHook(iSDKHook_OnTakeDamageOnTakeDamage);
    }
}

public 
void OnClientPostAdminCheck(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    return 
damagetype DMG_SLASH && attacker && attacker <= MaxClients && victim != attacker
        
&& IsClientInGame(attacker) && GetClientTeam(attacker) != Plugin_Handled Plugin_Continue;

__________________
Grey83 is offline
ehsank1768
Member
Join Date: Aug 2022
Old 05-12-2023 , 08:32   Re: No Terrorist knife Damage
Reply With Quote #3

Thanks
ehsank1768 is offline
ehsank1768
Member
Join Date: Aug 2022
Old 05-18-2023 , 15:07   Re: No Terrorist knife Damage
Reply With Quote #4

Quote:
Originally Posted by Grey83 View Post
you can try this code: https://forums.alliedmods.net/showpo...7&postcount=10

or this:
PHP Code:
#pragma semicolon 1
#pragma newdecls required

#include <sdkhooks>

bool g_bLate;

public 
APLRes AskPluginLoad2(Handle myselfbool latechar[] errorint err_max)
{
    
g_bLate late;
    return 
APLRes_Success;
}

public 
void OnPluginStart()
{
    if(
g_bLate)
    {
        for(
int i 1<= MaxClientsi++) if(IsClientInGame(i)) SDKHook(iSDKHook_OnTakeDamageOnTakeDamage);
    }
}

public 
void OnClientPostAdminCheck(int client)
{
    
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
}

public 
Action OnTakeDamage(int victimint &attackerint &inflictorfloat &damageint &damagetype)
{
    return 
damagetype DMG_SLASH && attacker && attacker <= MaxClients && victim != attacker
        
&& IsClientInGame(attacker) && GetClientTeam(attacker) != Plugin_Handled Plugin_Continue;

hi Grey83 i have some good news

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 (StrEqual(WeaponName, "weapon_knife", false))
{
damage *= 0;
return Plugin_Stop;
}
}
return Plugin_Continue;
}
-----
works but both teams cannot use the knife can you edit it so only Terrorists wont be able to use it? thanks
ehsank1768 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 05-18-2023 , 23:03   Re: No Terrorist knife Damage
Reply With Quote #5

if ( (client>=1) && (client<=MaxClients) && (attacker>=1) && (attacker<=MaxClients) && (attacker==inflictor) )
==>
if(0 < attacker && attacker < =MaxClients && client != attacker && attacker==inflictor && IsClientInGame(attacker) && GetClientTeam(attacker) != 3)
__________________
Grey83 is offline
ehsank1768
Member
Join Date: Aug 2022
Old 05-19-2023 , 04:52   Re: No Terrorist knife Damage
Reply With Quote #6

i ran into a bit of problem

//// TerroristNoKnifeDMG.sp
//
// E:\Program Files (x86)\steamcmdtestserver\cstrike\addons\sourc emod\scripting\TerroristNoKnifeDMG.sp(34) : warning 217: loose indentation
// E:\Program Files (x86)\steamcmdtestserver\cstrike\addons\sourc emod\scripting\TerroristNoKnifeDMG.sp(34) : error 029: invalid expression, assumed zero
// E:\Program Files (x86)\steamcmdtestserver\cstrike\addons\sourc emod\scripting\TerroristNoKnifeDMG.sp(34) : error 001: expected token: ";", but found ")"
// E:\Program Files (x86)\steamcmdtestserver\cstrike\addons\sourc emod\scripting\TerroristNoKnifeDMG.sp(34) : error 029: invalid expression, assumed zero
// E:\Program Files (x86)\steamcmdtestserver\cstrike\addons\sourc emod\scripting\TerroristNoKnifeDMG.sp(34) : fatal error 190: too many error messages on one line
//
// Compilation aborted.
// 4 Errors.
ehsank1768 is offline
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 05-19-2023 , 06:37   Re: No Terrorist knife Damage
Reply With Quote #7

this code will compile
Attached Files
File Type: sp Get Plugin or Get Source (block_team knife_damage.sp - 70 views - 793 Bytes)
__________________
Grey83 is offline
ehsank1768
Member
Join Date: Aug 2022
Old 05-19-2023 , 07:31   Re: No Terrorist knife Damage
Reply With Quote #8

thanks man it works like a champ
ehsank1768 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:40.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode