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

Quote:
Originally Posted by teo30 View Post
Hi guys I need new plugin for my server
I want to use Spawn protection with fall damage enable.
Is it possible?
Yes.

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))
    {
        
damage *= 0.0;
        return 
Plugin_Changed;
    }
}

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

This plugin is not full, please someone finish it, because i don't have time right now. I might finish it soon if no one does. By the way, do you want to make it fall damage blocking only? Because this plugin blocks all the damage. You'll have to compile this as an .sp file via the web compiler or compiler in the "scripting" folder of addons in sourcemod.
EDIT: I think it's finished now.

Last edited by Nursik; 09-27-2016 at 12:57.
Nursik is offline