Raised This Month: $ Target: $400
 0% 

500 health for 1 second after a kill?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bobs
Member
Join Date: Oct 2011
Old 07-29-2013 , 11:21   500 health for 1 second after a kill?
Reply With Quote #1

Hello, can some1 help me, it should not be a big plugin.
When a player kills an enemy, the player gets 500hp for 1 second to prevent another enemy to kills the player. Anti 1 vs 2. I would appreciate that, if some1 could make it!
Bobs is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 07-29-2013 , 11:28   Re: 500 health for 1 second after a kill?
Reply With Quote #2

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

#define IsPlayer(%1)        ( 1 <= %1 <= g_iMaxPlayers )
#define TIME_WITH_GODMODE    1.0        

new g_iMaxPlayers

public plugin_init( )
{
    
register_plugin"shit""version""author" )
    
    
g_iMaxPlayers get_maxplayers( )
    
    
register_event"DeathMsg" "Event_DeathMsg" "a" )
}

public 
Event_DeathMsg( )
{
    new 
iKiller read_data)
    new 
iVictim read_data)
    
    if( ( 
iKiller != iVictim ) && IsPlayeriKiller ) && IsPlayeriVictim ) && is_user_aliveiKiller ) && is_user_connectediVictim ) )
    {
        
set_user_godmodeiKiller)
        
set_taskTIME_WITH_GODMODE"Disable_Godmode"iKiller )
    }
}

public 
Disable_Godmodeid )
{    
    if( 
is_user_aliveid ) )
    {
        
set_user_godmodeid)
    }


Last edited by guipatinador; 07-29-2013 at 11:29.
guipatinador is offline
Bobs
Member
Join Date: Oct 2011
Old 07-29-2013 , 11:37   Re: 500 health for 1 second after a kill?
Reply With Quote #3

thanks working
Bobs is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-29-2013 , 12:56   Re: 500 health for 1 second after a kill?
Reply With Quote #4

Just to clarify, is there a need to check if the victim is a player and later checking being connected?
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 07-29-2013 , 14:51   Re: 500 health for 1 second after a kill?
Reply With Quote #5

Quote:
Originally Posted by bibu View Post
Just to clarify, is there a need to check if the victim is a player
I think is not necessary.

Quote:
and later checking being connected?
The killer could just disconnect, so its needed.

Last edited by guipatinador; 07-29-2013 at 14:51.
guipatinador is offline
bibu
Veteran Member
Join Date: Sep 2010
Old 07-29-2013 , 14:52   Re: 500 health for 1 second after a kill?
Reply With Quote #6

Quote:
Originally Posted by guipatinador View Post
The killer could just disconnect, so its needed.
Yes I know, but I meant both checks for the victim.
__________________
Selling tons of my own private works.
Accepting paid work for clans and communities.
Don't hesitate to contact me.
bibu is offline
guipatinador
SourceMod Donner Party
Join Date: Oct 2009
Location: Poortugal
Old 07-29-2013 , 14:58   Re: 500 health for 1 second after a kill?
Reply With Quote #7

Quote:
Originally Posted by bibu View Post
Yes I know, but I meant both checks for the victim.
Its not necessary.
I do a lot of checks always
guipatinador is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 07-30-2013 , 01:16   Re: 500 health for 1 second after a kill?
Reply With Quote #8

Quote:
Originally Posted by guipatinador View Post
Its not necessary.
I do a lot of checks always
Just remove them then.

PHP Code:
    register_event"DeathMsg" "Event_DeathMsg" "a" "1>0" )
}

public 
Event_DeathMsg( )
{
    new 
iKiller read_data)

    if( 
iKiller g_iMaxPlayers && is_user_aliveiKiller ) && iKiller != read_data) )
    {
        
set_user_godmodeiKiller)
        
remove_taskiKiller )
        
set_taskTIME_WITH_GODMODE"Disable_Godmode"iKiller )
    }

__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-30-2013 at 01:19.
ConnorMcLeod is offline
^SmileY
Veteran Member
Join Date: Jan 2010
Location: Brazil [<o>]
Old 07-29-2013 , 15:45   Re: 500 health for 1 second after a kill?
Reply With Quote #9

isPlayer macro implied in client connected ?

If yes, remove is_user_connected( iVictim ) no?
__________________
Projects:

- See my Git Hub: https://github.com/SmileYzn
PHP Code:
set_pcvar_num(pCvar, !get_pcvar_num(pCvar)); 
^SmileY is offline
Send a message via MSN to ^SmileY Send a message via Skype™ to ^SmileY
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 15:54.


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