Seems messed up with the wrong prop, should be
m_jumpSupressedUntil.
Code:
SetEntPropFloat(client, Prop_Send, "m_jumpSupressedUntil", -1.0);
And there's no reason to use a repeat timer. Attached below is a sample plugin, hope it helps for your scripting.
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdkhooks> // SDKHook_OnTakeDamagePost
bool g_bLateLoad; // whether map has started when this plugin is loaded
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{
switch (GetEngineVersion())
{
case Engine_Left4Dead, Engine_Left4Dead2: // L4D & 2 only
{
g_bLateLoad = late;
return APLRes_Success;
}
}
strcopy(error, err_max, "Plugin supports L4D & 2 only.");
return APLRes_Failure;
}
public void OnPluginStart()
{
if (g_bLateLoad)
{
// find all clients in game and hook them all since we're late here
for (int i = 1; i <= MaxClients; ++i)
{
if (IsClientInGame(i)) OnClientPutInServer(i);
}
}
}
// calls whenever a client joins, bot or human
public void OnClientPutInServer(int client)
{
SDKHook(client, SDKHook_OnTakeDamagePost, SDK_OnTakeDamage_Post);
}
// a sdkhook that calls whenever a player takes any damage, like punched by CI
void SDK_OnTakeDamage_Post(int victim, int attacker, int inflictor, float damage, int damagetype)
{
if (!IsClientInGame(victim)) // who cares
return;
// Generally incapped and dead players are immovable so we just ignore here
if (IsIncapacitated(victim) || !IsPlayerAlive(victim))
return;
// If the player cannot jump after hit,
if (GetGameTime() < GetEntPropFloat(victim, Prop_Send, "m_jumpSupressedUntil"))
{
// invalidates the timestamp so the player can jump again.
SetEntPropFloat(victim, Prop_Send, "m_jumpSupressedUntil", -1.0);
}
}
stock bool IsIncapacitated(int client)
{
return view_as<bool>(GetEntProp(client, Prop_Send, "m_isIncapacitated", 1));
}