Print Page | Close Window

True /reboot Command

Printed From: Mirage Source
Category: Tutorials
Forum Name: Temporary Archive (Read Only)
Forum Discription: Temporary 3.0.3 archive tutorials, will be deleted when converted.
URL: http://ms.shannaracorp.com/backup-forums/forum_posts.asp?TID=155
Printed Date: 20 December 2006 at 5:52pm
Software Version: Web Wiz Forums 8.01 - http://www.webwizforums.com


Topic: True /reboot Command
Posted By: Sync
Subject: True /reboot Command
Date Posted: 11 February 2006 at 3:10pm
Okay everyone, I, bymyself, discovered how to make a real working bootstrap / reboot thing. First, DL the old MW bootstrap, and put it in the folder with your Server.exe. DL it here  : http://www.sapphireocean.net/c2cl/Bootstrap.rar - Download :

.:::::::::CLIENT SIDE:::::::::::.

Open modGameLogic

Find:
        ' // Creator Admin Commands //
        If GetPlayerAccess(MyIndex) >= ADMIN_CREATOR Then
             ' Giving another player access
             If LCase(Mid(MyText, 1, 10)) = "/setaccess" Then
                 ' Get access #
                 I = Val(Mid(MyText, 12, 1))
                 
                 MyText = Mid(MyText, 14, Len(MyText) - 13)
                
                 Call SendSetAccess(MyText, I)
                 MyText = ""
                 Exit Sub
             End If


After that, add:
             ' Server Reboot
             If LCase(Mid(MyText, 1, 7)) = "/reboot" Then
                Call SendData("rebootserver" & SEP_CHAR & END_CHAR)
                MyText = ""
                Exit Sub
             End If


Now, that is IT for the client. Can you believe it? yes, very easy.

.::::::::::::::::SERVER SIDE:::::::::::::::::.

in the Server, Open modServerTCP

Add this code somewhere in Sub HandleData:
    ' ::::::::::::::::::::::::::
    ' :: Reboot Server Packet ::
    ' ::::::::::::::::::::::::::
    If LCase(Parse(0)) = "rebootserver" Then
        ' Prevent hacking
        If GetPlayerAccess(Index) < ADMIN_CREATOR Then
             Call HackingAttempt(Index, "Admin Cloning")
             Exit Sub
        End If
          Call ServerReboot
       Exit Sub
    End If


at the bottom of modServerTCP Add this code:
Sub ServerReboot()
frmServer.tmrReboot.Enabled = True
End Sub


Now go to frmServer. Copy tmrShutdown. Rename this new timer tmrReboot. Put this code in it:
Private Sub tmrReboot_Timer()
Static Secs As Long

    If Secs <= 0 Then Secs = 30
    Call GlobalMsg("Server Reboot in " & Secs & " seconds.", BrightBlue)
    Call TextAdd(frmServer.txtText, "Automated Server Reboot in " & Secs & " seconds.", True)
    Secs = Secs - 2
    If Secs <= 0 Then
        tmrReboot.Enabled = False
        Shell (App.Path & "/Bootstrap.exe"), vbNormalFocus
        Call DestroyServer
    End If
End Sub


Now as long as the Bootstrap.exe is in there, is will reboot! Hoorah!

[NOTE] The bootstrap loads before the server is completely dead, however the bootstrap will not RELOAD the server until the server has shutdown completely. :-D [/NOTE]



Print Page | Close Window

Bulletin Board Software by Web Wiz Forums version 8.01 - http://www.webwizforums.com
Copyright ©2001-2006 Web Wiz Guide - http://www.webwizguide.info