|
Veteran Member
Join Date: Aug 2013
Location: Denmark
|
09-28-2016
, 11:29
Re: [CS GO] Spawn protection with fall damage
|
#17
|
Quote:
Originally Posted by teo30
Thank you guys!
But.. I think you guys are misunderstanding this is my fault I didn't explain well
I want players will be get only fall damage.. and protect from shoot,fire and the others for 10? seconds
sorry guys..
|
Quote:
Originally Posted by teo30
really thank you but this plug-in still enabled protect from fall damage
|
I thought you wanted both, so this is only to block damage from players, but allow fall damage?
If so, here:
Spoiler
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdkhooks>
#pragma newdecls required
ConVar g_protecttime;
int g_protonoff[MAXPLAYERS+1];
public void OnPluginStart()
{
g_protecttime = CreateConVar("respawn_protection_time", "3.0", "How much seconds to protect from fall damage");
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))
{
g_protonoff[client] = 1;
CreateTimer(g_protecttime.FloatValue, Timer_StopTakingNoDamage, GetClientUserId(client));
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
}
return Plugin_Continue;
}
public Action OnTakeDamage(int victim, int &attacker, int &inflictor, float &damage, int &damagetype, int &weapon, float damageForce[3], float damagePosition[3])
{
if (IsClientInGame(victim) && IsPlayerAlive(victim))
{
if (g_protonoff[victim] == 1 && !(damagetype & DMG_FALL))
{
return Plugin_Handled;
}
}
return Plugin_Continue;
}
public Action Timer_StopTakingNoDamage(Handle timer, any userid)
{
int client = GetClientOfUserId(userid);
if (client != 0 && IsClientInGame(client))
{
SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage);
g_protonoff[client] = 0;
}
return Plugin_Continue;
}
__________________
|
|
|
|