View Single Post
Nursik
Senior Member
Join Date: Jul 2016
Location: In TF2
Old 09-27-2016 , 23:24   Re: [CS GO] Spawn protection with fall damage
Reply With Quote #3

Tell me if it works.

PHP Code:
#pragma semicolon 1
#include sourcemod
#include sdkhooks

public void OnPluginStart()
{
    
HookEvent("player_spawn"OnPlayerSpawn);
}

public 
Action OnPlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid")
    if(
IsClientInGame(client) && IsPlayerAlive(client))
    {
        
CreateTimer(3.0Timer_StopTakingNoDamageclient);
        
SDKHook(clientSDKHook_OnTakeDamageOnTakeDamage);
    }
}

public 
Action OnTakeDamage(victim, &attacker, &inflictor, &damagefloat damageForce[3], float damagePosition[3])
{
    If (
IsClientInGame(victim) && IsPlayerAlive(victim))
    If (
damagetype DMG_FALL)
    {
        
damage *= 0.0;
        return 
Plugin_Changed;
    }
}

public 
Action:Timer_StopTakingNoDamage(Handle:timerany:client)
{
    
SDKUnhook(clientSDKHook_OnTakeDamageOnTakeDamage);


Last edited by Nursik; 09-28-2016 at 00:20.
Nursik is offline