Raised This Month: $32 Target: $400
 8% 

Solved Entities damage


Post New Thread Reply   
 
Thread Tools Display Modes
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-27-2019 , 08:42   Re: Entities damage
Reply With Quote #11

Code:
#include <amxmodx> #include <hamsandwich> #include <fakemeta> public plugin_init() {     RegisterHam(Ham_TakeDamage, "info_target", "CBaseEntity_TakeDamage"); } public CBaseEntity_TakeDamage(this, pInflictor, pAttacker, Float:flDamage, bitsDamageType) {     if (!ExecuteHamB(Ham_IsPlayer, pAttacker) || pInflictor != pAttacker)         return HAM_IGNORED;     if (!FClassnameIs(this, "sentrygun") && !FClassnameIs(this, "nicedispenser"))         return HAM_IGNORED;     SetHamParamFloat(4, flDamage * 2.0);     return HAM_HANDLED; } bool:FClassnameIs(this, const szClassName[]) {     if (pev_valid(this) != 2)         return false;     new pszClassName[32];     pev(this, pev_classname, pszClassName, charsmax(pszClassName));     return bool:equal(szClassName, pszClassName); }
__________________








CrazY. is offline
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 02-28-2019 , 05:20   Re: Entities damage
Reply With Quote #12

Quote:
Originally Posted by crazy. View Post
Code:
#include <amxmodx> #include <hamsandwich> #include <fakemeta> public plugin_init() {     registerham(ham_takedamage, "info_target", "cbaseentity_takedamage"); } public cbaseentity_takedamage(this, pinflictor, pattacker, float:fldamage, bitsdamagetype) {     if (!executehamb(ham_isplayer, pattacker) || pinflictor != pattacker)         return ham_ignored;     if (!fclassnameis(this, "sentrygun") && !fclassnameis(this, "nicedispenser"))         return ham_ignored;     sethamparamfloat(4, fldamage * 2.0);     return ham_handled; } bool:fclassnameis(this, const szclassname[]) {     if (pev_valid(this) != 2)         return false;     new pszclassname[32];     pev(this, pev_classname, pszclassname, charsmax(pszclassname));     return bool:equal(szclassname, pszclassname); }
not working

Last edited by SHIELD755; 02-28-2019 at 06:10.
SHIELD755 is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 02-28-2019 , 08:19   Re: Entities damage
Reply With Quote #13

What is not working? Specify and debug the code if possible.
__________________









Last edited by CrazY.; 02-28-2019 at 08:42.
CrazY. is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 02-28-2019 , 11:38   Re: Entities damage
Reply With Quote #14

If your entities are not made to take damage then TakeDamage() won't even trigger.
__________________
HamletEagle is offline
Old 03-01-2019, 05:05
SHIELD755
This message has been deleted by SHIELD755.
SHIELD755
Veteran Member
Join Date: Feb 2018
Location: FROM MARVEL STUDIO
Old 03-01-2019 , 07:26   Re: Entities damage
Reply With Quote #15

SOLVED

the damage is working with CrAzY. code
i just forget to add "g_hasak"

and i also i try to made a code and this also work

it check whether enitity is valid
CODE:

PHP Code:
public pfn_touch(ptrptd ,attacker)

if (
pev_valid(ptr) &&( is_valid_playerattacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )) // check valid entity and user has gun
    
{    
        
// Get classnames
        
static classname[32]
        
pev(ptrpev_classnameclassname31)
         
//Get owner
            
new owner pev(ptrpev_owner)
            
// Alive...
            
new FM_NULLENT
            
//Damage
                
if( a!=owner&& a!=ptr&&pev(a,pev_takedamage)!=DAMAGE_NO && (is_valid_playerattacker ) && get_user_weapon(attacker) == CSW_AK47 && g_HasAk[attacker] )) 
                
ExecuteHamBHam_TakeDamage,owner ,owner100.0DMG_BULLET )
                
set_pev(ptrpev_flagsFL_KILLME)
            } 

THANKS

Last edited by SHIELD755; 03-01-2019 at 07:27.
SHIELD755 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 19:13.


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