AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   500 health for 1 second after a kill? (https://forums.alliedmods.net/showthread.php?t=222061)

Bobs 07-29-2013 11:21

500 health for 1 second after a kill?
 
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!

guipatinador 07-29-2013 11:28

Re: 500 health for 1 second after a kill?
 
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)
    }



Bobs 07-29-2013 11:37

Re: 500 health for 1 second after a kill?
 
thanks working

bibu 07-29-2013 12:56

Re: 500 health for 1 second after a kill?
 
Just to clarify, is there a need to check if the victim is a player and later checking being connected?

guipatinador 07-29-2013 14:51

Re: 500 health for 1 second after a kill?
 
Quote:

Originally Posted by bibu (Post 2001503)
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.

bibu 07-29-2013 14:52

Re: 500 health for 1 second after a kill?
 
Quote:

Originally Posted by guipatinador (Post 2001588)
The killer could just disconnect, so its needed.

Yes I know, but I meant both checks for the victim.

guipatinador 07-29-2013 14:58

Re: 500 health for 1 second after a kill?
 
Quote:

Originally Posted by bibu (Post 2001590)
Yes I know, but I meant both checks for the victim.

Its not necessary.
I do a lot of checks always :)

^SmileY 07-29-2013 15:45

Re: 500 health for 1 second after a kill?
 
isPlayer macro implied in client connected ?

If yes, remove is_user_connected( iVictim ) no?

ConnorMcLeod 07-30-2013 01:16

Re: 500 health for 1 second after a kill?
 
Quote:

Originally Posted by guipatinador (Post 2001594)
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 )
    }




All times are GMT -4. The time now is 15:54.

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