Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

GM Shouts

Status
Not open for further replies.
Goodbye
Member
Joined
Oct 6, 2009
Messages
965
Reaction score
134
Here is an autoit script which uses the method I described for GM Shouts. It changes zoneserver memory where it stores the welcome message.

Messages are loaded from messages.txt file.

Code:
#RequireAdmin
#include "NomadMemory.au3";
#Include <String.au3>
#Include <Timers.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GuiStatusBar.au3>
#include <WindowsConstants.au3>
#Include <Date.au3>

$formGMShouts = GUICreate("GM Shouts - made by ChrissDeGrece @2010", 592, 456, 193, 129)
$Group1 = GUICtrlCreateGroup("Messagelist", 8, 8, 465, 273)
$msgList = GUICtrlCreateList("", 16, 24, 441, 240, BitOR($LBS_NOTIFY,$WS_VSCROLL,$WS_BORDER))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$bReload = GUICtrlCreateButton("Reload", 496, 16, 75, 25)
$StatusBar = _GUICtrlStatusBar_Create($formGMShouts)
Dim $StatusBar_PartsWidth[2] = [250, -1]
_GUICtrlStatusBar_SetParts($StatusBar, $StatusBar_PartsWidth)
_GUICtrlStatusBar_SetText($StatusBar, "Messages will change every 60 seconds", 0)
_GUICtrlStatusBar_SetText($StatusBar, @TAB & @TAB & "GMShouts made by ChrissDeGrece @2010       ", 1)
$bStart = GUICtrlCreateButton("Start", 496, 48, 75, 25)
$bStop = GUICtrlCreateButton("Stop", 496, 80, 75, 25)
$Group2 = GUICtrlCreateGroup("Errors", 8, 304, 465, 113)
$lbErrors = GUICtrlCreateList("", 16, 320, 449, 84)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUISetState(@SW_SHOW)

$test = SetPrivilege("SeDebugPrivilege", 1)
$oops = 0
$curdate = _NowCalcDate()

$started = 0	
$messages = 0 
$msgcounter = 0
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit

		Case $bReload
			$reply = MsgBox(4,"Reload?","Reload from messages file?")
			If $reply = 6 Then 
				ReadMsgFile()
			Else
				MsgBox(0,'OOOPS!','Not reloading!')
			EndIf
		Case $bStart
			$reply = MsgBox(4,"Start GM Shouts?","Start sending messages to ZoneServer?")
			If $reply = 6 Then 
				_GUICtrlStatusBar_SetText($StatusBar, "(Started) Messages will change every 60 seconds", 0)
				StartTimer()
			EndIf
		Case $bStop
			$reply = MsgBox(4,"Stop GM Shouts?","Stop sending messages to ZoneServer?")
			If $reply = 6 Then 
				_GUICtrlStatusBar_SetText($StatusBar, "(Stopped) Messages will change every 60 seconds", 0)
				StopTimer()
			EndIf
	EndSwitch
WEnd

Func SendToZS($msg)
	
	$Prog_ID=WinGetProcess("[CLASS:ZoneServer]")

	$Address= 0x00F9C804  ;Address holding the message

	$result = _MemoryOpen($Prog_ID)

	$Game_Memory=_MemoryGetBaseAddress($result,1)

	if @error > 0 Then
		MsgBox(0,"Error getting zoneserver base address, !",@error)
		StopTimer()
	EndIf

	;$welcome_string = _MemoryRead(0x00F9C804,$result,'char[47]')

	$newstring = $msg & _StringRepeat(" ", 45 - StringLen($msg))

	$res = _MemoryWrite(0x00F9C804,$result,$newstring,'char[47]')

	_MemoryClose($result)
	
EndFunc


Func UpdateMsg()
	
	

		If $msgcounter < $messages Then
			;_GUICtrlStatusBar_SetText($StatusBar, _GUICtrlListBox_GetText($msgList, $msgcounter) & $msgcounter, 0)
			;_GUICtrlListBox_AddString($msgList, _GUICtrlListBox_GetText($msgList, $msgcounter))
			SendToZS(_GUICtrlListBox_GetText($msgList, $msgcounter))
			$msgcounter = $msgcounter + 1
		Else
			$msgcounter = 0
			;_GUICtrlStatusBar_SetText($StatusBar, _GUICtrlListBox_GetText($msgList, $msgcounter) & $msgcounter, 0)
			;_GUICtrlListBox_AddString($msgList, _GUICtrlListBox_GetText($msgList, $msgcounter))
			SendToZS(_GUICtrlListBox_GetText($msgList, $msgcounter))
			$msgcounter = $msgcounter + 1
		EndIf
	
	
EndFunc

Func StopTimer()
	AdlibUnRegister("UpdateMsg")
EndFunc

Func StartTimer()
	if $messages = 0 then ReadMsgFile()
	AdlibRegister ( "UpdateMsg" , 60000 )
EndFunc

Func ReadMsgFile()
	$messages = 0
	$file = FileOpen("messages.txt", 0)

	; Check if file opened for reading OK
	If $file = -1 Then
		MsgBox(0, "Error", "Unable to open file.")
		Exit
	EndIf

	; Read in lines of text until the EOF is reached
	While 1
		$line = FileReadLine($file)
		If @error = -1 Then ExitLoop
		
		If StringLen($line) <= 45 Then
			_GUICtrlListBox_AddString($msgList, $line)
			$messages = $messages + 1
		Else
			MsgBox(0,"Ooops!","Line : " & $line & " exceeds allowed size of 45")
		EndIf
			

	Wend

	FileClose($file)
EndFunc


;===================================================================================================
; Function........:  _MemoryGetBaseAddress($ah_Handle, $iHD)
;
; Description.....:  Reads the 'Allocation Base' from the open process.
;
; Parameter(s)....:  $ah_Handle - An array containing the Dll handle and the handle of the open
;                                 process as returned by _MemoryOpen().
;                    $iHD - Return type:
;                       |0 = Hex (Default)
;                       |1 = Dec
;
; Requirement(s)..:  A valid process ID.
;
; Return Value(s).:  On Success - Returns the 'allocation Base' address and sets @Error to 0.
;                    On Failure - Returns 0 and sets @Error to:
;                       |1 = Invalid $ah_Handle.
;                       |2 = Failed to find correct allocation address.
;                       |3 = Failed to read from the specified process.
;
; Author(s).......:  Nomad. Szhlopp.
; URL.............:  http://www.autoitscript.com/forum/index.php?showtopic=78834
; Note(s).........:  Go to Www.CheatEngine.org for the latest version of CheatEngine.
;===================================================================================================
Func _MemoryGetBaseAddress($ah_Handle, $iHexDec = 0)
    
    Local $iv_Address = 0x01000000
    Local $v_Buffer = DllStructCreate('dword;dword;dword;dword;dword;dword;dword')
    Local $vData
    Local $vType
    
    If Not IsArray($ah_Handle) Then
        SetError(1)
        Return 0
    EndIf
    

    DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))
    
    If Not @Error Then
        
        $vData = Hex(DllStructGetData($v_Buffer, 2))
        $vType = Hex(DllStructGetData($v_Buffer, 3))
        
        While $vType <> "00000080"
            DllCall($ah_Handle[0], 'int', 'VirtualQueryEx', 'int', $ah_Handle[1], 'int', $iv_Address, 'ptr', DllStructGetPtr($v_Buffer), 'int', DllStructGetSize($v_Buffer))
            $vData = Hex(DllStructGetData($v_Buffer, 2))
            $vType = Hex(DllStructGetData($v_Buffer, 3))
            If Hex($iv_Address) = "90000000" Then ExitLoop
            $iv_Address += 65536
            
        WEnd

        If $vType = "00000080" Then
            SetError(0)
            If $iHexDec = 1 Then
                Return Dec($vData)
            Else
                Return $vData
            EndIf
            
        Else
            SetError(2)
            Return 0
        EndIf
        
    Else
        SetError(3)
        Return 0
    EndIf
    
EndFunc

Attached is compiled script & messages.txt

Enjoy!
 
Skilled Illusionist
Joined
Apr 6, 2011
Messages
329
Reaction score
37
The tool is really very Nice.
It is working nicely.
But I've to ask smthng abt it..
The GM Shout file Loads the messages from messages.txt files.
But I've seen that If the letters in 1 sentence is greater than 45 characters, it doesent get loaded in GM shouts file.

Can I / Will U increase its letters memory in per sentence ??
If its possible, please let me know.
Thanks in Advance.
 
Experienced Elementalist
Joined
Feb 27, 2010
Messages
283
Reaction score
32
he have released the source code also u can compile and try it out :)
But at same-time when we use this tool server laggs
 
Initiate Mage
Joined
Apr 14, 2008
Messages
35
Reaction score
0
You're a wonderful person
I respect you ^ ^
We take care of him
 
Status
Not open for further replies.
Back
Top