mirror of
https://github.com/roflmuffin/CounterStrikeSharp.git
synced 2025-12-05 23:58:24 -08:00
feat: add GiveNamedItem function
This commit is contained in:
@@ -19,5 +19,11 @@
|
||||
"windows": "\\x40\\x56\\x57\\x48\\x81\\xEC\\x2A\\x2A\\x2A\\x2A\\x48\\x8B\\xF9\\x8B\\xF2\\x8B\\xCA",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x55\\x49\\x89\\xFD\\x89\\xF7"
|
||||
}
|
||||
},
|
||||
"GiveNamedItem": {
|
||||
"signatures": {
|
||||
"library": "server",
|
||||
"linux": "\\x55\\x48\\x89\\xE5\\x41\\x57\\x41\\x56\\x49\\x89\\xCE\\x41\\x55\\x49\\x89\\xF5\\x41\\x54\\x49\\x89\\xD4\\x53\\x48\\x89"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,4 +13,9 @@ public static class VirtualFunctions
|
||||
public static Action<HudDestination, string, IntPtr, IntPtr, IntPtr, IntPtr> ClientPrintAll =
|
||||
VirtualFunction.CreateVoid<HudDestination, string, IntPtr, IntPtr, IntPtr, IntPtr>(
|
||||
GameData.GetSignature("UTIL_ClientPrintAll"));
|
||||
|
||||
// void (*FnGiveNamedItem)(void* itemService,const char* pchName, void* iSubType,void* pScriptItem, void* a5,void* a6) = nullptr;
|
||||
public static Action<IntPtr, string, IntPtr, IntPtr, IntPtr, IntPtr> GiveNamedItem =
|
||||
VirtualFunction.CreateVoid<IntPtr, string, IntPtr, IntPtr, IntPtr, IntPtr>(
|
||||
GameData.GetSignature("GiveNamedItem"));
|
||||
}
|
||||
@@ -71,6 +71,8 @@ namespace TestPlugin
|
||||
var player = @event.Userid;
|
||||
var pawn = player.PlayerPawn.Value;
|
||||
|
||||
VirtualFunctions.GiveNamedItem(pawn.ItemServices.Handle, "weapon_ak47", 0, 0, 0, 0);
|
||||
|
||||
Log($"Pawn Position: {pawn.CBodyComponent?.SceneNode?.AbsOrigin} @{pawn.CBodyComponent?.SceneNode.Rotation}");
|
||||
|
||||
char randomColourChar = (char)new Random().Next(0, 16);
|
||||
|
||||
Reference in New Issue
Block a user