View previous topic :: View next topic |
Author |
Message |
vng21092 Grandmaster Cheater Reputation: 15
Joined: 05 Apr 2013 Posts: 644
|
Posted: Sat Apr 05, 2014 9:07 pm Post subject: Converting value types? |
|
|
Hey guys, is there anyway to parse a value? This is my problem
|
|
Back to top |
|
|
Geri Moderator Reputation: 111
Joined: 05 Feb 2010 Posts: 5636
|
Posted: Sat Apr 05, 2014 9:22 pm Post subject: |
|
|
There is an instruction to convert integer into float (fild), but it won't work the opposite way. If you want to make calculations with the value, you will have to use it as a float value (use fadd, fsub, etc). And if you replace an integer with a float value, the result will be gibberish, because the program will still handle it as integer.
The value on 0000 offset is 0, so CE will have a hard time predicting what should be the value type. It could be float as well, 0 is 0 both in float and integer.
_________________
|
|
Back to top |
|
|
vng21092 Grandmaster Cheater Reputation: 15
Joined: 05 Apr 2013 Posts: 644
|
Posted: Sun Apr 06, 2014 12:40 pm Post subject: |
|
|
Offset 0 contains the current ammo in a clip, so I know that is a 4 byte. I know offset C is the max clip ammo because I've checked that offset for all guns and offset C is always the value of which the gun reloads to. So I'm assuming this can't be done? Thanks anyway
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 06, 2014 1:20 pm Post subject: |
|
|
Just because CE says it's a float value, doesn't mean that it's actually a float value (or vice versa). Double click on it and change the value type. You can use whatever value type you want in your script. Some may not work correctly, depending on what the value represents. In this case, since the value represents ammo quantity, using 4 byte type or similar should work. If not, and it actually is float type, then use float.
|
|
Back to top |
|
|
vng21092 Grandmaster Cheater Reputation: 15
Joined: 05 Apr 2013 Posts: 644
|
Posted: Sun Apr 06, 2014 1:30 pm Post subject: |
|
|
yup checked it, actually is a float
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 06, 2014 1:36 pm Post subject: |
|
|
If current ammo at +0 is 4 byte, then max ammo at +C should be the same. If max ammo at +C really is float, then current ammo at +0 should also be float (so change it). I find it hard to believe that the game uses different data types to represent ammo.
Have you even written a script and tested it? At this point, I don't see the problem.
|
|
Back to top |
|
|
vng21092 Grandmaster Cheater Reputation: 15
Joined: 05 Apr 2013 Posts: 644
|
Posted: Sun Apr 06, 2014 2:02 pm Post subject: |
|
|
yea I tested it, I checked the 4 byte value and float value for both offsets and they are the correct type as they appear on the table, I wrote a script to push +C and then pop +0 and I got some huge number so that didn't work out.
|
|
Back to top |
|
|
Geri Moderator Reputation: 111
Joined: 05 Feb 2010 Posts: 5636
|
Posted: Sun Apr 06, 2014 2:03 pm Post subject: |
|
|
++METHOS wrote: | If current ammo at +0 is 4 byte, then max ammo at +C should be the same. If max ammo at +C really is float, then current ammo at +0 should also be float (so change it). I find it hard to believe that the game uses different data types to represent ammo.
|
Unless that float value is just a copy of an integer. Maybe the max ammo is stored as an integer somewhere else, and this float value is just a number that is displayed on the screen or something. In that case, you have to find the original integer value.
If you look at the codes which are accessing to the ammo in the clip, it will probably make more sense. When you reload the gun, the program has to check the clip size to refill the clip.
_________________
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 06, 2014 2:09 pm Post subject: |
|
|
vng21092- how do you know what value type they are?
Anyway, if what you're saying is true, then you probably do not have the correct offset(s). Your current ammo offset may be correct, but the maximum ammo offset may not be etc. Regardless, you can still move +C offset as float in to current ammo...you will just have a large number. If you do not want that, use a custom value, or, find a different offset.
To answer your original question...
There is no conversion process required. Float 8.0 is 1090519040 in decimal and 41000000 in hex.
That said, if you want to convert the text (e.g. 8.0) and have the script write it as 4 byte, then you could probably do this with LUA.
|
|
Back to top |
|
|
Geri Moderator Reputation: 111
Joined: 05 Feb 2010 Posts: 5636
|
Posted: Sun Apr 06, 2014 2:24 pm Post subject: |
|
|
++METHOS wrote: | vng21092- how do you know what value type they are?
Anyway, if what you're saying is true, then you probably do not have the correct offset(s). Your current ammo offset may be correct, but the maximum ammo offset may not be etc. Regardless, you can still move +C offset as float in to current ammo...you will just have a large number. If you do not want that, use a custom value, or, find a different offset.
To answer your original question...
There is no conversion process required. Float 8.0 is 1090519040 in decimal and 41000000 in hex. |
The values in that structure on the picture are surely float. The chances that you get a float value like this on a random address is very tiny.
I think he wants to make a script that will read +0C, convert it to integer and change the current ammo in clip to the max ammo to work with every weapon with different clip sizes.
In theory, you can "guess" the number. Eg you can check that the float value is 1, 2, 3, 4... 100.
1 = 3f800000
2 = 40000000
3 = 40400000
etc.
But then you would need a huge script to compare every number from 1 to 100. Like
Code: | cmp [whatever+0C],3f800000 //check if it's 1
je mycheatcode //execute your cheat code to set value to 1
cmp [whatever+0C],40000000 //check if it's 2
je mycheatcode2 //execute your cheat code to set value to 2 |
This is a very stupid, but probably working solution. Did I mention it's stupid? It's better if you just dig in the game a little longer to find the clip size in an integer value.
_________________
|
|
Back to top |
|
|
++METHOS I post too much Reputation: 92
Joined: 29 Oct 2010 Posts: 4197
|
Posted: Sun Apr 06, 2014 2:30 pm Post subject: |
|
|
Yes. And I know.
|
|
Back to top |
|
|
vng21092 Grandmaster Cheater Reputation: 15
Joined: 05 Apr 2013 Posts: 644
|
Posted: Sun Apr 06, 2014 4:27 pm Post subject: |
|
|
Never learned LUA script before, but I'll pick it up sooner or later, thanks for the help guys.
|
|
Back to top |
|
|
omoe Grandmaster Cheater Reputation: 8
Joined: 11 Jun 2013 Posts: 547
|
Posted: Mon Apr 07, 2014 12:08 am Post subject: |
|
|
vng21092 wrote: | Never learned LUA script before, but I'll pick it up sooner or later, thanks for the help guys. |
i think you should go with Geris advise , you could try something like this instead of writing 100 lines
assuming the data is stored on eax
Code: |
globalalloc(float1,10)
newmem:
push ecx
push edi
xor ecx,ecx
mov [float1+4],(float)1
checkthefloat:
inc ecx
mov edi,[float1+4]
cmp [eax+c],edi
je setint
cmp edi,(float)100
jae setint
fld dword ptr[float1]
fadd dword ptr[float1+4]
fstp dword ptr[float1+4]
jmp checkthefloat
setint:
mov [eax],ecx
exit:
pop edi
pop ecx
jmp returnhere
float1:
dd (float)1
|
I didnt test this , If the pointer is stored on esi just change eax to esi in the script above.
P.S it would help to see more of the code .
_________________
Hey! , Rep++ . |
|
Back to top |
|
|
|