AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Possible or Impossible? (https://forums.alliedmods.net/showthread.php?t=249756)

omgdpcwtf 10-11-2014 12:45

Possible or Impossible?
 
Hi,
how make protection for 2 players during duel on deathrun? More precisely other alive players(CTs) cant kill T which has duel with choosen CT. But they can kill themselves. I didnt fin anything about this possibility. I will be grateful for every advice thanks.

YamiKaitou 10-11-2014 12:53

Re: Possible or Impossible?
 
Hook the Damage event in Pre and check who the attacker is. If the attacker is not part of the duel, block the damage.

HamletEagle 10-11-2014 13:24

Re: Possible or Impossible?
 
Quote:

Originally Posted by YamiKaitou (Post 2209868)
Hook the Damage event in Pre and check who the attacker is. If the attacker is not part of the duel, block the damage.

In deep:
1. Hook Ham_TakeDamage as pre.
2. Check if the damage comes from other players, a bool like in_duel[33] or by backuping players ids( the ones that are dueling )
3. Return HAM_SUPERCEDE to block the function.

omgdpcwtf 10-12-2014 05:19

Re: Possible or Impossible?
 
Got it, CTs cant kill T during duel but T can kill other CTs. How to solve it?

CT_Player = id
T_Player = T

Code:

public player_attack(victim, attacker, Float:damage, Float:direction[3], tracehandle, damagebits)
{
        if(!is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
                return HAM_IGNORED
               
        if( (CT_Player != attacker ) && ( T_Player != attacker ) )
        {
                if( ( CT_Player == victim ) || ( T_Player == victim ) )
                return HAM_SUPERCEDE;
        }
        return HAM_IGNORED
}


jimaway 10-12-2014 18:09

Re: Possible or Impossible?
 
when you block only takedamage, other players can still interfere by applying aimpunch, i think this can be stopped when you also block traceattack

aron9forever 10-13-2014 02:37

Re: Possible or Impossible?
 
Quote:

Originally Posted by jimaway (Post 2210361)
when you block only takedamage, other players can still interfere by applying aimpunch, i think this can be stopped when you also block traceattack

dass true mane

Natsheh 10-13-2014 17:15

Re: Possible or Impossible?
 
PHP Code:

New bool:inDuel[33]
// add this to plugin init
RegisterHam(Ham_TakeDamage"player"player_damage1)

public 
player_damage(victimattackerFloat:damageFloat:direction[3], tracehandledamagebits)
{
 if(!
is_user_connected(victim) || !is_user_connected(attacker) || victim == attacker)
          return 
HAM_IGNORED
 
if(!inDuel[attacker] || !inDuel[victim])
          return 
HAM_SUPERCED    
 
return HAM_IGNORED




All times are GMT -4. The time now is 17:30.

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