Post: [C++] Give Weapons (with Camos)
08-23-2014, 03:42 AM #1
seb5594
Proud Former Admin
(adsbygoogle = window.adsbygoogle || []).push({}); Hey Guys,
Since i worked on my Mod Menu for MW3, i found this out by playing abit in Playerstate.
I guess no one here knew anything about it, but here is it. If you are not bad with Bitwise operations then you can give it a try to give modified Attachments also!
Huge thanks to Kyza aka. Bitwise for helping me to solve a problem with the shifting part :yes:

    
#define G_Client(clientIndex) ( 0x0110A280 + ( clientIndex * 0x3980) )
#define G_Entity(clientIndex) ( 0x00FCA280 + ( clientIndex * 0x280 ) )
int BG_GetViewmodelWeaponIndex(int clientIndex)
{
return *(int*)(G_Client(clientIndex) + 0x370);
}
opd_s GGPW = { 0x001C3034, TOC };
void(*G_GivePlayerWeapon)(int* G_Client, int iWeaponIndex, char altModelIndex) = (void(*)(int*, int, char))&GGPW;
opd_s AA = { 0x0018A29C, TOC };
void(*Add_Ammo)(int* G_Entity, unsigned int weaponIndex, char weaponModel, int count, int fillClip) = (void(*)(int*, unsigned int, char, int, int))&AA;
void TakeWeapon(int clientIndex, int WeaponIndex, int takeAwayAmmo)
{
opd_s BG_TPW = { 0x001C409C, TOC };
void(*BG_TakePlayerWeapon)(int *playerState, int WeaponIndex, int takeAwayAmmo) = (void(*)(int*, int, int))&BG_TPW;
BG_TakePlayerWeapon((int*)G_Client(clientIndex), WeaponIndex, takeAwayAmmo);
}
void GiveWeapon(int clientIndex, int Index)
{
G_GivePlayerWeapon((int*)G_Client(clientIndex), Index, 0);
Add_Ammo((int*)G_Entity(clientIndex), Index, 0, 9999, 1);
}
enum Camo
{
none,
Classic,
Snow,
Multicam,
Digital_Urban,
Hex,
Choco,
Snake,
Blue,
Red,
Autumn,
Gold,
Marine,
Winter
};
void ChangeCamo(int clientIndex, Camo camo)
{
int Index = BG_GetViewmodelWeaponIndex(clientIndex);
TakeWeapon(clientIndex, Index, 0);
int CalcIndex = 0 | ((Index >> 12 & 15) << 12) | ((Index >> 16) << 16) | Index & 0xFF;
GiveWeapon(clientIndex, CalcIndex + (camo << Cool Man (aka Tustin));
}


The function "ChangeCamo" will change the camo of weapon you have currently in hand.
Call this function like that
    ChangeCamo(0, Gold);


PS: I release it because i prob never finish my menu, i have decided to build a Gamemode! Winky Winky
Last edited by seb5594 ; 08-23-2014 at 03:50 AM.

The following 11 users say thank you to seb5594 for this useful post:

-JM-, Hammy, GMTPS3, Joren, Loxy, MegaMister, SaberNGU, seanhellen, Swaqq, Turk_Warrior, witchery
07-10-2015, 05:02 PM #20
Jim Halpert
Bounty hunter
Originally posted by seb5594 View Post
Hey Guys,
Since i worked on my Mod Menu for MW3, i found this out by playing abit in Playerstate.
I guess no one here knew anything about it, but here is it. If you are not bad with Bitwise operations then you can give it a try to give modified Attachments also!
Huge thanks to Kyza aka. Bitwise for helping me to solve a problem with the shifting part :yes:

    
#define G_Client(clientIndex) ( 0x0110A280 + ( clientIndex * 0x3980) )
#define G_Entity(clientIndex) ( 0x00FCA280 + ( clientIndex * 0x280 ) )
int BG_GetViewmodelWeaponIndex(int clientIndex)
{
return *(int*)(G_Client(clientIndex) + 0x370);
}
opd_s GGPW = { 0x001C3034, TOC };
void(*G_GivePlayerWeapon)(int* G_Client, int iWeaponIndex, char altModelIndex) = (void(*)(int*, int, char))&GGPW;
opd_s AA = { 0x0018A29C, TOC };
void(*Add_Ammo)(int* G_Entity, unsigned int weaponIndex, char weaponModel, int count, int fillClip) = (void(*)(int*, unsigned int, char, int, int))&AA;
void TakeWeapon(int clientIndex, int WeaponIndex, int takeAwayAmmo)
{
opd_s BG_TPW = { 0x001C409C, TOC };
void(*BG_TakePlayerWeapon)(int *playerState, int WeaponIndex, int takeAwayAmmo) = (void(*)(int*, int, int))&BG_TPW;
BG_TakePlayerWeapon((int*)G_Client(clientIndex), WeaponIndex, takeAwayAmmo);
}
void GiveWeapon(int clientIndex, int Index)
{
G_GivePlayerWeapon((int*)G_Client(clientIndex), Index, 0);
Add_Ammo((int*)G_Entity(clientIndex), Index, 0, 9999, 1);
}
enum Camo
{
none,
Classic,
Snow,
Multicam,
Digital_Urban,
Hex,
Choco,
Snake,
Blue,
Red,
Autumn,
Gold,
Marine,
Winter
};
void ChangeCamo(int clientIndex, Camo camo)
{
int Index = BG_GetViewmodelWeaponIndex(clientIndex);
TakeWeapon(clientIndex, Index, 0);
int CalcIndex = 0 | ((Index >> 12 & 15) << 12) | ((Index >> 16) << 16) | Index & 0xFF;
GiveWeapon(clientIndex, CalcIndex + (camo << Cool Man (aka Tustin));
}


The function "ChangeCamo" will change the camo of weapon you have currently in hand.
Call this function like that
    ChangeCamo(0, Gold);


PS: I release it because i prob never finish my menu, i have decided to build a Gamemode! Winky Winky


How do I make it so that any weapon could work on any map? Like on certain maps the offset for the ACR is 0x1B and for other maps it's 0x1C... how could I code the ACR in so that it works equally on all maps? Someone told me to code something in like +1... idk. I'm new to this.
Last edited by Jim Halpert ; 07-12-2015 at 01:35 AM.

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo