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]
|