Raised This Month: $95 Target: $400
 23% 

[HL] Anti Self-Gauss


Post New Thread Reply   
 
Thread Tools Display Modes
Plugin Info:     Modification:   Half-Life        Category:   Gameplay        Approver:   Hawk552 (427)
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 02-15-2010 , 06:35   [HL] Anti Self-Gauss
Reply With Quote #1

Half-Life Anti Self-Gauss





Description:

This plugin was made to disable self-gauss (accidental back reflection of the Gauss Gun ray) in Half-Life, mods with weapon_gauss

Cvar's:
antisg_on 1 (default: 0) turns the plug-in on
antisg_on 1 (default: 0) turns on the message about suppresed self-gauss power


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

#define PLUGIN     "Anti_Self-Gauss"
#define VERSION "1.0"
#define AUTHOR "Flipper_SPb"

new allowmessg
new  e_class[64]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_cvar("antisg_version"VERSION FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_SPONLY)
    
allow register_cvar("antisg_on""0")  // plugin on/off
    
messg register_cvar("antisg_msg""0"// self-gauss message
    
RegisterHam(Ham_TakeDamage"player""fw_TakeDamage")
}


public 
fw_TakeDamage(victiminflictorattackerFloat:damagedamage_type)
{
    if(
attacker != victim || !(<= attacker <= 32) || !get_pcvar_num(allow))
        return 
HAM_IGNORED

    entity_get_string
(inflictorEV_SZ_classnamee_class63)
    
    if (
attacker == inflictor || equal(e_class"weapon_gauss"))
    {
        if(
damage && get_pcvar_num(messg))
            
client_print(attackerprint_chat"* You got the self-gauss with power: %d"floatround(damage))
        return 
HAM_SUPERCEDE
    
}
    return 
HAM_IGNORED

Attached Files
File Type: sma Get Plugin or Get Source (antisg.sma - 2343 views - 1.2 KB)

Last edited by Flipper_SPb; 04-19-2010 at 08:57.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
Freejam
Junior Member
Join Date: Sep 2009
Old 02-15-2010 , 11:15   Re: [HL] Anti Self-Gauss
Reply With Quote #2

o0

Very nice plugin.I thought this is impossible.
Freejam is offline
xPaw
Retired AMX Mod X Moderator
Join Date: Jul 2008
Old 02-15-2010 , 11:22   Re: [HL] Anti Self-Gauss
Reply With Quote #3

Remove equal(class, "player"), and move cvar check (allow) to end of if() so it would check your conditions first and after that call a native
__________________
xPaw is offline
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 02-15-2010 , 11:28   Re: [HL] Anti Self-Gauss
Reply With Quote #4

Quote:
Originally Posted by xPaw View Post
Remove equal(class, "player"), and move cvar check (allow) to end of if() so it would check your conditions first and after that call a native

I've added equal(class, "player") because in some cases of sef-gauss damage entity_get_string(inflictor, EV_SZ_classname, class, 63) returns "player". I don't know other situations, when I can get "player". If I remove, I will get self-gauss sometime.

Last edited by Flipper_SPb; 02-15-2010 at 11:32.
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 02-15-2010 , 11:31   Re: [HL] Anti Self-Gauss
Reply With Quote #5

Quote:
Originally Posted by xPaw View Post
and move cvar check (allow) to end of if() so it would check your conditions first and after that call a native
Like that:

PHP Code:
if(attacker != victim || !(<= attacker <= 32) || !get_pcvar_num(allow)) 
?
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
KORD_12.7
Senior Member
Join Date: Aug 2009
Location: Russia, Vladivostok
Old 02-16-2010 , 21:54   Re: [HL] Anti Self-Gauss
Reply With Quote #6

Nice job!
KORD_12.7 is offline
Send a message via ICQ to KORD_12.7
Flipper_SPb
Senior Member
Join Date: Jun 2009
Location: Worldspawn
Old 02-18-2010 , 05:06   Re: [HL] Anti Self-Gauss
Reply With Quote #7

Thanks;)
Flipper_SPb is offline
Send a message via ICQ to Flipper_SPb
Anggara_nothing
Veteran Member
Join Date: Jan 2009
Location: Indonesia
Old 02-22-2010 , 04:14   Re: [HL] Anti Self-Gauss
Reply With Quote #8

Quote:
Originally Posted by KORD_12.7 View Post
Nice job!
Anggara_nothing is offline
hcxx
Senior Member
Join Date: Jan 2007
Location: 127.0.0.1
Old 02-22-2010 , 04:18   Re: [HL] Anti Self-Gauss
Reply With Quote #9

always nice to see new hldm plugins in here thx.
hcxx is offline
Hawk552
AMX Mod X Moderator
Join Date: Aug 2005
Old 04-02-2010 , 19:36   Re: [HL] Anti Self-Gauss
Reply With Quote #10

This plugin is well done.

If you would like any information regarding possible adjustments you could make or things you could do to make this better, please feel free to post here or PM me.

Approved.
__________________
Hawk552 is offline
Send a message via AIM to Hawk552
Reply


Thread Tools
Display Modes

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 13:53.


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