Raised This Month: $ Target: $400
 0% 

ham_takedamage prob


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
r0ck
Senior Member
Join Date: Jun 2011
Location: India
Old 09-19-2011 , 12:25   ham_takedamage prob
Reply With Quote #1

i'm using

PHP Code:
#define DMG_GRENADE            (1 << 24)

RegisterHam(Ham_TakeDamage"player""ham_damage")

public 
ham_damage(victimentattackerFloat:damagebits)
{
    if(!
is_user_connected(attacker) || victim == attacker)
        return 
HAM_IGNORED
        
    
if(cs_get_user_team(attacker) == CS_TEAM_T && cs_get_user_team(victim) == CS_TEAM_T && bits DMG_GRENADE)
    {
        
SetHamParamFloat(4damage 2)
        return 
HAM_OVERRIDE
    
}

But the problem is that when t's throw grenade on t's it sets half the damage(thats what i want) but if t's throw grenade of cts then too its half damage i want that if attacker is t and victim is t then only grenade damage half

thanks
__________________
Preparing to release my plugins..
r0ck is offline
a7811311622
Member
Join Date: Apr 2010
Old 09-19-2011 , 12:59   Re: ham_takedamage prob
Reply With Quote #2

Try to delete "return HAM_OVERRIDE".
__________________
a7811311622 is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-19-2011 , 17:09   Re: ham_takedamage prob
Reply With Quote #3

I don't think you're checking for the right damagebit, try DMG_HEGRENADE (define it as (1<<24) ) or DMG_BLAST.

EDIT: wow I didn't see it beeing defined =) I thoght DMG_GRENADE already exists tough.
__________________

Last edited by Hunter-Digital; 09-19-2011 at 18:20.
Hunter-Digital is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 09-19-2011 , 17:41   Re: ham_takedamage prob
Reply With Quote #4

The bit is right, and he uses already DMG_GRENADE.

I don't find problems in your code except HAM_OVERRIDE is useless and should be removed. I don't see how you can have this problem with such check.
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 09-19-2011 , 18:05   Re: ham_takedamage prob
Reply With Quote #5

He is checking the correct damage bit. Try debugging this yourself r0ck. Do some server/client_prints of the values you are checking. You will eventually find when something is not what you thought then you know what needs to be fixed.

Edit: I'll click refresh before posting next time.
__________________
Bugsy is offline
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-19-2011 , 18:28   Re: ham_takedamage prob
Reply With Quote #6

Yes, so blind of me xD

Anyway, I tested the code and it seems to work just fine, I naded some of my podbot teammates while T and the message I added in the condition triggered.

And you should rearange conditions so it doesn't call if not required:
PHP Code:
public ham_damage(victimentattackerFloat:damagebits)
{
    if(
bits DMG_GRENADE && victim != attacker && is_user_connected(attacker) && cs_get_user_team(attacker) == CS_TEAM_T && cs_get_user_team(victim) == CS_TEAM_T)
        
SetHamParamFloat(4damage 2)

Also, you only want it for T's and not CT's aswell ?
__________________
Hunter-Digital 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:35.


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