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

Block Damage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-15-2012 , 17:36   Block Damage
Reply With Quote #1

Would this work to block damage for all players except admins?
PHP Code:
public fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if(!(
get_user_flags(attacker) & ADMIN_USER))
    {
    
//Victim is not lasermine.
    
new sz_classname[32]
    
entity_get_stringvictim EV_SZ_classname sz_classname 31 )
    if( !
equali(sz_classname,"lasermine") )
        return 
HAM_IGNORED;
    
    
//Attacker is zombie
    
if( zp_get_user_zombieattacker ) ) 
        return 
HAM_IGNORED;
    }
    
//Block Damage
    
return HAM_SUPERCEDE;

__________________
H.RED.ZONE is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-15-2012 , 17:40   Re: Block Damage
Reply With Quote #2

look how are you hooking the takedamage.
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-15-2012 , 17:45   Re: Block Damage
Reply With Quote #3

Quote:
Originally Posted by lucas_7_94 View Post
look how are you hooking the takedamage.
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <zombieplague>

#define PLUGIN    "[ZP] Addon : Laser Destroy Preventer"
#define AUTHOR    "Hezerf"
#define VERSION    "1.1"

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage,"func_breakable","fw_TakeDamage"ADMIN_USER);
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if(!(
get_user_flags(attacker) & ADMIN_USER))
    {
    
//Victim is not lasermine.
    
new sz_classname[32]
    
entity_get_stringvictim EV_SZ_classname sz_classname 31 )
    if( !
equali(sz_classname,"lasermine") )
        return 
HAM_IGNORED;
    
    
//Attacker is zombie
    
if( zp_get_user_zombieattacker ) ) 
        return 
HAM_IGNORED;
}
    
//Block Damage
    
return HAM_SUPERCEDE;

__________________
H.RED.ZONE is offline
DeWilX
Member
Join Date: Aug 2010
Location: Latvia, Saldus
Old 02-15-2012 , 18:04   Re: Block Damage
Reply With Quote #4

If you remove
Code:
if(!(get_user_flags(attacker) & ADMIN_USER))
than it will work for all people.
DeWilX is offline
Send a message via Skype™ to DeWilX
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-15-2012 , 18:13   Re: Block Damage
Reply With Quote #5

I know that but i want to block it only for admin_user not admins (players with flag Z)
So that admin is alowed to destroy but player is not.
__________________
H.RED.ZONE is offline
DeWilX
Member
Join Date: Aug 2010
Location: Latvia, Saldus
Old 02-15-2012 , 18:17   Re: Block Damage
Reply With Quote #6

Sorry I didn't understood you. There
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <engine>
#include <zombieplague>

#define PLUGIN    "[ZP] Addon : Laser Destroy Preventer"
#define AUTHOR    "Hezerf"
#define VERSION    "1.1"

#define ADMIN_USER ADMIN_LEVEL_B

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
RegisterHam(Ham_TakeDamage,"func_breakable","fw_TakeDamage"ADMIN_USER);
}

public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if(!(
get_user_flags(attacker) & ADMIN_USER))
    {
    
//Victim is not lasermine.
    
new sz_classname[32]
    
entity_get_stringvictim EV_SZ_classname sz_classname 31 )
    if( !
equali(sz_classname,"lasermine") )
        return 
HAM_IGNORED;
    
    
//Attacker is zombie
    
if( zp_get_user_zombieattacker ) ) 
        return 
HAM_IGNORED;
}
    
//Block Damage
    
return HAM_SUPERCEDE;

Change this to set which flag you want use
Code:
ADMIN_LEVEL_B

Last edited by DeWilX; 02-15-2012 at 18:18.
DeWilX is offline
Send a message via Skype™ to DeWilX
Old 02-15-2012, 18:38
H.RED.ZONE
This message has been deleted by H.RED.ZONE.
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-15-2012 , 19:06   Re: Block Damage
Reply With Quote #7

Nope that is not blocking it but you know what i want to do.
__________________

Last edited by H.RED.ZONE; 02-15-2012 at 19:18.
H.RED.ZONE is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 02-16-2012 , 06:01   Re: Block Damage
Reply With Quote #8

Do you tested the code ? ( i mean , the code by hezerf )
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
Old 02-16-2012, 08:00
zhulo
This message has been deleted by zhulo.
H.RED.ZONE
Veteran Member
Join Date: Sep 2011
Location: Serbia, Belgrade
Old 02-16-2012 , 10:33   Re: Block Damage
Reply With Quote #9

Quote:
Originally Posted by lucas_7_94 View Post
Do you tested the code ? ( i mean , the code by hezerf )
Yes i tested it and it doesent work it blocks damage for all players i want it to be blocked and that only admin can deal damage.
__________________

Last edited by H.RED.ZONE; 02-16-2012 at 10:33.
H.RED.ZONE is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-16-2012 , 10:42   Re: Block Damage
Reply With Quote #10

Quote:
Originally Posted by H.RED.ZONE View Post
only admin can deal damage.
To anything specific like players, lasermines, etc.?
Or they can be the only players to deal damage to anything?
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] 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 09:40.


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