Results 1 to 6 of 6
  1. #1
    dakr54's Avatar
    Join Date
    Mar 2012
    Gender
    male
    Posts
    396
    Reputation
    16
    Thanks
    669

    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");
    Last edited by dakr54; 05-08-2012 at 02:21 PM.

  2. The Following 3 Users Say Thank You to dakr54 For This Useful Post:

    bagabags (10-25-2017),Genkidesu (05-07-2012),Ryuzaki™ (05-09-2012)

  3. #2
    Genkidesu's Avatar
    Join Date
    Mar 2012
    Gender
    male
    Location
    Thanh Hóa
    Posts
    187
    Reputation
    30
    Thanks
    2,786
    My Mood
    Bored
    Good stuff, this give me an idea to make a menu hack in game (not d3d) XD

  4. #3
    Gοku's Avatar
    Join Date
    May 2010
    Gender
    male
    Location
    MPGH.net
    Posts
    1,527
    Reputation
    206
    Thanks
    1,043
    My Mood
    Cheerful
    Lol Sweeeeeet Nice Job!

     







    500 Posts ✓
    750 Posts ✓
    1,337 Posts ✓
    2,000 Posts ×
    3,000 Posts ×

    Ex VIP
    Ex Resource Team Member
    Ex Wiki Editor

  5. #4
    giniyat101's Avatar
    Join Date
    Sep 2011
    Gender
    male
    Location
    Not telling.
    Posts
    1,935
    Reputation
    130
    Thanks
    1,380
    My Mood
    Dead
    fail.... use strlen to get #chars in string

    good job through..


     



    [img]https://i43.photobucke*****m/albums/e367/DeteSting/Steam-update.gif[/img]

  6. The Following User Says Thank You to giniyat101 For This Useful Post:

    dakr54 (05-08-2012)

  7. #5
    kmanev073's Avatar
    Join Date
    Feb 2011
    Gender
    male
    Location
    Bulgaria
    Posts
    2,400
    Reputation
    97
    Thanks
    2,537
    My Mood
    Cool
    yes is this the string WeaponName ?

  8. #6
    dakr54's Avatar
    Join Date
    Mar 2012
    Gender
    male
    Posts
    396
    Reputation
    16
    Thanks
    669
    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

Similar Threads

  1. [SOLVED] Change Weapon Damage?
    By schiz in forum Call of Duty Modern Warfare 2 Help
    Replies: 6
    Last Post: 06-30-2010, 07:40 PM
  2. [Help]Change Button Text[Solved]
    By [PA]nts in forum Visual Basic Programming
    Replies: 7
    Last Post: 06-29-2010, 02:48 PM
  3. can u change weapon damages?
    By n1k0la1 in forum WarRock - International Hacks
    Replies: 46
    Last Post: 02-20-2010, 05:44 PM
  4. [Discussion] can u change weapon damages?
    By n1k0la1 in forum Blackshot Hacks & Cheats
    Replies: 4
    Last Post: 12-10-2009, 08:49 AM
  5. Change weapon texture
    By carpanthers1 in forum WarRock - International Hacks
    Replies: 6
    Last Post: 11-10-2007, 09:20 AM