Quote:
Originally Posted by teo30
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[] name, bool dontBroadcast)
{
int client = GetClientOfUserId(event.GetInt("userid")
if(IsClientInGame(client) && IsPlayerAlive(client))
{
CreateTimer(3.0, Timer_StopTakingNoDamage, client);
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
}
public Action OnTakeDamage(victim, &attacker, &inflictor, &damage, float damageForce[3], float damagePosition[3])
{
If (IsClientInGame(victim) && IsPlayerAlive(victim))
{
damage *= 0.0;
return Plugin_Changed;
}
}
public Action:Timer_StopTakingNoDamage(Handle:timer, any:damage)
{
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
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.