Well if you don't understand it are you sure you know the basics? I mean there are pretty much info and very simple exampled in the C++ forums nowadays.
Well if you don't understand it are you sure you know the basics? I mean there are pretty much info and very simple exampled in the C++ forums nowadays.
So you want C++ tutorial? http://www.intap.net/~drw/cpp/ for example :POriginally Posted by Martijn
Yeah, I think I master the basics.
Martijn: If you know the basics it's pretty simple. All you have to do is find a tibia window and open its process. Then there are 2 functions you need to know basically. ReadProcessMemory and WriteProcessMemory. What you do is find an address (which you can find on these forums) and then read/write to it.
I wrote some simple code here and commented it, I suggest you go through it carefully line by line and you will see it's actually very easy. Don't let unknown functionnames scare you, to be honest I almost don't even remember how to use these functions. I've just written classes to handle everything for me and now I don't need to bother with this stuff anymore.
Code:#include <windows.h> int main() { // First get a window handle to a Tibia window, this way you will get the handle of the Tibia you opened last HWND TibiaWindow = FindWindow("tibiaclient", NULL); // Now we will get the process id by using the function beneith and store it in pid DWORD pid; GetWindowThreadProcessId(TibiaWindow, &pid); // Last thing we do is open the process HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pid); // TIBIA_PLAYER_LEVEL is the address in Tibias memory where it stores th players level const int TIBIA_PLAYER_LEVEL = 0x00613B60; // We will save the players level in the variable nLevel int nLevel = 0; // So lets do the actual reading using ReadProcessMemory // It takes 5 parameters, the process handle, the address, a variable to store the results in, how many bytes to read and a 5th I'm not sure about right now ReadProcessMemory(hProcess, (LPVOID)TIBIA_PLAYER_LEVEL, &nLevel, 4, NULL); // So now we have the players level in the variable nLevel, lets add 200 to it // We dont actually change the level here, it's done when we write the new level to Tibia nLevel += 200; // As you see it works pretty much the same WriteProcessMemory(hProcess, (LPVOID)TIBIA_PLAYER_LEVEL, &nLevel, 4, NULL); // Lastly close the process handle CloseHandle(hProcess); return 1; }
Originally Posted by Grob
Thanks I will play around with your script a little, I am not sure what it exactly does thought, I will try to find out
can we get a tutorial or some source as howto private message in visual basic 6 ive got the packet and ive got a function sent to me but i cant get them to work lol so a tutorial or source would be amazing thannks
This is what I use and it works:Originally Posted by Mooki
And call it like this:Code:Public Function PrivateMessage(CharacterTo As String, Text As String) Dim ProcessID As Long Dim PacketBuffer() As Byte ReDim PacketBuffer(9 + Len(CharacterTo) + Len(Text)) Dim X As Long GetWindowThreadProcessId MainTibiaClient, ProcessID PacketBuffer(0) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 1) PacketBuffer(1) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 2) PacketBuffer(2) = &H96 PacketBuffer(3) = &H4 PacketBuffer(4) = Len(CharacterTo) PacketBuffer(5) = &H0 For X = 1 To Len(CharacterTo) PacketBuffer(X + 5) = Asc(Mid(CharacterTo, X, 1)) Next X PacketBuffer(Len(CharacterTo) + 6) = LongToByte(Len(Text), 1) PacketBuffer(Len(CharacterTo) + 7) = LongToByte(Len(Text), 2) For X = 1 To Len(Text) PacketBuffer(Len(CharacterTo) + 7 + X) = Asc(Mid(Text, X, 1)) Next X SendPacket ProcessID, PacketBuffer End Function
Hope that helps,Code:PrivateMessage "Mooki", "Hello!"
Jo3
i downloaded packet.dll for 8.2, put it in the same folder as my project. i copied you're private message function and called it, nothing happens for a reason, this is what i added
from packet.dll vb exampleCode:Private Declare Sub SendPacket Lib "packet.dll" (ByVal ProcessID As Long, ByRef Packet() As Byte, Optional ByVal Encrypt As Byte = True, Optional ByVal SafeArray As Byte = True)
you're pm function(except for MainTibiaClient that i changed to Tibia_Hwnd.Code:Public Function PrivateMessage(CharacterTo As String, Text As String) Dim ProcessID As Long Dim PacketBuffer() As Byte ReDim PacketBuffer(9 + Len(CharacterTo) + Len(Text)) Dim X As Long GetWindowThreadProcessId Tibia_Hwnd, ProcessID PacketBuffer(0) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 1) PacketBuffer(1) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 2) PacketBuffer(2) = &H96 PacketBuffer(3) = &H4 PacketBuffer(4) = Len(CharacterTo) PacketBuffer(5) = &H0 For X = 1 To Len(CharacterTo) PacketBuffer(X + 5) = Asc(Mid(CharacterTo, X, 1)) Next X PacketBuffer(Len(CharacterTo) + 6) = LongToByte(Len(Text), 1) PacketBuffer(Len(CharacterTo) + 7) = LongToByte(Len(Text), 2) For X = 1 To Len(Text) PacketBuffer(Len(CharacterTo) + 7 + X) = Asc(Mid(Text, X, 1)) Next X SendPacket ProcessID, PacketBuffer End Function
thats how i called itCode:Private Sub Command1_Click() PrivateMessage "playername", "Hello!" End Sub
any ideas?
This this dude:
Code:Public Function PrivateMessage(CharacterTo As String, Text As String) Dim ProcessID As Long Dim PacketBuffer() As Byte ReDim PacketBuffer(8 + Len(CharacterTo) + Len(Text)) Dim X As Long GetWindowThreadProcessId Tibia_Hwnd, ProcessID PacketBuffer(0) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 1) PacketBuffer(1) = LongToByte((Len(CharacterTo) + (Len(Text)) + 6), 2) PacketBuffer(2) = &H96 PacketBuffer(3) = &H4 PacketBuffer(4) = Len(CharacterTo) PacketBuffer(5) = &H0 For X = 1 To Len(CharacterTo) PacketBuffer(X + 5) = Asc(Mid(CharacterTo, X, 1)) Next X PacketBuffer(Len(CharacterTo) + 6) = LongToByte(Len(Text), 1) PacketBuffer(Len(CharacterTo) + 7) = LongToByte(Len(Text), 2) For X = 1 To Len(Text) PacketBuffer(Len(CharacterTo) + 7 + X) = Asc(Mid(Text, X, 1)) Next X SendPacket ProcessID, PacketBuffer End Function
got it to work already, thanks tho