Openplanet lib for ManiaScript game modes

By

Posted: May 30 2018

Last updated: May 23 2019

Downloads 36
Download LibOpenplanetMS.zip (4.68 KB)

A simple framework library automating the process of detecting Openplanet in game modes and game mode manialinks.

Usage

To use the library, you're required to load both the server-side lib in your game mode and the client-side lib within the playground ManiaApp.

In a ModeBase2 game mode:

#Include "Libs/domino54/Openplanet_Server.Script.txt" as Openplanet

***Match_LogVersions***
***
Log::RegisterScript(Openplanet::GetScriptName(), Openplanet::GetScriptVersion());
***

***Match_InitServer***
***
Openplanet::Load();
***

***Match_Yield***
***
Openplanet::Loop();
***

// Usage example:
Void UsageExample() {
    declare NbOpenplanetUsers = 0;

    foreach (Player in AllPlayers) {
        if (Openplanet::HasOpenplanet(Player)) {
            NbOpenplanetUsers += 1;
        }
    }

    // Shortcut of the above:
    NbOpenplanetUsers = Openplanet::NbOpenplanetUsers();

    log(NbOpenplanetUsers^" out of "^AllPlayers.count^" connected players have Openplanet installed.");
}

In an AppBase client ManiaApp:

#Include "ManiaApps/domino54/Openplanet_Client.Script.txt" as Openplanet

***LogVersions***
***
Log::RegisterScript(Openplanet::GetScriptName(), Openplanet::GetScriptVersion());
***

***LoadLibraries***
***
Openplanet::Load();

// Usage example:
if (Openplanet::IsOutdated()) {
    ClientUI.StatusMessage = "Your Openplanet build is outdated, please upgrade!";
}
***