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

[CS:GO] Damage being done to weapon_shield


Post New Thread Reply   
 
Thread Tools Display Modes
foxhound27
AlliedModders Donor
Join Date: Sep 2019
Location: Argentina
Old 12-16-2019 , 21:15   Re: [CS:GO] Damage being done to weapon_shield
Reply With Quote #11

if dsnt work try with

Code:
stock bool IsValidBullet(int weapon) {
	char WeaponName[64];
	GetEdictClassname(weapon, WeaponName, sizeof(WeaponName));
	return (StrEqual(WeaponName, "weapon_glock") || 
		StrEqual(WeaponName, "weapon_elite") || 
		StrEqual(WeaponName, "weapon_p250") || 
		StrEqual(WeaponName, "weapon_tec9") || 
		StrEqual(WeaponName, "weapon_cz75a"));
}
etc complete attacker weapon
foxhound27 is offline
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 12-17-2019 , 10:07   Re: [CS:GO] Damage being done to weapon_shield
Reply With Quote #12

PHP Code:

#include <sourcemod>
#include <sdkhooks>

public Plugin myinfo = {
    
name "ShieldDamage",
    
author "Foxhound27",
    
description "Announce shield damage",
    
version "1.0",
    
url " ><> "
};

public 
void OnEntityCreated(int entity, const char[] name)
{
    if (
StrEqual(name"weapon_shield"))
    {
        
SDKHook(entitySDKHook_OnTakeDamageShieldDamage);
    }
}

public 
Action ShieldDamage(int victimint attackerint inflictorfloat damageint damageTypeint weaponfloat damageForce[3], float damagePosition[3])
{
    if (
IsValidWeapon(weapon)) // maybe weapon != -1 is enough
    
{
        
PrintToChatAll("shield receiving damage from %N"attacker);

    }

    return 
Plugin_Continue;
}

stock bool IsValidWeapon(int weapon)
{
    if (
weapon == -1)
    {
        return 
false;
    }
    
    
char classname[64];
    
GetEdictClassname(weaponclassnamesizeof(classname));
    
    if (
strncmp(classname"weapon_"7true) == 0)
    {
        return 
true;
    }
    
    return 
false;

__________________
Ilusion9 is offline
foxhound27
AlliedModders Donor
Join Date: Sep 2019
Location: Argentina
Old 12-17-2019 , 12:18   Re: [CS:GO] Damage being done to weapon_shield
Reply With Quote #13

true or maybe like this

Code:
stock bool IsValidWeapon(int weapon)
{
    char classname[64];
    GetEdictClassname(weapon, classname, sizeof(classname));
    
    if (StrContains(classname, "weapon_") && weapon != -1)
    {
        return true;
    }
    
    return false;
}

Last edited by foxhound27; 12-17-2019 at 13:35.
foxhound27 is offline
ImACow
AlliedModders Donor
Join Date: Feb 2015
Old 02-25-2020 , 05:20   Re: [CS:GO] Damage being done to weapon_shield
Reply With Quote #14

Quote:
Originally Posted by 1337norway View Post
I never spent enough time to figure out a proper way. This is the last I worked on this.

PHP Code:
float GetShieldHealth(ent)
{
    return 
GetEntDataFloat(ent2832);

I'm trying to understand how/where got the offset 2832 from?

Thanks a bunch!

Quote:
Originally Posted by teoniiks View Post
The concept is to track all shield entitys that are created. Everytime a player shoots (you would hook pre and post) and check if any of the shield entitys have taken more damage. You make the shield have a really high "damage to break" value by setting it to start with -999999. Then if the last person to shoot was a teammate with the owner of the shield it wouldn't count. You manually add up non teammate's causing damage this way until sv_shield_hitpoints is reached. Then you force the damage to the value of sv_shield_hitpoints to break the shield like normal. This method should work pretty well as i couldn't get any of the entity hooks on damage to work. The Event_WeaponFire I use in this example is 1 bullet too late.

Indeed this seems the way to do it, thanks!
__________________
ImACow 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 02:13.


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