mirror of
https://github.com/Mauler125/r5sdk.git
synced 2025-02-09 19:15:03 +01:00
Add extra SQVM features
Added 'GetNumHumanPlayers' and 'GetNumFakeClients' to SERVER vm Changed hardcoded strings in UI 'GetPromoData' to localization keys TODO: add localization files to SDK
This commit is contained in:
parent
5d69d7284e
commit
b4485f1d23
@ -13,6 +13,7 @@
|
||||
|
||||
#include "core/stdafx.h"
|
||||
#include "engine/sys_utils.h"
|
||||
#include "engine/baseserver.h"
|
||||
#include "squirrel/sqtype.h"
|
||||
#include "squirrel/sqapi.h"
|
||||
#include "squirrel/sqinit.h"
|
||||
@ -47,6 +48,23 @@ namespace VSquirrel
|
||||
#ifndef CLIENT_DLL
|
||||
namespace SERVER
|
||||
{
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: gets the number of real players on this server
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT GetNumHumanPlayers(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushinteger(v, g_pServer->GetNumHumanPlayers());
|
||||
return SQ_OK;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: gets the number of fake players on this server
|
||||
//-----------------------------------------------------------------------------
|
||||
SQRESULT GetNumFakeClients(HSQUIRRELVM v)
|
||||
{
|
||||
sq_pushinteger(v, g_pServer->GetNumFakeClients());
|
||||
return SQ_OK;
|
||||
}
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
#ifndef DEDICATED
|
||||
@ -129,37 +147,37 @@ namespace VSquirrel
|
||||
{
|
||||
case R5RPromoData::PromoLargeTitle:
|
||||
{
|
||||
svPromo = "Welcome To R5Reloaded!";
|
||||
svPromo = "#PROMO_LARGE_TITLE";
|
||||
break;
|
||||
}
|
||||
case R5RPromoData::PromoLargeDesc:
|
||||
{
|
||||
svPromo = "Make sure to join the discord! discord.gg/r5reloaded";
|
||||
svPromo = "#PROMO_LARGE_DESCRIPTION";
|
||||
break;
|
||||
}
|
||||
case R5RPromoData::PromoLeftTitle:
|
||||
{
|
||||
svPromo = "Yes";
|
||||
svPromo = "#PROMO_LEFT_TITLE";
|
||||
break;
|
||||
}
|
||||
case R5RPromoData::PromoLeftDesc:
|
||||
{
|
||||
svPromo = "Your ad could be here";
|
||||
svPromo = "#PROMO_LEFT_DESCRIPTION";
|
||||
break;
|
||||
}
|
||||
case R5RPromoData::PromoRightTitle:
|
||||
{
|
||||
svPromo = "Yes2";
|
||||
svPromo = "#PROMO_RIGHT_TITLE";
|
||||
break;
|
||||
}
|
||||
case R5RPromoData::PromoRightDesc:
|
||||
{
|
||||
svPromo = "Yes3";
|
||||
svPromo = "#PROMO_RIGHT_DESCRIPTION";
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
svPromo = "You should not see this.";
|
||||
svPromo = "#PROMO_SDK_ERROR";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -21,9 +21,13 @@ namespace VSquirrel
|
||||
SQRESULT SDKNativeTest(HSQUIRRELVM v);
|
||||
SQRESULT GetSDKVersion(HSQUIRRELVM v);
|
||||
}
|
||||
#ifndef CLIENT_DLL
|
||||
namespace SERVER
|
||||
{
|
||||
SQRESULT GetNumHumanPlayers(HSQUIRRELVM v);
|
||||
SQRESULT GetNumFakeClients(HSQUIRRELVM v);
|
||||
}
|
||||
#endif // !CLIENT_DLL
|
||||
#ifndef DEDICATED
|
||||
namespace CLIENT
|
||||
{
|
||||
|
@ -281,6 +281,8 @@ void SQVM_RegisterServerScriptFunctions(HSQUIRRELVM v)
|
||||
{
|
||||
HSQVM_RegisterFunction(v, "SDKNativeTest", "Native SERVER test function", "void", "", &VSquirrel::SHARED::SDKNativeTest);
|
||||
HSQVM_RegisterFunction(v, "GetSDKVersion", "Gets the SDK version as a string", "string", "", &VSquirrel::SHARED::GetSDKVersion);
|
||||
HSQVM_RegisterFunction(v, "GetNumHumanPlayers", "Gets the number of human players on the server", "int", "", &VSquirrel::SERVER::GetNumHumanPlayers);
|
||||
HSQVM_RegisterFunction(v, "GetNumFakeClients", "Gets the number of bot players on the server", "int", "", &VSquirrel::SERVER::GetNumFakeClients);
|
||||
}
|
||||
|
||||
#ifndef DEDICATED
|
||||
|
Loading…
x
Reference in New Issue
Block a user