Okay my very first tuturial.
I would like to thank Godsenddeath, Sonire and Dark Dragon for helping me figure out bits of the code. (Im still learning)
This will add a /Shutdown command into your game which will let you shutdown the server from your Client side.
Also after this is the php script which will let you start your server from anywhere in the world :shock:
This is also based on that you have already got the Server Shutdown update from Dark Dragons tuturial http://www.miragesource.com/community/viewtopic.php?t=228 - http://www.miragesource.com/community/viewtopic.php?t=228
1: First we start on the Client. Open up modGameLogic and in Sub HandleKeypresses. You need to find the Creator Commands
' // Creator Admin Commands // If GetPlayerAccess(MyIndex) >= ADMIN_CREATOR Then and type in underneath it with the other creator commands:
' Shutdown command If Mid(MyText, 1, 9) = "/shutdown" Then Call SendData("shutdown" & SEP_CHAR & END_CHAR) MyText = "" Exit Sub End If End If
What this is doing is, When you type /Shutdown into the client, It sees it and activates the Shutdown packet.
2: Now you need to go to modClientTCP and find Sub HandleData. Somewhere near the other Command Packets type in:
' ::::::::::::::::::::::::: ' :: ShutDown Packet :: ' ::::::::::::::::::::::::: If (LCase(Parse(0)) = "shutdown") Then Call SendData("shutdown" & SEP_CHAR & END_CHAR) Exit Sub End If
3 Now Last of all on the Server side. Go to modServerTCP and find Sub HandleData. Type in, Preferbly near the other command packets
' ::::::::::::::::::::::: ' :: Shutdown Packet :: ' ::::::::::::::::::::::: If LCase(Parse(0)) = "shutdown" Then ' Prevent hacking If GetPlayerAccess(index) < ADMIN_CREATOR Then Call HackingAttempt(index, "Trying to use powers not available") Exit Sub End If If ShutOn = False Then frmServer.tmrShutdown.Enabled = True ShutOn = True End If End If
------------------------------------------------------
Okay that Will shutdown your server.. Once you have done whatever you wanted to do, Updates..Etc..etc
Now what happens when you want to start it.
Well this simple php file will help you out.
Just make a new php document and add this code between the <body> and </body> tags
<?php exec('server.exe'); ?>
This will need to go in the same folder as your Server.exe to work
Tuturial by Zwabbe :D
|