feat: add BasePower abstraction
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
using CounterStrikeSharp.API.Core;
|
||||
using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions;
|
||||
using CounterStrikeSharp.API.Modules.Utils;
|
||||
|
||||
namespace Cs2SuperPowers.Utils;
|
||||
|
||||
public static class GrenadeSpawner
|
||||
{
|
||||
static MemoryFunctionWithReturn<IntPtr, IntPtr, IntPtr, IntPtr, IntPtr, int, CHEGrenadeProjectile>
|
||||
CHEGrenadeProjectile_CreateFunc = new(
|
||||
"55 4C 89 C1 48 89 E5 41 57 49 89 FF 41 56 49 89 D6"
|
||||
);
|
||||
|
||||
public static CBaseCSGrenadeProjectile? CreateGrenade(Vector position, QAngle angle, Vector velocity, CCSPlayerPawn? owner = null)
|
||||
{
|
||||
try
|
||||
{
|
||||
return CHEGrenadeProjectile_CreateFunc.Invoke(
|
||||
position.Handle,
|
||||
angle.Handle,
|
||||
velocity.Handle,
|
||||
velocity.Handle,
|
||||
owner == null ? IntPtr.Zero : owner.Handle,
|
||||
44
|
||||
);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user