|
Senior Member
Join Date: Jul 2016
Location: In TF2
|
09-28-2016
, 03:46
Re: [CS GO] Spawn protection with fall damage
|
#8
|
Quote:
Originally Posted by Bacardi
More like this, use player userid.
PHP Code:
#pragma semicolon 1 #include sourcemod #include sdkhooks
ConVar g_protecttime;
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) { new client = GetClientOfUserId(event.GetInt("userid")); if(IsClientInGame(client) && IsPlayerAlive(client)) { CreateTimer(g_protectiontime.FloatValue, Timer_StopTakingNoDamage, GetClientUserId(client)); SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage); } }
public Action OnTakeDamage(victim, &attacker, &inflictor, &damage, float damageForce[3], float damagePosition[3]) { if (IsClientInGame(victim) && IsPlayerAlive(victim)) if (damagetype & DMG_FALL) { return Plugin_Handled; } return Plugin_Continue; }
public Action:Timer_StopTakingNoDamage(Handle:timer, any:userid) { new client = GetClientOfUserId(userid);
if (client != 0 && IsClientInGame(client)) { SDKUnhook(client, SDKHook_OnTakeDamage, OnTakeDamage) } }
Quote:
Originally Posted by Nursik
The disconnect error fixing.
|
|
Last edited by Nursik; 09-28-2016 at 03:48.
|
|
|
|