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
09-03-2014, 03:16 PM #11
Sturmi :3
Do a barrel roll!
nice one seb
11-09-2014, 12:42 PM #12
seanhellen
Are you high?
Great. Thanks. Though I cant get camos to work and doesnt work in public matches :(
Last edited by seanhellen ; 12-14-2014 at 11:01 AM.
12-20-2014, 08:20 AM #13
seanhellen
Are you high?
And doesnt work in public matches
12-21-2014, 04:47 PM #14
xJuno
Banned
test it later
12-26-2014, 01:47 PM #15
Baby Cakes
NextGenUpdate Elite
thnaks man
01-20-2015, 03:44 PM #16
iTпDM
Vault dweller
Thanks sebey :p
05-29-2015, 01:19 AM #17
ItzMatriix
Are you high?
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 you deal with the weapon shifting? like i want to give a weapon and i have the values for most maps but then how do you make it so the game will know when to shift the index?
05-29-2015, 08:35 PM #18
Originally posted by ItzMatriix View Post
how do you deal with the weapon shifting? like i want to give a weapon and i have the values for most maps but then how do you make it so the game will know when to shift the index?


BG_GetWeaponIndexForName
07-10-2015, 03:38 PM #19
Jim Halpert
Bounty hunter
I'm new to making sprx menus. How do you call this as a function? Like I understand how to do something like god mode or super jump, but how do I use this in my namespace for mods?

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo