Raised This Month: $ Target: $400
 0% 

how can i add this 2 case?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-19-2011 , 13:25   how can i add this 2 case?
Reply With Quote #1

PHP Code:
#define IsPlayer(%1) ( 1 <= %1 <= g_iMaxPlayers )

    
RegisterHamHam_TakeDamage "player" "fwTakeDamage" )
    
g_iMaxPlayers get_maxplayers()


public 
fwTakeDamagevictim inflictor attacker Float:damage damage_bits )
{
    if( 
IsPlayerattacker ) && is_user_aliveattacker ) && inflictor == attacker && ( get_user_weapon(attacker) == CSW_DEAGLE ) )
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

How can i add that to case?
2reason2kill is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 06-19-2011 , 13:34   Re: how can i add this 2 case?
Reply With Quote #2

What?
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-19-2011 , 13:43   Re: how can i add this 2 case?
Reply With Quote #3

Quote:
Originally Posted by bibu View Post
What?
I want to add that 2

PHP Code:
        case 1:
        {
//here 2 add block damage

2reason2kill is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-19-2011 , 14:18   Re: how can i add this 2 case?
Reply With Quote #4

You need to create a global array that is indexed by a player index.
PHP Code:
case 2:
{
    
g_yourGlobalArray[id] = true

Then check that array in the damage handler.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-19-2011 , 14:48   Re: how can i add this 2 case?
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
You need to create a global array that is indexed by a player index.
PHP Code:
case 2:
{
    
g_yourGlobalArray[id] = true

Then check that array in the damage handler.
Im trying 2 add block deagle damage 2 case when some1 buy it.

and like this?

PHP Code:
public fwTakeDamagevictim inflictor attacker Float:damage damage_bits )
{
    if( 
IsPlayerattacker ) && is_user_aliveattacker ) && inflictor == attacker && ( get_user_weapon(attacker) == CSW_DEAGLE ) )
g_ibought[id][antideagle] = true;
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

like that?
2reason2kill is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-19-2011 , 15:58   Re: how can i add this 2 case?
Reply With Quote #6

This must be related to some other thread/code because I'm lost on this one.

Quote:
Originally Posted by 2reason2kill View Post
Im trying 2 add block deagle damage 2 case when some1 buy it.
You have a keyboard, use it. Stop using numbers as words.
__________________
fysiks is online now
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 06-19-2011 , 16:19   Re: how can i add this 2 case?
Reply With Quote #7

Quote:
Originally Posted by 2reason2kill View Post
and like this?

PHP Code:
public fwTakeDamagevictim inflictor attacker Float:damage damage_bits )
{
    if( 
IsPlayerattacker ) && is_user_aliveattacker ) && inflictor == attacker && ( get_user_weapon(attacker) == CSW_DEAGLE ) )
g_ibought[id][antideagle] = true;
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

like that?
No. My code was how to set that the player has it.
You have to check if the player has it in that if statement inside the damage forward.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-19-2011 , 16:38   Re: how can i add this 2 case?
Reply With Quote #8

This:
Quote:
Originally Posted by Exolent[jNr] View Post
You need to create a global array that is indexed by a player index.
PHP Code:
case 2:
{
    
g_yourGlobalArray[id] = true

And this:

PHP Code:
public fwTakeDamagevictim inflictor attacker Float:damage damage_bits )
{
    if( 
g_yourGlobalArray[victim] && IsPlayerattacker ) && is_user_aliveattacker ) && inflictor == attacker && ( get_user_weapon(attacker) == CSW_DEAGLE ) )
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

(I think)

Quote:
Originally Posted by 2reason2kill View Post
Please Explian To me what's Wrong.
The error clearly tells you what is wrong.
__________________
fysiks is online now
Old 06-19-2011, 16:48
2reason2kill
This message has been deleted by 2reason2kill.
2reason2kill
Senior Member
Join Date: Feb 2011
Old 06-19-2011 , 16:51   Re: how can i add this 2 case?
Reply With Quote #10

Quote:
Originally Posted by fysiks View Post
This:


And this:

PHP Code:
public fwTakeDamagevictim inflictor attacker Float:damage damage_bits )
{
    if( 
g_yourGlobalArray[victim] && IsPlayerattacker ) && is_user_aliveattacker ) && inflictor == attacker && ( get_user_weapon(attacker) == CSW_DEAGLE ) )
    {
        return 
HAM_SUPERCEDE;
    }
    
    return 
HAM_IGNORED;

(I think)



The error clearly tells you what is wrong.
Thank you
2reason2kill is offline
Reply


Thread Tools
Display Modes

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 23:28.


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