AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED] My own spawn protection (https://forums.alliedmods.net/showthread.php?t=94167)

TitANious 06-07-2009 11:35

[SOLVED] My own spawn protection
 
I've registered
PHP Code:

public fwHamSpawn id )
{
    if ( ( 
get_roundtime >= ) && ( is_user_alive id ) )
    {
        
set_user_godmode id)
    } 
    else 
    {
        
set_user_godmode id)
    }


wrong. Is it better with a task?

Dr.G 06-07-2009 11:38

Re: My own spawn protection
 
maybe this will help ya http://www.dodplugins.net/forums/showthread.php?t=1546

Bugsy 06-07-2009 11:50

Re: My own spawn protection
 
You can do this a number of ways.

PHP Code:

#include <amxmodx> 
#include <hamsandwich> 

new g_MaxPlayers;
new 
g_FreezeTime;

#define IsPlayer(%1)  ( 1 <= %1 <= g_MaxPlayers ) 

public plugin_init()  
{
    
register_plugin"Spawn Protection""1.0""bugsy" );
    
    
RegisterHamHam_TakeDamage"player""fw_HamTakeDamage" );
    
    
register_event"HLTV" "NewRound" "a" "1=0" "2=0" );
    
register_logevent"RoundStart" "1=Round_Start" );
    
    
g_MaxPlayers get_maxplayers();
}

public 
NewRound()
{
    
g_FreezeTime 1;
}

public 
RoundStart()
{
    
g_FreezeTime 0;
}

public 
fw_HamTakeDamage( const iVictim, const iAttacker, const iInflictor, const FloatfDamage, const iDamageBits )
{     
    return ( 
g_FreezeTime && IsPlayeriAttacker ) ) ? HAM_SUPERCEDE HAM_IGNORED;



TitANious 06-07-2009 11:52

Re: My own spawn protection
 
This simple it got :)
PHP Code:

// Spawn Protection
public fwHamSpawn id )
{
    if ( 
is_user_alive id ) )
    {
        
set_user_godmode id)
        
set_task 4.0"RemoveSpawnProtection")
    }
}

public 
RemoveSpawnProtection id )
{
    
set_user_godmode id)


Thanks all it should now be [SOLVED]

xPaw 06-07-2009 12:51

Re: [SOLVED] My own spawn protection
 
Godmode not ok :P Block damage from players - ok.


All times are GMT -4. The time now is 13:48.

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