-
-
Notifications
You must be signed in to change notification settings - Fork 463
Closed
Description
Help us help you
- I have checked that my issue doesn't exist yet.
- I have tried my absolute best to reduce the problem-space and have provided the absolute smallest test-case possible.
- I can always reproduce the issue with the provided description below.
Environment
- Operating System version: Windows 10, 64-bit, latest stable updates
- Game/AppID (with version if applicable): Neotokyo latest/Steam AppID 244630
- Current SourceMod version: 1.12.0 (Windows)
- Current SourceMod snapshot: 1.12.0.6949, jit-x86 (build 1.12.0.6949)
- Current Metamod: Source snapshot: 1.12.0-dev+1164 (Windows)
- I have updated SourceMod to the latest version and it still happens.
- I have updated SourceMod to the latest snapshot and it still happens.
- I have updated SourceMM to the latest snapshot and it still happens.
Description
The native void SDKHooks_DropWeapon recently had a fifth optional parameter "bypassHooks" added to its signature:
/**
* Forces a client to drop the specified weapon
*
* @param client Client index.
* @param weapon Weapon entity index.
* @param vecTarget Location to toss weapon to, or NULL_VECTOR for default.
* @param vecVelocity Velocity at which to toss weapon, or NULL_VECTOR for default.
* @param bypassHooks If true, bypass SDK hooks on Weapon Drop
* @error Invalid client or weapon entity, weapon not owned by client.
*/
native void SDKHooks_DropWeapon(int client, int weapon, const float vecTarget[3]=NULL_VECTOR,
const float vecVelocity[3]=NULL_VECTOR, bool bypassHooks = true);
The problem is, when calling SDKHooks_DropWeapon with the non-default param value bypassHooks=false, the hooks will incorrectly still be bypassed if the params vecTarget or vecVelocity are using their default value of NULL_VECTOR.
Problematic Code (or Steps to Reproduce)
#include <sourcemod>
#include <sdkhooks>
public void OnClientPutInServer(int client)
{
if (!SDKHookEx(client, SDKHook_WeaponEquipPost, OnWeaponEquip) ||
!SDKHookEx(client, SDKHook_WeaponDropPost, OnWeaponDrop)
)
{
SetFailState("SDKHook(s) failed");
}
}
public void OnWeaponEquip(int client, int weapon)
{
SDKHooks_DropWeapon(client, weapon, _, _, false);
}
public void OnWeaponDrop(int client, int weapon)
{
PrintToServer("OnWeaponDrop: detected with (%d, %d)", client, weapon);
}Logs
Expected PrintToServer printout:
OnWeaponDrop: detected with (n1, n2)
What happens:
There is no printout whatsoever, as the OnWeaponDrop SDKHook does not trigger.
If explicitly specifying zeroed vector of { 0.0, 0.0, 0.0 } for the vecTarget and vecVelocity parameters, the hook will trigger correctly and produce the correct PrintToServer printout.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels