AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   R Bullet (https://forums.alliedmods.net/showthread.php?t=148010)

ImXinR 01-17-2011 03:27

R Bullet
 
Reflection of dmg

Elusive138 01-17-2011 07:34

Re: Bullet Damage Reflector
 
This should be in the Plugin Requests section...

Anyway.
Untested.

amx_reflect
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>

#define PLUGIN "Damage Reflector"
#define VERSION "1.0"
#define AUTHOR "Elusive"

#define ACCESSLEVEL ADMIN_SLAY


//Thanks Bugsy
//Example: SetPlayerBit( BitFieldVar , # )
#define SetPlayerBit(%1,%2)      (%1 |= (1<<(%2&31)))
#define ClearPlayerBit(%1,%2)    (%1 &= ~(1 <<(%2&31)))
#define CheckPlayerBit(%1,%2)    (%1 & (1<<(%2&31)))

new gReflectbool:gRoundEnd


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("amx_reflect""CmdToggleReflect"ACCESSLEVEL"name or #userid")
    
RegisterHam(Ham_TakeDamage"player""FwdHamTakeDamage")
    
register_logevent("EventRoundStart"2"1=Round_Start")  
    
register_logevent("EventRoundEnd"2"1=Round_End")
}

public 
CmdToggleReflect(idlevelcid)
{
    if (!
cmd_access(idlevelcid2))
        return 
PLUGIN_CONTINUE
    
    
new args[32]
    
read_args(argscharsmax(args))
    
    new 
target cmd_target(idargsCMDTARGET_ALLOW_SELF)
    if (
CheckPlayerBit(gReflecttarget))
    {
        
ClearPlayerBit(gReflecttarget)
    }
    else
    {
        
SetPlayerBit(gReflecttarget)
    }
    
    return 
PLUGIN_HANDLED
}

public 
FwdHamTakeDamage(thisidinflictoridattacker)
{
    if (!
gRoundEnd && CheckPlayerBit(gReflectthis))
    {
        
SetHamParamEntity(1idattacker)
        
SetHamParamEntity(3this)
    }
}

public 
EventRoundStart()
{
    
gRoundEnd false
}

public 
EventRoundEnd()
{
    
gRoundEnd true



ANTICHRISTUS 01-17-2011 09:25

Re: Bullet Damage Reflector
 
Quote:

Originally Posted by Elusive138 (Post 1395395)
This should be in the Plugin Requests section...

try this too:
https://forums.alliedmods.net/showth...=mirror+damage
https://forums.alliedmods.net/showth...=mirror+damage

Elusive138 01-17-2011 10:10

Re: Bullet Damage Reflector
 
Quote:

Originally Posted by ANTICHRISTUS (Post 1395446)

The first is (probably) to reflect team attacks, the second is called a spawnkill punishment for a reason. Did you even read the whole post(s)?

ImXinR 01-18-2011 04:10

Re: Bullet Damage Reflector
 
Thanks! That works.


All times are GMT -4. The time now is 02:04.

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