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

Double Damage don't work


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
pentakill
Member
Join Date: Oct 2014
Old 10-06-2014 , 14:26   Double Damage don't work
Reply With Quote #1

So, I have a weapons menu, and the player can choose the normal menu, gold menu and super menu

Gold menu weapons take double damage, and super take 3x damage

PHP Code:
public Damage(victiminflictorattackerFloat:damagedamagebits

    if(
is_user_connected(victim) || is_user_alive(victim))  
    { 
        if( 
get_user_weapon(attacker) == CSW_AK47 )
        {
            if (
AreGoldenAk[attacker])
            {
                
SetHamParamFloat4damage )
                return 
HAM_HANDLED
            
}
            if (
AreSuperAk[attacker])
            {
                
SetHamParamFloat4damage 3)
                return 
HAM_HANDLED
            
}
        }
    }
    return 
HAM_IGNORED

But this isn't working and I don't know why...

I use the same bools (AreGoldenAk and AreSuperAk) to change the skins and works!

Can someone help me?

Last edited by pentakill; 10-06-2014 at 14:26.
pentakill is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 10-06-2014 , 14:33   Re: Double Damage don't work
Reply With Quote #2

Give us full code or explain better what you mean by not working, because it's not something wrong with the code you posted, just: is_user_connected(victim) || is_user_alive(victim) is should be &&
__________________
HamletEagle is offline
pentakill
Member
Join Date: Oct 2014
Old 10-06-2014 , 14:35   Re: Double Damage don't work
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
Give us full code or explain better what you mean by not working, because it's not something wrong with the code you posted, just: is_user_connected(victim) || is_user_alive(victim) is should be &&
I gave all the informations, what you want to know more?

&& and || have the same function I think, for me works fine using ||

Last edited by pentakill; 10-06-2014 at 14:36.
pentakill is offline
Balck
Senior Member
Join Date: Apr 2013
Location: Kosova-Mitrovica
Old 10-06-2014 , 14:55   Re: Double Damage don't work
Reply With Quote #4

Quote:
Originally Posted by pentakill View Post
&& and || have the same function I think, for me works fine using ||

|| == or
&& == and
so it's not the same
__________________

Last edited by Balck; 10-06-2014 at 14:58.
Balck is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-06-2014 , 15:36   Re: Double Damage don't work
Reply With Quote #5

oh I see you guys didn't notice he's returning HAM_HANDLED instead of HAM_SUPERCEDE and not overwriting the normal damage inflicted

gotta pay more attention next time
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 10-06-2014 , 16:19   Re: Double Damage don't work
Reply With Quote #6

Quote:
Originally Posted by aron9forever View Post
oh I see you guys didn't notice he's returning HAM_HANDLED instead of HAM_SUPERCEDE and not overwriting the normal damage inflicted

gotta pay more attention next time
HAM_SUPERCEDE blocks the function, definitely not what he wants.

you don't have to check if user is connected when you use is_user_alive(), it already checks that.
post how you are hooking ham_takedamage

Last edited by jimaway; 10-06-2014 at 16:19.
jimaway is offline
pentakill
Member
Join Date: Oct 2014
Old 10-06-2014 , 16:32   Re: Double Damage don't work
Reply With Quote #7

Quote:
Originally Posted by jimaway View Post
you don't have to check if user is connected when you use is_user_alive(), it already checks that.
Big mistake, edited to only check is_user_alive

Quote:
Originally Posted by jimaway View Post
post how you are hooking ham_takedamage
RegisterHam(Ham_TakeDamage, "player", "Damage")

EDITED: I don't know what I've done, but know the plugin works! Thanks anyway

Last edited by pentakill; 10-06-2014 at 16:35.
pentakill is offline
Decak
Senior Member
Join Date: Sep 2012
Old 10-06-2014 , 17:46   Re: Double Damage don't work
Reply With Quote #8

Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

new bool:AreGoldenAk[33], bool:AreSuperAk[33];

public plugin_init() {
    register_plugin("Register Name", "1.0", "Author")
    RegisterHam(Ham_TakeDamage, "player", "Damage")
}

public Damage(victim, inflictor, attacker, Float:damage, damagebits) 
{ 
    if(is_user_connected(victim) || is_user_alive(victim))  
    { 
        if( get_user_weapon(attacker) == CSW_AK47 )
        {
            if (AreGoldenAk[attacker])
            {
                SetHamParamFloat( 4, damage * 2 )
                return HAM_HANDLED
            }
            if (AreSuperAk[attacker])
            {
                SetHamParamFloat( 4, damage * 3)
                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}
... add code with bool AreGoldenAk and AreSuperAk.
Decak is offline
pentakill
Member
Join Date: Oct 2014
Old 10-06-2014 , 18:22   Re: Double Damage don't work
Reply With Quote #9

Quote:
Originally Posted by Decak View Post
Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

new bool:AreGoldenAk[33], bool:AreSuperAk[33];

public plugin_init() {
    register_plugin("Register Name", "1.0", "Author")
    RegisterHam(Ham_TakeDamage, "player", "Damage")
}

public Damage(victim, inflictor, attacker, Float:damage, damagebits) 
{ 
    if(is_user_connected(victim) || is_user_alive(victim))  
    { 
        if( get_user_weapon(attacker) == CSW_AK47 )
        {
            if (AreGoldenAk[attacker])
            {
                SetHamParamFloat( 4, damage * 2 )
                return HAM_HANDLED
            }
            if (AreSuperAk[attacker])
            {
                SetHamParamFloat( 4, damage * 3)
                return HAM_HANDLED
            }
        }
    }
    return HAM_IGNORED
}
... add code with bool AreGoldenAk and AreSuperAk.
My plugin already works but thanks anyway
pentakill is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-07-2014 , 07:28   Re: Double Damage don't work
Reply With Quote #10

Quote:
Originally Posted by jimaway View Post
HAM_SUPERCEDE blocks the function, definitely not what he wants.

you don't have to check if user is connected when you use is_user_alive(), it already checks that.
post how you are hooking ham_takedamage
woops, sorry, I was high as fuck , that's when I start shitposting
he still needs return HAM_OVERRIDE instead of supercede
__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever 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 17:56.


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