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 


How to set values less than 1 in C#

 
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: Tue Mar 09, 2010 7:41 pm    Post subject: How to set values less than 1 in C# Reply with quote

idk why its not working im trying to set 0.100000001490116 as a value and i know how to set like values that are above 1 but it works different . also i thought that i put a f at the end so 0.100000001490116f but still no luck what am i doing wrong Sad ? thanks guys. lol


by the way im making off buttons for a trainer and it requires it to be lower than one . thanks
Back to top
View user's profile Send private message
iPromise
Grandmaster Cheater
Reputation: -1

Joined: 27 Jun 2009
Posts: 529
Location: Canada

PostPosted: Tue Mar 09, 2010 9:35 pm    Post subject: Reply with quote

I think you should use a double for this:

Code:

*(double*) Address = 0.100000001490116;


see if this works.
Back to top
View user's profile Send private message MSN Messenger
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Mar 10, 2010 12:39 am    Post subject: Reply with quote

iPromise wrote:
Code:

*(double*) Address = 0.100000001490116;


wtf is this


@op: just use a float for the data type.
Back to top
View user's profile Send private message
Flyte
Peanuts!!!!
Reputation: 6

Joined: 19 Apr 2006
Posts: 1887
Location: Canada

PostPosted: Wed Mar 10, 2010 2:27 am    Post subject: Reply with quote

iPromise wrote:
Herp durp.


Why are you still here!?
Back to top
View user's profile Send private message
RAIN MAN
Cheater
Reputation: 0

Joined: 27 Oct 2009
Posts: 25

PostPosted: Wed Mar 10, 2010 1:46 pm    Post subject: Reply with quote

i didnt find out how to write a float in C# lower than 1 but i just changed type to 4 bytes so i it works just have to go back through my addys. Sad
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Wed Mar 10, 2010 4:55 pm    Post subject: Reply with quote

float f = 0.000123f;


if by write you mean use for like a trainer, then it's no difference, just write it all the same. a float is 4 bytes as well.
Back to top
View user's profile Send private message
ArabProphet
How do I cheat?
Reputation: 0

Joined: 15 Jan 2010
Posts: 7

PostPosted: Wed Mar 10, 2010 9:12 pm    Post subject: Reply with quote

I believe you could also use double... like
double var = 0.10101010101001337;
Back to top
View user's profile Send private message
Pingo
Grandmaster Cheater
Reputation: 8

Joined: 12 Jul 2007
Posts: 571

PostPosted: Thu Mar 11, 2010 7:19 am    Post subject: Reply with quote

0.1f is fine Rainman. With your memory reader it would look like this
Mem.WriteFloat(Mem.Pointer(true, 0x479E70, 0xOFFSET), 0.1f);

Replace the bold text. I know you'l be doin a mod so leave the rest the same.
Slovach is right though. Write it as 4byte if you're unable to as float. It doesnt make any difference unless you plan on editing it within the app. Then float would be best.

Both these are 0.1f but 4byte instead. One in hex other dec
Mem.WriteInt(Mem.Pointer(true, 0x479E70, 0xOffset), 0x3DCCCCCD);
Mem.WriteInt(Mem.Pointer(true, 0x479E70, 0xOffset), 1036831949);

_________________
Back to top
View user's profile Send private message
NINTENDO
Grandmaster Cheater Supreme
Reputation: 0

Joined: 02 Nov 2007
Posts: 1371

PostPosted: Mon Mar 29, 2010 9:19 am    Post subject: Reply with quote

slovach wrote:
iPromise wrote:
Code:

*(double*) Address = 0.100000001490116;


wtf is this


@op: just use a float for the data type.


double d = 0.0000000000000000001;
float f = 0.00000000000000000001f;
whats the difference?

_________________
Intel over amd yes.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
gogodr
I post too much
Reputation: 125

Joined: 19 Dec 2006
Posts: 2041

PostPosted: Mon Mar 29, 2010 10:28 pm    Post subject: Reply with quote

float stores 4 bytes numbers and double stores 8 bytes numbers
Back to top
View user's profile Send private message MSN Messenger
RAIN MAN
Cheater
Reputation: 0

Joined: 27 Oct 2009
Posts: 25

PostPosted: Wed Mar 31, 2010 12:09 pm    Post subject: Reply with quote

thanks Very Happy
Back to top
View user's profile Send private message
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