Updated code
unknown
c_cpp
2 years ago
2.6 kB
12
Indexable
#include "pch.h"
auto digit_format = "%d";
auto tp_cmd = "!tp";
auto tp_message_format = "You will teleported to %s";
char tp_message[128];
char primary_scanned_cmd_digit[4];
int player_level = 0;
const char* map_name(int map_id) {
int player_level = (int)*reinterpret_cast<short*>(0x90D1E4);
switch (player_level >= 70) {
case true: // Player level is greater than or equal to 70
switch (map_id) {
case 1: return "Auction House";
case 2: return "Capital";
case 3: return "D-Water Borderland";
case 4: return "Oblivion Insula";
case 5: return "Kimuraku Room";
case 6: return "Deep Desert-1";
case 7: return "Deep Desert-2";
case 8: return "Stable Erde";
case 9: return "Kanos Illium";
default: return "Not enabled.";
}
case false: // Player level is less than 70
switch (map_id) {
case 1: return "Auction House";
case 2: return "Capital";
case 3: return "Proelium";
case 4: return "Cantabilian";
case 5: return "Deep Desert-1";
case 6: return "Not enabled.";
case 7: return "Not enabled.";
case 8: return "Not enabled.";
case 9: return "Not enabled.";
default: return "Not enabled.";
}
}
}
DWORD add_commands_retn = 0x4867A6;
DWORD add_commands_exit = 0x487532;
_declspec(naked) void add_commands()
{
_asm
{
push 03 // Length
push tp_cmd // Command
push edi
call compare_string
add esp, 12
test eax, eax
je command_1
push 0x13D4
jmp add_commands_retn
command_1 :
pushad
cmp word ptr ds:[0x90E2E0],41
je command_1_exit
push ecx
mov ecx, 0x7C4A68
mov eax, [0x90E2F4]
mov eax, [eax]
push eax
call get_player
pop ecx
test eax, eax
je command_1_exit
mov ecx, eax
push ecx
push offset primary_scanned_cmd_digit
push digit_format
add edi, 04
push edi
call digit_scanner
add esp, 12
pop ecx
push primary_scanned_cmd_digit
call map_name
add esp,04
cmp dword ptr[primary_scanned_cmd_digit],0
je map_is_not_enabled
cmp dword ptr [primary_scanned_cmd_digit],6
ja map_is_not_enabled
push eax
push tp_message_format
push offset tp_message
call sprintf
add esp, 12
push offset tp_message
push 0
call write_client_chat_text
lea ebx, [tp_packet]
mov esi, offset primary_scanned_cmd_digit
mov esi, [esi]
mov [ebx + 3], esi
push 04
push ebx
call send_packet
add esp, 8
command_1_exit:
popad
jmp add_commands_exit
map_is_not_enabled:
push eax
push offset tp_message
call sprintf
add esp, 8
push offset tp_message
push 0
call write_client_chat_text
jmp command_1_exit
}
}
void COMMANDS() {
Hook((LPVOID)0x4867A1, add_commands, 5);
}Editor is loading...