Register for your free account! | Forgot your password?

Go Back   elitepvpers > Popular Games > Silkroad Online > SRO Coding Corner
You last visited: Today at 06:46

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



C# displaying charname problem

Discussion on C# displaying charname problem within the SRO Coding Corner forum part of the Silkroad Online category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jul 2009
Posts: 986
Received Thanks: 193
C# displaying charname problem

Hey guys,

I've got some problems at the moment, im creating a information bar , or how to call it that shows my HP and MP and name ect ect...

But at the moment it only display the first letter of my name and servername, sometimes it shows everything and sometimes it shows nothing ...

Here is the code for my char name
Code:
string charactername = mem.ReadString(0xF9E9B8);
(the public string ReadString ect ect i got from ZeraPain, the rest is from myself ^^)

Code:
        public string ReadString(uint pointer)
        {
            byte[] bytes = new byte[24];
            ReadProcessMemory(Handle, (IntPtr)pointer, bytes, (UIntPtr)24, 0);
            return Encoding.UTF8.GetString(bytes);

Code:
label1.Text = "CharacterName:" + charactername;
Now sometimes it will show up nothing, only the first letter of my name, or the whole name, mostly nothing or the first letter.. The rest i got from myself, name with server and guildname. HP and MP and exp and sp and stuff are working fine.

Anyone knows whats going on ?
Janick_ is offline  
Old 04/07/2011, 21:07   #2
 
Kraizy​'s Avatar
 
elite*gold: 0
The Black Market: 471/0/0
Join Date: Apr 2010
Posts: 9,696
Received Thanks: 1,810
Stupid question: does it work when you try label1.Text = charactername; ? (without "CharacterName:" +)
Because I had the problem, that I could not show the char name and level in only one Label (the label had only the charName value, not the level value...)
BTW, which SRO are you using?
Kraizy​ is offline  
Old 04/07/2011, 21:23   #3
 
elite*gold: 0
Join Date: Jul 2009
Posts: 986
Received Thanks: 193
No it still won't work ... , also it seems like it isn't updating anymore while i have my code in a timer, i once was logged on tigris, and then back i connected back to hercules, now it still shows Server: T , the T from tigris, everything else work correctly and gets updated. And im using iSRO with phBot and phBot run sro without hackshield.
Janick_ is offline  
Old 04/07/2011, 22:05   #4
 
elite*gold: 0
Join Date: Nov 2007
Posts: 959
Received Thanks: 602
well,you need to read it as unicode,not as a simple string.
vorosmihaly is offline  
Thanks
1 User
Old 04/07/2011, 22:29   #5
 
elite*gold: 0
Join Date: Jul 2009
Posts: 986
Received Thanks: 193
Hmm, fixed it now i think, anyway another line that is **** for some reason..
string[] lines = System.IO.File.ReadAllLines("exp.txt");
int currentexp = mem.ReadOffset(0xFB970C, 0x878);
int lv = mem.ReadOffset(0xFB970C, 0x874);
float lving = (((float)currentexp / float.Parse(lines[lv-1])) * 100);

label7.Text = "Exp:" + lving.ToString("f2") + "%";


It always(or well sometimes and sometimes not) is giving an error at this line float lving = (((float)currentexp / float.Parse(lines[lv-1])) * 100);

The error is showing some bullshit. Index is out bla bla, or so .. (only happends when debugging or atleast trying to)
Janick_ is offline  
Old 04/08/2011, 07:17   #6
 
lesderid's Avatar
 
elite*gold: 0
Join Date: Dec 2007
Posts: 2,400
Received Thanks: 1,517
Quote:
Originally Posted by vorosmihaly View Post
well,you need to read it as unicode,not as a simple string.
Indeed.
If you just read as ASCII, the second byte (with the normal latin alphabet, this will always be 0) will terminate the string, because a 0 byte is the string terminator byte.

However, in unicode this will work, since one character is two bytes.
When you want to use ASCII characters in Unicode, you use this format:
00->FF 00, where 00->FF is the character code you would've used in ASCII.
lesderid is offline  
Reply


Similar Threads Similar Threads
Charname? Forgot :o
04/03/2011 - Flyff Private Server - 4 Replies
Hello ppl, An half year ago I started a flyff server, and had the error while making a char... "Charactername Already in use" But I didn't made a char yet... Now I made a server again and got the same error, but idk what to do now.. Someone knows how to fix?
[Help]Charname need to have....
02/14/2009 - Dekaron Private Server - 4 Replies
Ok i editet soem stuff and dont get the massage XXXXX and then i get the massage Charakter need to have atleast 4 charaters in it. Anyone can help me or gimme a hint how i can pass that ? ->or need i any programms like OllyDbG ? greets and thx
[Question]Displaying Packets
01/11/2009 - CO2 Private Server - 1 Replies
just asking how to put that option back in there to display packets in the console Help is appreciated and THanx
Charname ändern?
11/17/2006 - World of Warcraft - 10 Replies
Hi, gibt es irgendwie eine möglichkeit einen GM so zu überzeugen das er mit den Nickname ändert? Mir gefällt meiner nicht mehr wikrlich. Hab wirklich bessere im Gedächtnis. Ich habe das mal versucht das ich immer beleidigt werde und immer beschimpft werde ob ich ein "na*i" sei. gut mich hat das mal einer gefragt wegen dem nickname aber is halt nicht so. Der Gm sagte nur nur eine möglichkeit wenn der Nickname gegen was verstößt. Das dürfte doch auch so gehen.



All times are GMT +2. The time now is 06:46.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.