All pastes #412890 Raw Edit

Y_Server_System.pwn

public text v1 · immutable
#412890 ·published 2007-03-28 00:42 UTC
rendered paste body
#include <a_samp>

#if !defined MAX_STRING
	#define MAX_STRING		256
#endif

#define MAX_LANGUAGES		Language:4
#define MAX_MODULES			Module:10 // Absolute maximum is 50 (MAX_FILTER_SCRIPTS)

#include "YSS_3/YSI_misc.own"
#include "YSS_3/YSI_bintree.own"
#include "YSS_3/YSI_INI.own"
#include "YSS_3/YSI_modules.own"
#include "YSS_3/YSI_text.own"
#include "YSS_3/YSI_languages.own"

/*SendClientMessage2(playerid, color, message[])
{
	SendClientMessage(playerid, color, Text_GetText(message, Langs_GetPlayerLanguage(playerid)));
}*/

/*----------------------------------------------------------------------------*-

YAdmin system - Main Core

Changelog:

23/03/07:

Restarted again, this is at least version 3 but I'm sure there's an older version I've lost or coded over beyond recognition.

-*----------------------------------------------------------------------------*/

// Function info template

/*----------------------------------------------------------------------------*-
Function:
	-
Params:
	-
Return:
	-
Notes:
	-
-*----------------------------------------------------------------------------*/

/*----------------------------------------------------------------------------*-
Function:
	OnFilterScriptInit
Params:
	-
Return:
	1 - Standard OnFilterScriptInit return value
Notes:
	Entry point for the entire admin system, does surprisingly little for what
	is implied by that (i.e. importance).  Called automatically, you should
	never ever call this ever ever.
	
	EVER.
	
	Can't be inline as it's public
-*----------------------------------------------------------------------------*/

public OnFilterScriptInit()
{
	RestartAdminSystem();
	return 1;
}

/*----------------------------------------------------------------------------*-
Function:
	RestartAdminSystem
Params:
	-
Return:
	-
Notes:
	Does the hard work OnFilterScriptInit can't be bothered with
-*----------------------------------------------------------------------------*/

#define yprintf(%1,%2,%3) _yprintf("%s%1", indentlines(%2), %3)
#define indent(%1) _yprintf("%s", indentlines(%2))

Text_RegisterTag(main);

RestartAdminSystem()
{
	/*static
		s_hasBeenStarted = 0;*/

	// Initialise settings
	// Initailise commands
	// Initialise menus

	// Initialise modules pool
	if (Modules_GetModuleCount() > 0) Modules_CloseAll();
	Modules_Modules();
	
	// Load INI
	
	// Load language data
	Langs_AddLanguage("EN", "English");
	Langs_AddLanguage("DE", "Deutsch");

	Text_Text();

	Langs_Langs();
	
	//Text_Debug();

	/*yprintf(- YSS core %sstarted, 0, s_hasBeenStarted ? "re" : "");
	indent(1);
	//yprintf(- Loading Modules: %s,	1, LoadModules() ? "OK" : strcat("FAILED: ", GetLastError()));
	indent(1);

	printf(" - YSS core %sstarted", s_hasBeenStarted ? "re" : "");*/
	//s_hasBeenStarted = 1;

	new
		time1,
		time2,
		time3;
		
	/*time1 = GetTickCount();
	for (new i = 0; i < 10000; i++)
	{
		Text_GetText("TEXT_AD_RCON_HELP", 0);
	}
	time2 = GetTickCount();
	for (new i = 0; i < 10000; i++)
	{
		Text_GetTextLinear("TEXT_AD_RCON_HELP", 0);
	}
	time3 = GetTickCount();*/
	printf("time 1: %d, time 2: %d", time2 - time1, time3 - time2);
}

public OnPlayerConnect(playerid)
{
	SendClientMessage2(playerid, 0x00FF00AA, "TEXT_MAIN_HELP_1");
	GameTextForAll2("TEXT_MAIN_BLEVEL", 5000, 3);
	return 1;
}