AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how can i add this 2 case? (https://forums.alliedmods.net/showthread.php?t=159619)

2reason2kill 06-19-2011 13:25

how can i add this 2 case?
 
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?

bibu 06-19-2011 13:34

Re: how can i add this 2 case?
 
What?

2reason2kill 06-19-2011 13:43

Re: how can i add this 2 case?
 
Quote:

Originally Posted by bibu (Post 1491607)
What?

I want to add that 2

PHP Code:

        case 1:
        {
//here 2 add block damage



Exolent[jNr] 06-19-2011 14:18

Re: how can i add this 2 case?
 
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.

2reason2kill 06-19-2011 14:48

Re: how can i add this 2 case?
 
Quote:

Originally Posted by Exolent[jNr] (Post 1491636)
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?

fysiks 06-19-2011 15:58

Re: how can i add this 2 case?
 
This must be related to some other thread/code because I'm lost on this one.

Quote:

Originally Posted by 2reason2kill (Post 1491650)
Im trying 2 add block deagle damage 2 case when some1 buy it.

You have a keyboard, use it. Stop using numbers as words.

2reason2kill 06-19-2011 16:00

Re: how can i add this 2 case?
 
Quote:

Originally Posted by fysiks (Post 1491697)
This must be related to some other thread/code because I'm lost on this one.



You have a keyboard, use it. Stop using numbers as words.

Okay, But where did u lost it?

Exolent[jNr] 06-19-2011 16:19

Re: how can i add this 2 case?
 
Quote:

Originally Posted by 2reason2kill (Post 1491650)
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.

2reason2kill 06-19-2011 16:31

Re: how can i add this 2 case?
 
Quote:

Originally Posted by Exolent[jNr] (Post 1491712)
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.

Is This Right?

PHP Code:

public fwTakeDamagevictim inflictor attacker Float:damage damage_bits )
{
    if(
is_user_alive(id) )
        {
            if(
g_bBoght[id][anti_deagle] = true)
            {
                
                if( 
IsPlayerattacker ) && is_user_aliveattacker ) && inflictor == attacker && ( get_user_weapon(attacker) == CSW_DEAGLE ) )
                {
                    return 
HAM_SUPERCEDE;
                }
                
    
            return 
HAM_IGNORED;
            }
    }


Code:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team


Error: Undefined symbol "id" on line 398
Error: Undefined symbol "id" on line 400



2 Errors.

Please Explian To me what's Wrong.

fysiks 06-19-2011 16:38

Re: how can i add this 2 case?
 
This:
Quote:

Originally Posted by Exolent[jNr] (Post 1491636)
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 (Post 1491717)
Please Explian To me what's Wrong.

The error clearly tells you what is wrong.


All times are GMT -4. The time now is 23:28.

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