Change weapon text

Posts 1–6 of 6 · Page 1 of 1
Change weapon text
I have simplified changing weapon text with one function.
I documented each line so it shouldn't be too hard to understand.
Code:
void changeWeaponText(//define our function
	char * string,//our string
	bool isLooped,//is this for all guns?
	char * specificGun//If it isnt, pick a gun to change
	) 
{
	 unsigned long cshell = (unsigned long)(GetModuleHandleA("CShell.dll"));//handle to CF
	 unsigned long weapon = *(unsigned long*)(cshell+0xAB2940);//pointer to weaponclass
	 int  sizeString  = strlen(string);//size of our string
	 if(weapon!=0)//check if the weapon class is not 0
	 {
		 if(isLooped==1)//if the function is set to replace the text to all weapons, then continue
		 {
			 for(int i=0;i<999;i++)//loop for all guns (i put in a generic number)
			 {
				 unsigned long weapons=*(unsigned long*)(weapon+(i*4));//declare our weapons
				 if(weapons!=0)//check if the weapons are not 0
				 {
					 char * weaponName = (char*)(weapons+0x000008);//declare the offset where the string is stored
					 memcpy(weaponName,string,sizeString);//change the stored string to our string.
				 }
			 }
		 }
		  if(isLooped==0)//If you want to loop it to only one gun, check for this
		 {
			 for(int i=0;i<999;i++)//loop for all guns;999=generic number
			 {
				 unsigned long weapons=*(unsigned long*)(weapon+(i*4));//declare our weapons
				 if(weapons!=0)//check if weapons are not equal to 0
				 {
					 char * weaponName = (char*)(weapons+0x000008);//declare the offset where it is stored
					 if(!(strcmp(weaponName,specificGun)))//check if the gun matches the third parameter of our function (the specific gun you wan't to change)
						memcpy(weaponName,string,sizeString);//change the text to our string
				 }
			}
		}
	}
}
So..If I wanted to change M16 to 123456789, I would do this:
Code:
changeWeaponText("123456789",0,"M16");
Good stuff, this give me an idea to make a menu hack in game (not d3d) XD
Lol Sweeeeeet Nice Job!
fail.... use strlen to get #chars in string

good job through..
Quote Originally Posted by giniyat101 View Post
fail.... use strlen to get #chars in string

good job through..
Wow fail...thanks I totally forgot about strlen. I fixed it :P
yes is this the string WeaponName ?
Posts 1–6 of 6 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us