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

Solved [L4D2] Increase damage done to Common Infected


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
lightphoenix2
Member
Join Date: Feb 2016
Old 11-20-2021 , 04:07   [L4D2] Increase damage done to Common Infected
Reply With Quote #1

Hi,

I'm trying to increase the damage dealt to the common infected. But doesn't seem to be working.
I found out the problem is when I do a
Code:
if (GetClientTeam(attacker) == GetClientTeam(victim))
			{
				return Plugin_Continue;
			}

Code:
public void OnEntityCreated(int entity, const char[] classname)
{
	if( strcmp(classname, "infected") == 0 )
	{
		g_bIsCommon[entity] = true;
		SDKHook(entity, SDKHook_OnTakeDamage, OnTakeDamage);
	}
}
I have uploaded the source code, please take a look.
Thank you!
Attached Files
File Type: sp Get Plugin or Get Source (l4d2_pistol_damage_m.sp - 50 views - 7.4 KB)

Last edited by lightphoenix2; 11-20-2021 at 05:52.
lightphoenix2 is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 11-20-2021 , 11:02   Re: [L4D2] Increase damage done to Common Infected
Reply With Quote #2

You already marked it as "Solved" but some points here.

The victim is never a client if hooked from "infected" classname,
Since they are kinda "npcs", their indexes are not client-based and "GetClientTeam" will throw an error.

You can just check:

PHP Code:
if (!(<= attacker <= MaxClients))
    return 
Plugin_Continue;

if (
GetClientTeam(attacker)) == 3)
    return 
Plugin_Continue
I just don't remember if it does work for melee

Anyway TEAM 3 = INFECTED.
__________________

Last edited by Marttt; 11-20-2021 at 11:22.
Marttt is offline
lightphoenix2
Member
Join Date: Feb 2016
Old 11-20-2021 , 13:32   Re: [L4D2] Increase damage done to Common Infected
Reply With Quote #3

Quote:
Originally Posted by Marttt View Post
You already marked it as "Solved" but some points here.

The victim is never a client if hooked from "infected" classname,
Since they are kinda "npcs", their indexes are not client-based and "GetClientTeam" will throw an error.

You can just check:

PHP Code:
if (!(<= attacker <= MaxClients))
    return 
Plugin_Continue;

if (
GetClientTeam(attacker)) == 3)
    return 
Plugin_Continue
I just don't remember if it does work for melee

Anyway TEAM 3 = INFECTED.
Ah, I see, Thanks for the tip!
You check if it's the Player or the Special Infected. This would be quite helpful.
In the original statement, I was trying to detect friendly fire. But I can just do what you suggest as well.
lightphoenix2 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 03:32.


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