[Help] How to write Float C#

Posts 1–8 of 8 · Page 1 of 1
[Help] How to write Float C#
Hey guys, I'm trying to write to a Float address using Jorndel's Class, but I keep getting an error "Argument 1: cannot convert 'long' to 'int' "

Here is the code:

Code:
if (Process_Handle("*process*"))
            {
                Write(0x14570F990, 80);
            }

Any help will be much appreciated, thanks.
Code:
 private void Write(int Address, float Value)
        {
            byte[] Buffer = BitConverter.GetBytes(Value);
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
        }
Code:
    public void WriteFloat(int Address, float Value)
        {
            Write(Address, Value);
        }

Also, long != float, problem is address related, you have to change optimize memory class to work with 64 bit process..
Quote Originally Posted by Lovroman View Post
Code:
 private void Write(int Address, float Value)
        {
            byte[] Buffer = BitConverter.GetBytes(Value);
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
        }
Code:
    public void WriteFloat(int Address, float Value)
        {
            Write(Address, Value);
        }

Also, long != float, problem is address related, you have to change optimize memory class to work with 64 bit process..

Thanks for replying. How would I be able to do that?
Quote Originally Posted by strangerdanger View Post
Thanks for replying. How would I be able to do that?
Change every int to long and change project settings to x64(change it where it says x86)..
A.K.A. Every Int32/UInt32 to Int64/UInt64
Quote Originally Posted by Lovroman View Post


Change every int to long and change project settings to x64(change it where it says x86)..
A.K.A. Every Int32/UInt32 to Int64/UInt64
Thanks heaps man, that worked (sorta) I can compile the program fine but instead of writing 80 to the address it writes 1.121038771E-43
Quote Originally Posted by Lovroman View Post
Code:
 private void Write(int Address, float Value)
        {
            byte[] Buffer = BitConverter.GetBytes(Value);
            IntPtr Zero = IntPtr.Zero;
            WriteProcessMemory(pHandel, (IntPtr)Address, Buffer, (UInt32)Buffer.Length, out Zero);
        }
Code:
    public void WriteFloat(int Address, float Value)
        {
            Write(Address, Value);
        }

Also, long != float, problem is address related, you have to change optimize memory class to work with 64 bit process..
if you tell him to change to x64 don't give him source with x32 value :P

try change the UInt32 to UInt64
OR....
You could've done this:
Code:
if (Process_Handle("*process*"))
            {
                Write(0x14570F990, 80.f);
            }
Posts 1–8 of 8 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us