• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

[Release] Anti AFK Source code

Junior Spellweaver
Joined
Jul 24, 2007
Messages
139
Reaction score
30
Since many server owners are angry with afkers here I release this old and a little noobish code,
since in that time I started coding (You can see the big fault using too many timers xD). That doesnt mean that the Anti AFK doesnt works, it was tested on CzF 1.00.08 files.

AntiAFK.asm

Code:
.386
.Model flat , StdCall
Option CaseMap:none
Include    \masm32\include\windows.inc
Include    \masm32\include\user32.inc
Include    \masm32\include\kernel32.inc
Include    \masm32\include\masm32.inc
IncludeLib    \masm32\lib\user32.lib
IncludeLib    \masm32\lib\kernel32.lib
IncludeLib    \masm32\lib\masm32.lib
Include    \masm32\macros\MACROS.ASM

TimePassed Proto :DWord, :DWord, :DWord, :DWord

.Const
AllocSpace Equ 65000H
IDC_TIMER Equ 3
gObj Equ 6586798H
BufferIni2 Equ 50H
MaxTextBuffer Equ 70H
.Data
hMemory HANDLE ?
pMemory DWord ?
gObjGameClose DD 004C55C0H
AFKI DB "Your coordinates are saving for AntiAFK" , 0
MessageOutPut DD 004F0820H
ClientClose DD 0047E8E0H
AntiAFKKeyWord8 DB "AntiAFK", 0
AntiAFK5 DB "AntiAFK", 0
AntiAFK6 DB "Time", 0
AntiAFKIni DB "C:\MuServer\Gameserver\AntiAFK.ini", 0
BufferIni DB BufferIni2 Dup(0)
.Data?

.Code

DllEntry Proc hInstDLL:HINSTANCE, reason:DWord, reserved1:DWord
 Mov Eax, TRUE
 Ret
DllEntry EndP
AFK Proc
    Local lpObj:DWord
    Local PlayerID:DWord
    Local CordX:DWord
    Local CordY:DWord
    Local GShWnd:DWord
    Local PlayerBaseID:DWord
    Mov lpObj, Ecx
    ;;Mov Eax, DWord Ptr Ds:[Ecx]
    ;;Mov PlayerID, Eax
    Mov Edx, DWord Ptr Ds:[0B5D94C0H]
    Mov GShWnd, Edx
    Mov PlayerBaseID, 1900H
    Jmp PlayerDetected
PlayerLooper:
    Add PlayerBaseID, 1
    Cmp PlayerBaseID, 191FH
    Jle PlayerDetected
    Cmp PlayerBaseID, 1920H
    Je PlayerDetected
    Jmp Finalizar
PlayerDetected:
    Mov Eax, PlayerBaseID
    IMul Eax, Eax, 18F0H
    Cmp DWord Ptr Ds:[Eax + 658679CH], 3
    Jnz PlayerLooper
    Movsx Edx, Word Ptr Ds:[Eax + 10DH]
    Cmp Edx, 0
    Jnz Continuar
    Mov Cl, Byte Ptr Ds:[Eax + 108H]
    Cmp Ecx, 166H
    Jle Hacia90
    Jmp Continuar
Hacia90:
    Cmp Cl, 90H
    Jge AY
    Jmp Continuar
AY:
    Mov Cl, Byte Ptr Ds:[Eax + 10AH]
    Cmp Ecx, 170H
    Jle Hacia97
Hacia97:
    Cmp Cl, 97H
    Jge Acabar
    Jmp Continuar
Continuar:
    Mov Eax, lpObj
    Xor Ecx, Ecx
    Mov Cl, Byte Ptr Ds:[Eax + 108H]
    Mov Edx, PlayerBaseID
    IMul Edx, Edx, 10
    Add Edx, pMemory
    Mov Byte Ptr Ds:[Edx + 1], Cl
    Mov Cl, Byte Ptr Ds:[Eax + 10AH]
    Mov Byte Ptr Ds:[Edx + 2], Cl
    Lea Eax, AFKI
    Push Eax
    Mov Ecx, PlayerBaseID
    Push Ecx
    Call MessageOutPut
    Jmp PlayerLooper
Finalizar:
    Mov Al, Byte Ptr Ds:[5C7DA5H]
    Cmp Al, 1
    Je Minuto1
    Cmp Al, 2
    Je Minuto2
    Cmp Al, 3
    Je Minuto3
    Cmp Al, 4
    Je Minuto4
    Cmp Al, 5
    Je Minuto5
    Cmp Al, 6
    Je Minuto6
    Cmp Al, 7
    Je Minuto7
    Cmp Al, 8
    Je Minuto8
    Cmp Al, 9
    Je Minuto9
    Cmp Al, 10
    Je Minuto10
    Cmp Al, 11
    Je Minuto11
    Cmp Al, 12
    Je Minuto12
    Cmp Al, 13
    Je Minuto13
    Cmp Al, 14
    Je Minuto14
    Cmp Al, 15
    Je Minuto15
    Cmp Al, 16
    Je Minuto16
    Cmp Al, 17
    Je Minuto17
    Cmp Al, 18
    Je Minuto18
    Cmp Al, 19
    Je Minuto19
    Cmp Al, 20
    Je Minuto20
    Cmp Al, 21
    Je Minuto21
    Cmp Al, 22
    Je Minuto22
    Cmp Al, 23
    Je Minuto23
    Cmp Al, 24
    Je Minuto24
    Cmp Al, 25
    Je Minuto25
    Cmp Al, 26
    Je Minuto26
    Cmp Al, 27
    Je Minuto27
    Cmp Al, 28
    Je Minuto28
    Cmp Al, 29
    Je Minuto29
    Cmp Al, 30
    Je Minuto30
Minuto1:
    Invoke SetTimer, GShWnd, IDC_TIMER, 60000, Addr TimePassed
    Jmp Acabar
Minuto2:
    Invoke SetTimer, GShWnd, IDC_TIMER, 120000, Addr TimePassed
    Jmp Acabar
Minuto3:
    Invoke SetTimer, GShWnd, IDC_TIMER, 180000, Addr TimePassed
    Jmp Acabar
Minuto4:
    Invoke SetTimer, GShWnd, IDC_TIMER, 240000, Addr TimePassed
    Jmp Acabar
Minuto5:
    Invoke SetTimer, GShWnd, IDC_TIMER, 300000, Addr TimePassed
    Jmp Acabar
Minuto6:
    Invoke SetTimer, GShWnd, IDC_TIMER, 360000, Addr TimePassed
    Jmp Acabar
Minuto7:
    Invoke SetTimer, GShWnd, IDC_TIMER, 420000, Addr TimePassed
    Jmp Acabar
Minuto8:
    Invoke SetTimer, GShWnd, IDC_TIMER, 480000, Addr TimePassed
    Jmp Acabar
Minuto9:
    Invoke SetTimer, GShWnd, IDC_TIMER, 540000, Addr TimePassed
    Jmp Acabar
Minuto10:
    Invoke SetTimer, GShWnd, IDC_TIMER, 600000, Addr TimePassed
    Jmp Acabar
Minuto11:
    Invoke SetTimer, GShWnd, IDC_TIMER, 660000, Addr TimePassed
    Jmp Acabar
Minuto12:
    Invoke SetTimer, GShWnd, IDC_TIMER, 720000, Addr TimePassed
    Jmp Acabar
Minuto13:
    Invoke SetTimer, GShWnd, IDC_TIMER, 780000, Addr TimePassed
    Jmp Acabar
Minuto14:
    Invoke SetTimer, GShWnd, IDC_TIMER, 840000, Addr TimePassed
    Jmp Acabar
Minuto15:
    Invoke SetTimer, GShWnd, IDC_TIMER, 900000, Addr TimePassed
    Jmp Acabar
Minuto16:
    Invoke SetTimer, GShWnd, IDC_TIMER, 960000, Addr TimePassed
    Jmp Acabar
Minuto17:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1020000, Addr TimePassed
    Jmp Acabar
Minuto18:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1080000, Addr TimePassed
    Jmp Acabar
Minuto19:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1140000, Addr TimePassed
    Jmp Acabar
Minuto20:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1200000, Addr TimePassed
    Jmp Acabar
Minuto21:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1260000, Addr TimePassed
    Jmp Acabar
Minuto22:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1320000, Addr TimePassed
    Jmp Acabar
Minuto23:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1380000, Addr TimePassed
    Jmp Acabar
Minuto24:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1440000, Addr TimePassed
    Jmp Acabar
Minuto25:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1500000, Addr TimePassed
    Jmp Acabar
Minuto26:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1560000, Addr TimePassed
    Jmp Acabar
Minuto27:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1620000, Addr TimePassed
    Jmp Acabar
Minuto28:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1680000, Addr TimePassed
    Jmp Acabar
Minuto29:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1740000, Addr TimePassed
    Jmp Acabar
Minuto30:
    Invoke SetTimer, GShWnd, IDC_TIMER, 1800000, Addr TimePassed
    Jmp Acabar
Acabar:
    Ret
AFK EndP
NewGObj Proc
 Invoke GlobalAlloc, GMEM_MOVEABLE Or GMEM_ZEROINIT, AllocSpace
 Mov hMemory, Eax
 Invoke GlobalLock, hMemory
 Mov pMemory, Eax
    Ret
NewGObj EndP
TimePassed Proc hwnd:DWord, uMsg:DWord, idEvent:DWord, dwTime:DWord
    Local lpObj:DWord
    Local PlayerID:DWord
    Local PlayerBaseID:DWord
    Mov PlayerBaseID, 1900H
    Jmp PlayerDetected
PlayerLooper:
    Add PlayerBaseID, 1
    Cmp PlayerBaseID, 191FH
    Jle PlayerDetected
    Cmp PlayerBaseID, 1920H
    Je PlayerDetected
    Jmp Finalizar
PlayerDetected:
    Mov Eax, PlayerBaseID
    IMul Eax, Eax, 18F0H
    Cmp DWord Ptr Ds:[Eax + 658679CH], 3
    Jnz PlayerLooper
    Add Eax, gObj
    Mov lpObj, Eax
    Xor Ecx, Ecx
    Mov Eax, lpObj
    Mov Cl, Byte Ptr Ds:[Eax + 108H]
    Mov Edx, PlayerBaseID
    IMul Edx, Edx, 10
    Add Edx, pMemory
    Xor Eax, Eax
    Mov Al, Byte Ptr Ds:[Edx + 1]
    Cmp Cl, Al
    Jnz PlayerLooper
    Xor Eax, Eax
    Mov Eax, lpObj
    Mov Cl, Byte Ptr Ds:[Eax + 10AH]
    Mov Al, Byte Ptr Ds:[Edx + 2]
    Cmp Al, Cl
    Je KickearPlayer
    Jnz PlayerLooper
    Jmp Finalizar
KickearPlayer:
    Mov Eax, PlayerBaseID
    IMul Eax, Eax, 18F0H
    Mov Ecx, DWord Ptr Ds:[Eax + 65867A8H]
    Push 0
    Push Ecx
    Call ClientClose
    Jmp PlayerLooper
Finalizar:
    Mov DWord Ptr Ds:[5C7D95H], 0
    Xor Eax, Eax
    Ret
TimePassed EndP
Ini Proc
 Invoke GetPrivateProfileString, Addr AntiAFKKeyWord8, Addr AntiAFK5, NULL, Addr BufferIni, SizeOf BufferIni, Addr AntiAFKIni
 Invoke atodw, Addr BufferIni
 Cmp Eax, 0
 Je Time
 Mov Ecx, 1
Time:
 Invoke GetPrivateProfileString, Addr AntiAFKKeyWord8, Addr AntiAFK5, NULL, Addr BufferIni, SizeOf BufferIni, Addr AntiAFKIni
 Invoke atodw, Addr BufferIni
 Mov Byte Ptr Ds:[5C7DA5H], Al
Finalizar:
    Ret
Ini EndP

AntiAFK.ini
Code:
[AntiAFK]
AntiAFK = 1
Time = 1

AntiAFK.def
Code:
LIBRARY AntiAFK
EXPORTS AFK
EXPORTS NewGObj
EXPORTS Ini

The hook is very simple, load the DLL with LoadLibrary, then call directly to NewGObj and Ini after
each GetProcAddress, and save GetProcAddress of AFK Procedure for hook in any GameServer
usefull while.

I hooked it in 1.00.08 on a attack monster procedure, so when a monster attacked it goes to AFK
Procedure. (This means that this AFK is only activated if a monster attacks you, but i think that
for a server with people is strange that a monster doesnt attack any player so I made it in this way).

After that , iit starts checking player positions and if they were the same as before then kick the
player.

If anyone wants to look how i made the full hook just download the files on that i coded
this Anti AFK.

CzF 1.00.08 + Anti AFK
 
Last edited:
Junior Spellweaver
Joined
Aug 28, 2006
Messages
113
Reaction score
0
good work man

More understandable is c++ that asm ;)
 
Twilight Mu Owner
Loyal Member
Joined
Aug 8, 2005
Messages
505
Reaction score
74
Nice release...

Mirror Link:



...
 
Last edited:
Junior Spellweaver
Joined
Jul 24, 2007
Messages
139
Reaction score
30
Thanks Shagoon, mirror added to the first post.

Here also I upload in attachments the compiled DLL for those who dont know how to compile it.
 

Attachments

You must be registered for see attachments list
Junior Spellweaver
Joined
Jul 24, 2007
Messages
139
Reaction score
30
Nice, but it only work when character stands still, what if they use A.Clicker ? Will they be dc ?

Well thats why I said it was a simple AFK, not pro one. In that case you can do a main side protection.
 
Retired Old Man
Loyal Member
Joined
Jun 9, 2008
Messages
761
Reaction score
706
offtop but related XD: someone should make a AFK protection system like, you can define the check time in .ini like CheckEveryMinute = 10, and the system should be that it checks somehow if the mouse havent moved a single bit in 10minutes = KICK :p
 
Junior Spellweaver
Joined
Jul 24, 2007
Messages
139
Reaction score
30
Well in that case it must have both parts : gs and main side.
 
Newbie Spellweaver
Joined
Jul 6, 2012
Messages
96
Reaction score
6
can sahre source code i want change it for other game please
 
Back
Top