feat: add GiveNamedItem function

This commit is contained in:
Roflmuffin
2023-10-22 21:23:03 +10:00
parent 4aaadfd9d7
commit 80ebbe7477
3 changed files with 13 additions and 0 deletions

View File

@@ -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"
}
}
}

View File

@@ -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"));
}

View File

@@ -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);