Add _JumpBoost for noctali server

This commit is contained in:
BotoX 2019-12-08 12:57:08 +01:00
parent 19eef9e81d
commit 1a43d63045

View File

@ -0,0 +1,50 @@
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
public Plugin myinfo =
{
name = "JumpBoost",
author = "BotoX",
description = "",
version = "1.0",
url = ""
};
ConVar g_CVar_sm_jumpboost;
int g_ivecAbsVelocity;
public void OnPluginStart()
{
HookEvent("player_jump", OnPlayerJump, EventHookMode_Post);
g_CVar_sm_jumpboost = CreateConVar("sm_jumpboost", "1.05", "Jump boost.", 0, true, 0.0, true, 10.0);
AutoExecConfig(true, "plugin.JumpBoost");
}
public void OnMapStart()
{
g_ivecAbsVelocity = FindDataMapInfo(0, "m_vecAbsVelocity");
}
public void OnPlayerJump(Event event, const char[] name, bool dontBroadcast)
{
int userid = GetEventInt(event, "userid");
if(g_CVar_sm_jumpboost.FloatValue != 1.0)
RequestFrame(OnPlayerJumpPost, userid);
}
public void OnPlayerJumpPost(int userid)
{
int client = GetClientOfUserId(userid);
if(!client)
return;
float vecAbsVelocity[3];
GetEntDataVector(client, g_ivecAbsVelocity, vecAbsVelocity);
vecAbsVelocity[2] *= g_CVar_sm_jumpboost.FloatValue;
SetEntDataVector(client, g_ivecAbsVelocity, vecAbsVelocity);
}