diff options
| author | aura <nw@moneybot.cc> | 2026-02-17 23:42:09 +0100 |
|---|---|---|
| committer | aura <nw@moneybot.cc> | 2026-02-17 23:42:09 +0100 |
| commit | 5e2eb7d67ae933b7566f1944d0bb7744da03d586 (patch) | |
| tree | 054acff1113270a9cd07933df760f3768c1b6853 /sourcemod/scripting/gokz-jumpstats/jump_validating.sp | |
| parent | 341db13a008dc12bb22ceb50452d93d01476308c (diff) | |
move source stuff to its own folder
Diffstat (limited to 'sourcemod/scripting/gokz-jumpstats/jump_validating.sp')
| -rw-r--r-- | sourcemod/scripting/gokz-jumpstats/jump_validating.sp | 82 |
1 files changed, 0 insertions, 82 deletions
diff --git a/sourcemod/scripting/gokz-jumpstats/jump_validating.sp b/sourcemod/scripting/gokz-jumpstats/jump_validating.sp deleted file mode 100644 index c6835c7..0000000 --- a/sourcemod/scripting/gokz-jumpstats/jump_validating.sp +++ /dev/null @@ -1,82 +0,0 @@ -/* - Invalidating invalid jumps, such as ones with a modified velocity. -*/ - -static Handle processMovementHookPost; - -void OnPluginStart_JumpValidating() -{ - Handle gamedataConf = LoadGameConfigFile("gokz-core.games"); - if (gamedataConf == null) - { - SetFailState("Failed to load gokz-core gamedata"); - } - - // CreateInterface - // Thanks SlidyBat and ici - StartPrepSDKCall(SDKCall_Static); - if (!PrepSDKCall_SetFromConf(gamedataConf, SDKConf_Signature, "CreateInterface")) - { - SetFailState("Failed to get CreateInterface"); - } - PrepSDKCall_AddParameter(SDKType_String, SDKPass_Pointer); - PrepSDKCall_AddParameter(SDKType_PlainOldData, SDKPass_Pointer, VDECODE_FLAG_ALLOWNULL); - PrepSDKCall_SetReturnInfo(SDKType_PlainOldData, SDKPass_Plain); - Handle CreateInterface = EndPrepSDKCall(); - - if (CreateInterface == null) - { - SetFailState("Unable to prepare SDKCall for CreateInterface"); - } - - char interfaceName[64]; - - // ProcessMovement - if (!GameConfGetKeyValue(gamedataConf, "IGameMovement", interfaceName, sizeof(interfaceName))) - { - SetFailState("Failed to get IGameMovement interface name"); - } - Address IGameMovement = SDKCall(CreateInterface, interfaceName, 0); - if (!IGameMovement) - { - SetFailState("Failed to get IGameMovement pointer"); - } - - int offset = GameConfGetOffset(gamedataConf, "ProcessMovement"); - if (offset == -1) - { - SetFailState("Failed to get ProcessMovement offset"); - } - - processMovementHookPost = DHookCreate(offset, HookType_Raw, ReturnType_Void, ThisPointer_Ignore, DHook_ProcessMovementPost); - DHookAddParam(processMovementHookPost, HookParamType_CBaseEntity); - DHookAddParam(processMovementHookPost, HookParamType_ObjectPtr); - DHookRaw(processMovementHookPost, false, IGameMovement); -} - -static MRESReturn DHook_ProcessMovementPost(Handle hParams) -{ - int client = DHookGetParam(hParams, 1); - if (!IsValidClient(client) || IsFakeClient(client)) - { - return MRES_Ignored; - } - float pVelocity[3], velocity[3]; - Movement_GetProcessingVelocity(client, pVelocity); - Movement_GetVelocity(client, velocity); - - gB_SpeedJustModifiedExternally[client] = false; - for (int i = 0; i < 3; i++) - { - if (FloatAbs(pVelocity[i] - velocity[i]) > EPSILON) - { - // The current velocity doesn't match the velocity of the end of movement processing, - // so it must have been modified by something like a trigger. - InvalidateJumpstat(client); - gB_SpeedJustModifiedExternally[client] = true; - break; - } - } - - return MRES_Ignored; -}
\ No newline at end of file |
