diff options
Diffstat (limited to 'Northstar.CustomServers/mod/scripts/vscripts/_respawn_protection.gnut')
-rw-r--r-- | Northstar.CustomServers/mod/scripts/vscripts/_respawn_protection.gnut | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/Northstar.CustomServers/mod/scripts/vscripts/_respawn_protection.gnut b/Northstar.CustomServers/mod/scripts/vscripts/_respawn_protection.gnut new file mode 100644 index 000000000..2fb177677 --- /dev/null +++ b/Northstar.CustomServers/mod/scripts/vscripts/_respawn_protection.gnut @@ -0,0 +1,39 @@ +global function RespawnProtection_Init + +void function RespawnProtection_Init(){ + AddCallback_OnPlayerRespawned( OnPlayerRespawned ) +} + +void function OnPlayerRespawned( entity player ) +{ + thread RespawnProtection(player,GetCurrentPlaylistVarFloat("respawnprotection",0.0)) +} + +void function RespawnProtection( entity player , float time ){ + OnThreadEnd( + function() : ( player ) + { + //cancel protect if player attack + if( IsDemigod( player ) ) + { + DisableDemigod( player ); + } + } + ) + + player.EndSignal( "OnDeath" ) + player.EndSignal( "OnDestroy" ) + player.EndSignal( "OnPrimaryAttack" ) + + if( IsDemigod( player ) ) + { + DisableDemigod( player ); + } + else{ + //start protect + EnableDemigod( player ) + wait time + //cancel protect + DisableDemigod( player ); + } +} |