For c++
struct playerState_s
{
BYTE _0x0[0x1C]; //0x00 //0x01C29440
vec3_t Origin; //0x1C //0x01C2945C
vec3_t Velocity; //0x2E //0x01C29468
BYTE unk1[0x124]; //0x40
vec3_t ViewAngles; //0x164 //0x01C29598
BYTE _0x22[0x31C0]; //0x176
INT Score; //0x3336
BYTE _0x331C[0x5E]; //0x333A
CHAR PlayerNameStatic[0x10];//0x3398
INT MaxHealth; //0x33A8 //correct
BYTE _0x33B0[0x24]; //0x33AC
INT Team; //0x33D0
BYTE _0x33D8[0x3C]; //0x33D4
CHAR PlayerName[0xF]; //0x3410
BYTE _0x33D9[0x1BC]; //0x341F /maybe off b F and revert
INT ClippingFlags; //0x35CC //0x01C2CA0C
BYTE _spacer[0x2C];
INT MovementFlags;
BYTE _0x3600[0x380];
}; //Size 0x3980
typedef void(__cdecl* SendServerCommand_T)(int clientNum, int reliable, const char* command);
typedef int(__cdecl *G_GivePlayerWeapon_T)(playerState_s* ps, int iWeaponIndex, char altModelIndex);
typedef int(__cdecl *G_GetWeaponIndexForName_T)(const char* name);
typedef int(__cdecl *BG_TakePlayerWeapon_T)(playerState_s* ps, unsigned int iWeaponIndex, int takeAwayAmmo);
typedef int(__cdecl *BG_GetViewmodelWeaponIndex_T)(playerState_s* ps);
typedef int(__cdecl *Add_Ammo_T)(gentity_s* ent, unsigned int weaponIndex, char weaponModel, int count, int fillClip);
G_GivePlayerWeapon = (G_GivePlayerWeapon_T)0x00531750;
G_GetWeaponIndexForName = (G_GetWeaponIndexForName_T)0x00530F90;
BG_TakePlayerWeapon = (BG_TakePlayerWeapon_T)0x00430B30;
BG_GetViewmodelWeaponIndex = (BG_GetViewmodelWeaponIndex_T)0x0042FB50;
Add_Ammo = (Add_Ammo_T)0x00508200;
SV_GameSendServerCommand = (SendServerCommand_T)0x00573100;
#define SIZE_playerState 0x38EC
#define ADDRESS_playerState 0x01C29440
playerState_s* G_PlayerState(int clientIndex)
{
return (playerState_s*)(ADDRESS_playerState + (SIZE_playerState * clientIndex));
}
void GiveWeapon(const char* weaponName, int client)
{
BG_TakePlayerWeapon(G_PlayerState(client), BG_GetViewmodelWeaponIndex(G_PlayerState(client)), 1);
int index = G_GetWeaponIndexForName(weaponName);
G_GivePlayerWeapon(G_PlayerState(client), index, 0);
string cmd = "a " + to_string(index);
SV_GameSendServerCommand(client, 0, cmd.c_str());
Add_Ammo(G_Entity(client), index, 0, 9999, 1);
}
Credits to seb5594
For c# there are 3 weapon addresses for each playerState so just change all 3 and it should work.