Getting the wnotice to commands

Jormungandr

Member
Joined
Oct 23, 2023
Messages
20
Hello,

I saw that Bowie had released a script that allowed us to send a whisper through the commands with charID and charnames.

I have tried to replicate the concept, but with no success.

Can someone guide me to the right way or provide me a functional script that does it, so that I can understand how he has done it?

Thanks!
 
Hello,

I saw that Bowie had released a script that allowed us to send a whisper through the commands with charID and charnames.

I have tried to replicate the concept, but with no success.

Can someone guide me to the right way or provide me a functional script that does it, so that I can understand how he has done it?
 
This was a script that Bowie had released, but the hook and the error combined from the files do not allow the notices. The cmd gives a normal error and does not even consider the command.

If any of you could guide me, this would be greatly appreciated!

[ENABLE]
alloc(notice_hook,2048)
alloc(ntcid_error,64)
alloc(ntcn_error,64)
alloc(ntcid_sent,64)
alloc(ntcn_sent,64)
//hooks CServerApp::OnConsoleCommand
notice_hook:
cmp eax,46
je ntcid
cmp eax,45
je ntcn
//original code
cmp eax,44
ja 0040B3D4
jmp 00409498

ntcid:
cmp dword ptr[ebp+0C],02 //args
jne 0040B3D4
add ebx,04
push ebx //charid
call 0051BA99 //ps_game.atoi
mov ecx,eax //eax = charid
add esp,04
test ecx,ecx
je ntcid_fail

push ecx //charid
call 00414CC0 //CWorld::FindUser
mov esi,eax
test esi,esi
je ntcid_fail

mov eax,[ebx+100] //notice
cmp eax,80
ja ntcid_fail

lea edx,[ebx+104]
sub esp,100
mov edi,esp
mov edi,edx
mov word ptr[esp],F90B
mov byte ptr[esp+02],al
xor edi,edi

ntcid_str_len:
cmp edi,eax
je ntcid_str_end
mov ecx,[edx+edi]
mov [esp+edi+03],ecx
inc ecx
inc edi
jmp ntcid_str_len

ntcid_str_end:
mov edx,esp
add eax,03
mov ecx,esi //user = esi
push eax //packet length
push edx //packet data
call 004ED0E0 //SConnection::Send
add esp,100
mov eax,[esp+3C]
push ntcid_sent
push eax
call 0051A8CD //ps_game.sprintf
add esp,08
jmp 0040B3D4

ntcid_fail:
push ebx
push ntcid_error
push edi
call 0051A8CD //ps_game.sprintf
add esp,0C
jmp 0040B3D4

ntcn:
cmp dword ptr[ebp+0C],02 //args
jne 0040B3D4
add ebx,04
mov eax,ebx //ebx = charname
call 00414CE0 //unidentified
mov esi,eax
test esi,esi
je ntcn_fail

mov eax,[ebx+100] //notice
cmp eax,80
ja ntcn_fail

lea edx,[ebx+104]
sub esp,100
mov edi,esp
mov edi,edx
mov word ptr[esp],F90B
mov byte ptr[esp+02],al
xor edi,edi

ntcn_str_len:
cmp edi,eax
je ntcn_str_end
mov ecx,[edx+edi]
mov [esp+edi+03],ecx
inc ecx
inc edi
jmp ntcn_str_len

ntcn_str_end:
mov edx,esp
add eax,03
mov ecx,esi //user = esi
push eax //packet length
push edx //packet data
call 004ED0E0 //SConnection::Send
add esp,100

mov eax,[esp+3C]
push ntcn_sent
push eax
call 0051A8CD //ps_game.sprintf
add esp,08
jmp 0040B3D4

ntcn_fail:
push ebx
push ntcn_error
push edi
call 0051A8CD //ps_game.sprintf
add esp,0C
jmp 0040B3D4


ntcid_error:
db 'cmd send notice by char id(%s) failed',0

ntcn_error:
db 'cmd send notice by char name(%s) failed',0

ntcid_sent:
db 'cmd send notice by char id ok!',0

ntcn_sent:
db 'cmd send notice by char name ok!',0

0040948F:
jmp notice_hook

[DISABLE]
dealloc(notice_hook)
dealloc(ntcid_error)
dealloc(ntcn_error)
dealloc(ntcid_sent)
dealloc(ntcn_sent)
0040948F:
cmp eax,44
ja 0040B3D4

[ENABLE]
alloc(notice_error,128)
alloc(error_output,32)
//hooks CServerApp::OnConsoleCommand
notice_error:
mov eax,[0109E6F8]
cmp eax,00 //users
je send_error
mov edi,[ebx]
cmp edi,80 //length
ja send_error
lea edx,[ebx+04]
jmp 004097C0

send_error:
mov eax,[esp+3C]
push error_output
push eax
call 0051A8CD //ps_game.sprintf
add esp,08
jmp 0040B3D4

error_output:
db 'cmd send notice failed',0

004097BB:
jmp notice_error

[DISABLE]
dealloc(notice_error)
dealloc(error_output)
004097BB:
mov edi,[ebx]
lea edx,[ebx+04]
 
Back
Top