Raised This Month: $ Target: $400
 0% 

Ham_TakeDamage Pre issues


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 01-12-2014 , 13:31   Ham_TakeDamage Pre issues
Reply With Quote #1

I got a lil problem with this when i try to ignore the damage dealt to the victim, using SetHamParamFloat(4, 0.0) doesnt work, all normal damage is still being performed so then i tried to change the attackerid to the victimid so that zombie plague could not process this whole event as a possible infection. but this doesnt work neither.
Is it possible to change the damagebits to DMG_FALL and change the attackerid to the victimid? unless some1 can see why the damage would still be the normal damage, i dont see any other options.

Also the hamhook is not being executed on bots

PHP Code:
public plugin_init()
{
 
RegisterHam(Ham_TakeDamage"player""player_hurt_pre")
}
public 
player_hurt_pre(victiminflictorattackerFloat:damage)
{
 if( 
attacker <= || !pev_valid(attacker) || victim == attacker || !is_user_connected(attacker))
 {
  return 
HAM_IGNORED
 
}
 
 
//client_print(attacker, print_chat, "playerhurt_pre called, vic: %i & att: %i, vic zombie: %i, vic survivor: %i", victim, attacker, zp_get_user_zombie(victim), zp_get_user_survivor(victim))
 
new uspid get_weaponid("weapon_usp")
 new 
attweaponid get_user_weapon(attacker)
 
client_print(attackerprint_chat"good here 9, you need: %i, you have: %i"uspidattweaponid)
  
 if((
attweaponid == CSW_USP) && zp_get_user_zombie(attacker) )
 {
  
SetHamParamFloat(40.0)
  if ( !
zp_get_user_zombie(victim) && !zp_get_user_survivor(victim))
  {
   new 
cl_name[46]
   
get_user_name(victimcl_namesizeof(cl_name))
    
   
client_print(attackerprint_chat"good here 9.2, bool: %i, your zombie class: %i, you need: %i"g_bHas_T_pistol[attacker], zp_get_user_zombie_class(attacker), g_zclass_cell)
   
   if( 
g_bHas_T_pistol[attacker] && zp_get_user_zombie_class(attacker) == g_zclass_cell) )
   {
    
client_print(attackerprint_chat"good here 10")
    if( 
g_bHasImmunity[victim] )
    {
     
client_print(victimprint_chat"[ZP] Your Immunity against sleeper cell mutagens has succesfully warded off a mutagen attack.")
     
client_print(attackerprint_chat"[ZP] %s has immunity against your sleeper cell mutagens"cl_name)
     return 
HAM_SUPERCEDE
    
}
    
    if( !
task_exists(victim TASK_CHECKHITS) )
    {
     
set_task(3.0"Check_vichits",victim TASK_CHECKHITS)
    }
    
g_Thits[victim]++
    
g_Thitsattacker[victim] = attacker
        
    client_print
(attackerprint_chat"[ZP] Your T-Virus cell has hit %s, total hits on this player: %i"cl_nameg_Thits[victim])
   
   }
  }
  
SetHamParamInteger(3victim)
  return 
HAM_SUPERCEDE
 
}
 
 return 
HAM_HANDLED

__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]

Last edited by striker07; 01-13-2014 at 18:26.
striker07 is offline
NiHiLaNTh
Way Past Expiration
Join Date: May 2009
Location: Latvia
Old 01-12-2014 , 14:34   Re: Ham_TakeDamage Pre issues
Reply With Quote #2

for bots you have to use RegisterHamFromEntity
__________________

NiHiLaNTh is offline
Send a message via Skype™ to NiHiLaNTh
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 01-13-2014 , 01:17   Re: Ham_TakeDamage Pre issues
Reply With Quote #3

If you want that another plugin than the one you are showing can detect that your plugin has blocked the function, then you have to declare your plugin before the second one in plugins.ini

And in the other plugin (main ZP plugin from what i understand), you have to check the return status when the forward is called

if( GetHamReturnStatus() == HAM_SUPERCEDE ) return;

Something like that.



Also, in your code, 1st return should be HAM_IGNORED (you don't do anything), seconde return is correct (you want to block damage), and last return should be HAM_HANDLED (you have changed something but you don't want to block).
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 01-13-2014 , 11:23   Re: Ham_TakeDamage Pre issues
Reply With Quote #4

Quote:
Originally Posted by NiHiLaNTh View Post
for bots you have to use RegisterHamFromEntity
in client_authorized forward right?

Quote:
Originally Posted by ConnorMcLeod View Post
If you want that another plugin than the one you are showing can detect that your plugin has blocked the function, then you have to declare your plugin before the second one in plugins.ini
so zombie_plague.amxx should come after my zombieclass in plugins.ini, that wont give problems?

Quote:
Originally Posted by ConnorMcLeod View Post
And in the other plugin (main ZP plugin from what i understand), you have to check the return status when the forward is called

if( GetHamReturnStatus() == HAM_SUPERCEDE ) return;

Something like that.
But I am using a forward from hamsandwich, not a forward from ZP so how can i do that?
In Ham_TakeDamage pre hook from zombieplague? will the main zp be able to pick up on the returned value from my zombieclass because my class loaded first, then zp?


Quote:
Originally Posted by ConnorMcLeod View Post
Also, in your code, 1st return should be HAM_IGNORED (you don't do anything), seconde return is correct (you want to block damage), and last return should be HAM_HANDLED (you have changed something but you don't want to block).
Ok ill try to keep that in mind. but when the forward comes from a custom plugin, the coder should still implement the possible return vallues to act on them? the return vallues are not by default in every plugin if it uses hamsandwich?

Thanks for the help so far guys
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]
striker07 is offline
striker07
Veteran Member
Join Date: Mar 2012
Location: Solar System/Earth/Belgi
Old 01-13-2014 , 20:27   Re: Ham_TakeDamage Pre issues
Reply With Quote #5

I did what you said connor and everything works now, also thanks to your ham_register_czbots plugin you gave me a while ago the ham is also being activated for bots, everything finnally works as it should.
thanks for the help !
__________________

Working on:
[CSGO/CSS] Mmorpg - an extensive XP/level modulair platform
Progress: [♣♣♣♣♣♣♣|♣♣♣]
striker07 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 10:09.


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