Raised This Month: $ Target: $400
 0% 

Add Admin immunity here?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
wAyz
Senior Member
Join Date: Feb 2010
Location: Germany
Old 10-30-2013 , 06:33   Add Admin immunity here?
Reply With Quote #1

Hi,

I just want to add immunity to the following plugin (so that admins are not effected by blockattack). Tried several things with get_user_flags etc, but didn't succeed.

Code:
#include <amxmodx>
#include <hamsandwich>

public plugin_init()
{
	register_plugin("Block Attack", "1.0", "LeOnArD");
	
	/*Aqui poner el nombre de las armas que quieras Bloquear.
	
	Here you put the name of the weapons that you want the Block.*/
	
	RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_knife", "PrimaryAttack" );
	RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_knife", "SecondaryAttack" );
	RegisterHam( Ham_Weapon_PrimaryAttack, "weapon_usp", "PrimaryAttack" );
	RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_usp", "SecondaryAttack" );
	
	/*Aqui estan las armas que le pueden Bloquear la Accion Secundaria.
	
	Here are the weapons that can Block the Secondary Action.*/
	
	RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_awp", "SecondaryAttack" );
	RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_scout", "SecondaryAttack" );
	RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_g3sg1", "SecondaryAttack" );
	RegisterHam( Ham_Weapon_SecondaryAttack, "weapon_sg550", "SecondaryAttack" );
}

public PrimaryAttack( const entity )
{
	return HAM_SUPERCEDE;
}

public SecondaryAttack( const entity )
{
	return HAM_SUPERCEDE;
}

Last edited by wAyz; 10-30-2013 at 06:34.
wAyz is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 10-30-2013 , 09:21   Re: Add Admin immunity here?
Reply With Quote #2

Because the passed entity index is the weapon entity index and not the player id.

PHP Code:
#include <amxmodx>
#include <hamsandwich>

const XO_CBASEPLAYERITEM 4;
const 
m_iId 43;

public 
plugin_init()
{
    
register_plugin("Block Attack""1.0""LeOnArD");
    
    
/*Aqui poner el nombre de las armas que quieras Bloquear.
    
    Here you put the name of the weapons that you want the Block.*/
    
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_knife""PrimaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_knife""SecondaryAttack" );
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_usp""PrimaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_usp""SecondaryAttack" );
    
    
/*Aqui estan las armas que le pueden Bloquear la Accion Secundaria.
    
    Here are the weapons that can Block the Secondary Action.*/
    
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_awp""SecondaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_scout""SecondaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_g3sg1""SecondaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_sg550""SecondaryAttack" );
}

public 
PrimaryAttack( const entity )
{
    static 
client;

    
client get_pdata_base(entitym_iIdXO_CBASEPLAYERITEM);

    if (!
is_user_alive(client))
        return 
HAM_IGNORED;

    if (
get_user_flags(client) & ADMIN_IMMUNITY)
        return 
HAM_IGNORED;

    return 
HAM_SUPERCEDE;
}

public 
SecondaryAttack( const entity )
{
    static 
client;

    
client get_pdata_base(entitym_iIdXO_CBASEPLAYERITEM);

    if (!
is_user_alive(client))
        return 
HAM_IGNORED;

    if (
get_user_flags(client) & ADMIN_IMMUNITY)
        return 
HAM_IGNORED;

    return 
HAM_SUPERCEDE;

__________________
simanovich is offline
wAyz
Senior Member
Join Date: Feb 2010
Location: Germany
Old 10-30-2013 , 11:39   Re: Add Admin immunity here?
Reply With Quote #3

Quote:
Originally Posted by simanovich View Post
Because the passed entity index is the weapon entity index and not the player id.

PHP Code:
#include <amxmodx>
#include <hamsandwich>

const XO_CBASEPLAYERITEM 4;
const 
m_iId 43;

public 
plugin_init()
{
    
register_plugin("Block Attack""1.0""LeOnArD");
    
    
/*Aqui poner el nombre de las armas que quieras Bloquear.
    
    Here you put the name of the weapons that you want the Block.*/
    
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_knife""PrimaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_knife""SecondaryAttack" );
    
RegisterHamHam_Weapon_PrimaryAttack"weapon_usp""PrimaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_usp""SecondaryAttack" );
    
    
/*Aqui estan las armas que le pueden Bloquear la Accion Secundaria.
    
    Here are the weapons that can Block the Secondary Action.*/
    
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_awp""SecondaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_scout""SecondaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_g3sg1""SecondaryAttack" );
    
RegisterHamHam_Weapon_SecondaryAttack"weapon_sg550""SecondaryAttack" );
}

public 
PrimaryAttack( const entity )
{
    static 
client;

    
client get_pdata_base(entitym_iIdXO_CBASEPLAYERITEM);

    if (!
is_user_alive(client))
        return 
HAM_IGNORED;

    if (
get_user_flags(client) & ADMIN_IMMUNITY)
        return 
HAM_IGNORED;

    return 
HAM_SUPERCEDE;
}

public 
SecondaryAttack( const entity )
{
    static 
client;

    
client get_pdata_base(entitym_iIdXO_CBASEPLAYERITEM);

    if (!
is_user_alive(client))
        return 
HAM_IGNORED;

    if (
get_user_flags(client) & ADMIN_IMMUNITY)
        return 
HAM_IGNORED;

    return 
HAM_SUPERCEDE;

I am getting an "undefined symbol" error: get_pdata_base
wAyz is offline
simanovich
AlliedModders Donor
Join Date: Jun 2012
Location: Israel
Old 10-30-2013 , 11:58   Re: Add Admin immunity here?
Reply With Quote #4

Quote:
Originally Posted by wAyz View Post
I am getting an "undefined symbol" error: get_pdata_base
Whoops

PHP Code:
get_pdata_base 
---------->
PHP Code:
get_pdata_cbase 
__________________
simanovich is offline
wAyz
Senior Member
Join Date: Feb 2010
Location: Germany
Old 10-30-2013 , 12:21   Re: Add Admin immunity here?
Reply With Quote #5

Code:
L 10/30/2013 - 17:20:01: [HAMSANDWICH] Function SecondaryAttack not found.
L 10/30/2013 - 17:20:01: [AMXX] Run time error 10 (plugin "blockattack.amxx") (native "RegisterHam") - debug not enabled!
L 10/30/2013 - 17:20:01: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
wAyz is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 10-30-2013 , 14:11   Add Admin immunity here?
Reply With Quote #6

Quote:
Originally Posted by wAyz View Post
Code:
L 10/30/2013 - 17:20:01: [HAMSANDWICH] Function SecondaryAttack not found.
L 10/30/2013 - 17:20:01: [AMXX] Run time error 10 (plugin "blockattack.amxx") (native "RegisterHam") - debug not enabled!
L 10/30/2013 - 17:20:01: [AMXX] To enable debug mode, add "debug" after the plugin name in plugins.ini (without quotes).
Did you make any changes?
__________________
Black Rose 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 23:19.


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