zDiscord-Map-Pack/scripts/autoexec/dmpVersionCheck.cs

39 lines
1,007 B
C#
Raw Permalink Normal View History

2020-12-06 20:14:57 +00:00
// Tells the server what version of the DMP pack the client is using
// This is used primarily for the server logo on the loading screen
// As the server will skip showing the server logo image if a
// Version isnt detected
// Alternatively, this can also be used to debug aspects as the Pack version
// will be known to the server
2020-12-14 20:06:57 +00:00
$DMP::Version = 4.7;
2020-12-06 20:14:57 +00:00
// Client Only
addMessageCallback('MsgDMPVer', DMPReturn);
function DMPReturn()
{
commandToServer('ClientDMPVersion',$DMP::Version);
}
// Server Only
function serverCmdClientDMPVersion(%client, %version)
{
if(!%client.dmpVersion)
%client.dmpVersion = %version;
}
package dmpVersionCheck
{
function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, %voicePitch )
{
parent::onConnect( %client, %name, %raceGender, %skin, %voice, %voicePitch );
messageClient(%client, 'MsgDMPVer');
}
};
// Prevent package from being activated if it is already
if (!isActivePackage(dmpVersionCheck))
activatePackage(dmpVersionCheck);