Examples of a simple handshake, it has a little secure.
Client-Sided
function clientCmdHS_Recieve()
{
commandToServer('HS_SuccessfulRecieve',"YourCodeHere"); //If you want it to be a little more secured you can just put a code for them
}
function clientCmdHS_onSuccess()
{
if(!$HS::Successful)
{
$HS::Successful = 1;
echo("Handshake - Successful");
}
}
Server-Sided
function GameConnection::HS_TestClient(%this)
{
if(!%this.HS_Client)
{
commandToClient(%this,'HS_Recieve');
%this.HS_TestClientSch = %this.schedule(1000,HS_TestClient2);
echo("Handshake - Checking " @ %this.getPlayerName());
}
}
function GameConnection::HS_TestClient2(%this)
{
if(%this.HS_Client)
{
%this.chatMessage("\c6You have the client. Enjoy!");
echo("Handshake - " @ %this.getPlayerName() @ " has the client.");
}
else
{
%this.chatMessage("\c6You do not have the client. Please get the client.");
echo("Handshake - " @ %this.getPlayerName() @ " does not have the client.");
}
}
function serverCmdHS_SuccessfulRecieve(%this,%code)
{
if(%code $= "YourCodeHere" && !%this.HS_Client)
{
cancel(%this.HS_TestClientSch);
%this.HS_Client = 1; //Make sure they can't keep doing this
commandToClient(%this,'HS_onSuccess');
}
}
This can be used with GameConnection::AutoAdminCheck(%client).