| View previous topic :: View next topic |
| Author |
Message |
KareZ How do I cheat?
Reputation: 0
Joined: 18 Dec 2012 Posts: 7
|
Posted: Wed Dec 19, 2012 6:38 am Post subject: Vb.net float |
|
|
I've the static address + offset of health value that is float .. when i try to make a trainer with vb.net ..
| Code: |
...blabla code blabla...
Dim val as Double = Textbox1.text
WriteProcessMemory(pHandle,Address, val, 2, 4) |
It doesnt "edit" the health value for example from 10 to 99 but if i write in textbox -> 999999 ... the hp in game go up to, for example, 11 -> 11.003456
 |
|
| Back to top |
|
 |
Pingo Grandmaster Cheater
Reputation: 8
Joined: 12 Jul 2007 Posts: 571
|
Posted: Wed Dec 19, 2012 2:38 pm Post subject: |
|
|
Maybe cause your defining the value as a double instead of a float?
Try
| Code: | | Dim val As Single = TextBox1.Text |
_________________
|
|
| Back to top |
|
 |
KareZ How do I cheat?
Reputation: 0
Joined: 18 Dec 2012 Posts: 7
|
Posted: Thu Dec 20, 2012 2:07 am Post subject: |
|
|
I've tryed also with Single ... and if i write in textbox 999 on cheatengine i get something like 1.2398329E-23 (float)  |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Thu Dec 20, 2012 10:37 am Post subject: |
|
|
Parse the text into your float instead of just attempting to assign it.
| Code: | Dim val As Single
If Single.TryParse(Textbox1.text, val) Then
WriteProcessMemory(pHandle,Address, val, 2, 4)
End If |
Also it would help to post your definition of WriteProcessMemory too since the protoype you give of it here does not match what it should be and appears that you are trying to write two bytes instead of the proper four for a single (float). _________________
- Retired. |
|
| Back to top |
|
 |
Pingo Grandmaster Cheater
Reputation: 8
Joined: 12 Jul 2007 Posts: 571
|
Posted: Thu Dec 20, 2012 2:43 pm Post subject: |
|
|
Haha i was also gonna post that!
About tryparse and see what his api looked like, strange.
Anyway post more code. Looks like it'l be an easy fix but without knowing more about whats going on, i can't say for sure. _________________
|
|
| Back to top |
|
 |
KareZ How do I cheat?
Reputation: 0
Joined: 18 Dec 2012 Posts: 7
|
Posted: Sat Dec 22, 2012 2:34 am Post subject: |
|
|
| Code: | | Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer |
It keeps add value like 0.0001526 if i write 10 in textbox ... so if i've 200 hp i get 200.0001526
Im using this table -> forum(.)cheatengine(.)org/viewtopic(.)php?t=557431&sid=ba2fc5ee1cea105fa6ca85507b3d4b60 |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25832 Location: The netherlands
|
Posted: Sat Dec 22, 2012 2:50 am Post subject: |
|
|
a float is 4 bytes long, not 2, so change the 2 to 4 _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
KareZ How do I cheat?
Reputation: 0
Joined: 18 Dec 2012 Posts: 7
|
Posted: Sat Dec 22, 2012 4:46 am Post subject: |
|
|
| Dark Byte wrote: | | a float is 4 bytes long, not 2, so change the 2 to 4 |
333 Health -> 4.666323886E-43  |
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25832 Location: The netherlands
|
Posted: Sat Dec 22, 2012 6:00 pm Post subject: |
|
|
I just noticed that you declared lpBuffer as a long, which is a normal integer type.
This means that visual basic converts the float to a integer, and then passes the pointer to that
meaning that it writes the integer 333 to the memory instead of the float _________________
Do not ask me about online cheats. I don't know any and wont help finding them.
Like my help? Join me on Patreon so i can keep helping |
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Dec 23, 2012 7:37 am Post subject: |
|
|
| KareZ wrote: | | Code: | | Private Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Integer, ByVal lpBaseAddress As Integer, ByRef lpBuffer As Long, ByVal nSize As Integer, ByRef lpNumberOfBytesWritten As Integer) As Integer |
It keeps add value like 0.0001526 if i write 10 in textbox ... so if i've 200 hp i get 200.0001526
Im using this table -> forum(.)cheatengine(.)org/viewtopic(.)php?t=557431&sid=ba2fc5ee1cea105fa6ca85507b3d4b60 |
Uhm, this is a VB6 method of importing an API.
So which are you using? VB.NET or VB6?
If you are using VB.NET you should import the API like this:
| Code: |
<DllImport("kernel32.dll", SetLastError:=True)> _
Public Shared Function WriteProcessMemory(ByVal hProcess As IntPtr, ByVal lpBaseAddress As IntPtr, ByVal lpBuffer As Byte(), ByVal nSize As System.UInt32, <Out()> ByRef lpNumberOfBytesWritten As IntPtr) As Boolean
End Function
|
_________________
- Retired. |
|
| Back to top |
|
 |
|