Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


C# Help Converting int value to ASCII Text.

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
RAIN MAN
Cheater
Reputation: 0

Joined: 27 Oct 2009
Posts: 25

PostPosted: Thu Sep 08, 2011 10:02 am    Post subject: C# Help Converting int value to ASCII Text. Reply with quote

Im making an external ping reader for a friend that shows all the players ingame ping. The problem is i cannot convert the players "Name" to ASCII Text. It stays in 4 Byte value as you can see in the picture.

Thats the players gamertag but i need it to be in the correct format how would i convert it?

Thank you.

This is what i have for the player 1 i just need to convert the output i guess..

Code:
int player1 = Mem.ReadInt(0x402AAFD0);
     abel3.Text = player1.ToString();



pingmessup.png
 Description:
 Filesize:  4.37 KB
 Viewed:  7831 Time(s)

pingmessup.png


Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Thu Sep 08, 2011 4:57 pm    Post subject: Reply with quote

You are only reading the pointer, you need to read the string itself. ToString() doesn't do this automatically for it, it just converts the value of the variable to a string format. You'll need to read the bytes of the players name up to either a specific size or a designated terminator character (usually 0).
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
RAIN MAN
Cheater
Reputation: 0

Joined: 27 Oct 2009
Posts: 25

PostPosted: Thu Sep 08, 2011 6:38 pm    Post subject: Reply with quote

Ive heard about you O.o your like amazing at coding but i just finished actually i figured it out this was what i needed to do
Code:

 int player1 = Mem.ReadInt(0x402AAFD0);
            label3.Text = player1.ToString();
            byte[] tmp;
            Mem.ReadMem(0x402AAFD0, 32, out tmp);
            label3.Text = UnicodeEncoding.Unicode.GetString(tmp);


but you probably already knew that thanks for your help. Smile
Back to top
View user's profile Send private message
mibiz
Cheater
Reputation: 0

Joined: 14 Jun 2009
Posts: 31

PostPosted: Wed Sep 14, 2011 4:27 am    Post subject: Reply with quote

RAIN MAN wrote:
Ive heard about you O.o your like amazing at coding but i just finished actually i figured it out this was what i needed to do
Code:

 int player1 = Mem.ReadInt(0x402AAFD0);
            label3.Text = player1.ToString();
            byte[] tmp;
            Mem.ReadMem(0x402AAFD0, 32, out tmp);
            label3.Text = UnicodeEncoding.Unicode.GetString(tmp);


but you probably already knew that thanks for your help. Smile


Code:
 int player1 = Mem.ReadInt(0x402AAFD0); /* also unnecessary since it's not likely to be used in this current code block/segment */
            label3.Text = player1.ToString(); /* unnecessary since it will assigned correctly below */
            byte[] tmp;
            Mem.ReadMem(0x402AAFD0, 32, out tmp);
            label3.Text = UnicodeEncoding.Unicode.GetString(tmp);
Back to top
View user's profile Send private message
empathe
How do I cheat?
Reputation: 0

Joined: 21 Sep 2011
Posts: 2

PostPosted: Wed Sep 21, 2011 9:37 pm    Post subject: Reply with quote

my method:


Code:

GetPidByName("game.dll");//other function
gameDll = GetDLL("game.dll", dwPID);//other function

//in main
h_Read_Process = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, dwPID);
phandle = OpenProcess(PROCESS_ALL_ACCESS, 0, dwPID);

//thread for nickname
int resultatNom[1];
char temps[25] = "";
int lecture=0x00,espace=0;
int Q=B0; //my offset for nickname
for(cnt = 0; cnt < 50; cnt++) resultatNom[cnt] = 0;
                while(lecture<0x25){
                    ReadProcessMemory(h_Read_Process,(LPCVOID)(gameDll+0x01234567+Q+lecture), &resultatNom[0], sizeof(char), NULL);
                    if (resultatNom[0]==0){espace++;if(espace>1){break;}}
                        lecture=lecture+0x01;
                        sprintf(temps, "%s%c",temps, resultatNom[0]);
                        }
printf("pseudo=%s\n",temps);

_________________
i find dev for new radar DAoC (2012)
already> find other player in memory and x,y,z

add me: [email protected] (je suis fr)
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites