Page 1 of 1

Server Booster v1.0 (2019)

Posted: 24 Sep 2019, 11:46
by LondoN eXtream
Descriere Cu acest plugin puteti activa diferite facilitati care va pot spori (nu in numar foarte mare) dar cat de cat FPS-ul serverului cat si al jucatorilor aflati pe el. Este configurabil din fisier .ini. Pe langa asta am adaugat la el si un simple connect song ce poate fi oricand dezactivat iar piesele sunt adaugate tot din fisier .ini. Are suport si pentru fog in caz ca doriti asa ceva pe server.

Nume: Server Booster
Versiune: 1.0
Autor: LondoN eXtream

Download: https://ufile.io/cyia3jgd
Sursa:
ServerBooster.sma | Afiseaza codul
#include < amxmodx >
#include < amxmisc >
#include < fakemeta >
#include < engine >

/* ___________________________
	Special Include File
	_______________________________*/
#include < amx_settings_api >

/* ___________________________
	Plugin Information
	_______________________________*/
#define PLUGIN	"Server Booster"
#define VERSION	"1.0 (2019) Final"
#define AUTHOR	"LondoN eXtream"

/* ___________________________
	Header of Plugin
	_______________________________*/
new const BOOSTER_FILE[]	=	"ServerBooster.ini";		// Booster config file
new const BOOSTER_DEBUG_FILE[]	=	"ServerBoosterDebug.txt";	// Booster debug file

new bool: g_BODY = true;	// Used for body dissappear
new bool: g_SETTINGS = true;	// Used for server settings
new bool: g_WEAPONS = true;	// Used for weapons dissappear
new bool: g_FOG = true;		// Used for creating non-lag foog
new bool: g_SONGS = true;	// Used for playing in-game songs	
new bool: g_CLIENT = true;	// Used for client-side settings (if possible)
new bool: g_HUD = true;		// Used for default hud messages
new bool: g_DEBUG = true;	// Need to debug the plugin?		

enum
{
	ACTION_VALUES = 1,		// terminat
	ACTION_BODY_BEGIN,		// terminat
	ACTION_SETTINGS_BEGIN,		// terminat
	ACTION_WEAPONS_BEGIN,		// terminat
	ACTION_FOG_BEGIN,		// terminat
	ACTION_SONGS_BEGIN,		// terminat
	ACTION_CLIENT_BEGIN,		// terminat
	ACTION_HUD_BEGIN		// terminat
};

new Array: g_SongsName;

new const g_DEFAULTSONG [ ] = "sound/ServerBooster/loading.mp3";

const MAX_SIZE = 64;

new g_MSGID_CLCORPSE;

new g_MSGID_HUD;

new g_SPAWN_FORWARD;


/* _____________________________
	Plugin Precache
	_______________________________*/
public plugin_precache ( )
{
	_LOADSETTINGS ( BOOSTER_FILE, "SERVER BOOSTER" );

	if ( g_SONGS )
	{
		if ( g_DEBUG )
		{
			_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_SONGS_BEGIN );
		}

		g_SongsName 	= ArrayCreate ( MAX_SIZE, 1 );

		if ( !amx_load_setting_string_arr ( BOOSTER_FILE, "SERVER BOOSTER", "MEDIA", g_SongsName ) )
		{
			amx_save_setting_string ( BOOSTER_FILE, "SERVER BOOSTER", "MEDIA", g_DEFAULTSONG );

			ArrayPushString ( g_SongsName, g_DEFAULTSONG );
		}

		new i, buffer [ 128 ];

		for ( i = 0; i < ArraySize ( g_SongsName ); i++ )
		{
			ArrayGetString ( g_SongsName, i, buffer, charsmax ( buffer ) );
			
			engfunc ( EngFunc_PrecacheSound, buffer );
		}
	}

	if ( g_WEAPONS )
	{
		if ( g_DEBUG )
		{
			_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_WEAPONS_BEGIN );
		}

		g_SPAWN_FORWARD = register_forward ( FM_Spawn, "FORWARD_WEAPON_SPAWN" );
	}

	if ( g_FOG )
	{
		if ( g_DEBUG )
		{
			_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_FOG_BEGIN );
		}

		new FOG = engfunc ( EngFunc_CreateNamedEntity, engfunc ( EngFunc_AllocString, "env_fog" ) );

		DispatchKeyValue ( FOG, "density", "0.0018" );
		DispatchKeyValue ( FOG, "rendercolor", "0 127 255" );
	}

	
}

public FORWARD_WEPON_SPAWN ( ENTITY )
{
	if ( pev_valid ( ENTITY ) )
	{
		static CLASS_NAME [ 32 ];

		pev ( ENTITY, pev_classname, CLASS_NAME, charsmax ( CLASS_NAME ) );

		if ( equal ( CLASS_NAME, "armoury_entity" ) )
		{
			engfunc ( EngFunc_RemoveEntity, ENTITY );

			return FMRES_SUPERCEDE;
		}
	}

	return FMRES_IGNORED;
}

public client_connect ( Player )
{
	if ( g_SONGS )
	{
		new i, g_Song [ 128 ], g_Cmd [ 128 ];
		
		for ( i = 0; i < ArraySize ( g_SongsName ); i++ )
		{

			ArrayGetString ( g_SongsName, i, g_Song, charsmax ( g_Song ) );

			formatex ( g_Cmd, charsmax ( g_Cmd ), "MP3Volume 0.75; mp3 play ^"%s^"", g_Song );

			client_cmd ( Player, g_Cmd );
		}

		if ( g_DEBUG )
		{
			_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_SONGS_BEGIN );
		}
	}

	if ( g_CLIENT )
	{
		if ( g_DEBUG )
		{
			_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_CLIENT_BEGIN );
		}

		static const cl_vars[][] = { "cl_shadows", "cl_minmodels", "cl_weather", "fps_max", "fps_modem" };
		static const cl_values[][] = { "0", "1", "1", "100", "1" };

		new a, j, _cmd [ 128 ];

		for ( a = 0; a < sizeof ( cl_vars ); a++ )
		{
			for ( j = 0; j < sizeof ( cl_values ); j++ )
			{

				formatex ( _cmd, charsmax ( _cmd ), "%s %s", cl_vars [ a ], cl_values [ j ] );

				client_cmd ( Player, _cmd );
			}
		}
	}

	return;
}

public _LOADSETTINGS(const File[], const Section[])
{
	if ( !amx_load_setting_int ( File, Section, "DEBUG", g_DEBUG ) )
	{
		amx_save_setting_int ( File, Section, "DEBUG", g_DEBUG );
	}

	if ( !amx_load_setting_int ( File, Section, "BODY", g_BODY ) )
	{
		amx_save_setting_int ( File, Section, "BODY", g_BODY );
	}

	if ( !amx_load_setting_int ( File, Section, "SETTINGS", g_SETTINGS ) )
	{
		amx_save_setting_int ( File, Section, "SETTINGS", g_SETTINGS );
	}

	if ( !amx_load_setting_int ( File, Section, "WEAPONS", g_WEAPONS ) )
	{
		amx_save_setting_int ( File, Section, "WEAPONS", g_WEAPONS );
	}

	if ( !amx_load_setting_int ( File, Section, "FOG", g_FOG ) )
	{
		amx_save_setting_int ( File, Section, "FOG", g_FOG );
	}

	if ( !amx_load_setting_int ( File, Section, "SONGS", g_SONGS ) )
	{
		amx_save_setting_int ( File, Section, "SONGS", g_SONGS );
	}

	if ( !amx_load_setting_int ( File, Section, "CLIENT", g_CLIENT ) )
	{
		amx_save_setting_int ( File, Section, "CLIENT", g_CLIENT );
	}

	if ( !amx_load_setting_int ( File, Section, "HUD", g_HUD ) )
	{
		amx_save_setting_int ( File, Section, "HUD", g_HUD );
	}

	if ( g_DEBUG )
	{
		_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_VALUES );
	}
}

public _WRITEDEBUGFILE ( const File [ ], BOOSTER_ACTION )
{
	new g_TIME [ 16 ], g_FILE [ 64 ], g_LINE [ 256 ];
	get_time ( "%H:%M", g_TIME, charsmax ( g_TIME ) );
	formatex ( g_FILE, charsmax ( g_FILE ), "addons/amxmodx/configs/debug/%s", File );

	if ( file_exists ( g_FILE ) )
	{
		server_print ( "[%s] Removing old debug file.", g_TIME );

		delete_file ( g_FILE );
	}

	switch ( BOOSTER_ACTION )
	{
		case ACTION_VALUES:
		{
			formatex ( g_LINE, charsmax ( g_LINE ), "[%s] Values for\nBody: %d\nSettings: %d\nWeapons: %d\nFog: %d\nSongs: %d\nClient: %d\nHud: %d",
					g_TIME, g_BODY, g_SETTINGS, g_WEAPONS, g_FOG, g_SONGS, g_CLIENT, g_HUD);

			write_file ( g_FILE, g_LINE );
		}

		case ACTION_BODY_BEGIN:
		{
			formatex ( g_LINE, charsmax ( g_LINE ), "[%s] Begin code for body booster", g_TIME );

			write_file ( g_FILE, g_LINE );
		}

		case ACTION_SETTINGS_BEGIN:
		{
			formatex ( g_LINE, charsmax ( g_LINE ), "[%s] Begin code for server settings boost", g_TIME );
	
			write_file ( g_FILE, g_LINE );
		}

		case ACTION_WEAPONS_BEGIN:
		{
			formatex ( g_LINE, charsmax ( g_LINE ), "[%s] Begin code for weapons boost", g_TIME );

			write_file ( g_FILE, g_LINE );
		}

		case ACTION_FOG_BEGIN:
		{
			formatex ( g_LINE, charsmax ( g_LINE ), "[%s] Begin code for fog boost", g_TIME );
	
			write_file ( g_FILE, g_LINE );
		}

		case ACTION_SONGS_BEGIN:
		{
			formatex ( g_LINE, charsmax ( g_LINE ), "[%s] Begin code for song boost", g_TIME );
		
			write_file ( g_FILE, g_LINE );
		}

		case ACTION_CLIENT_BEGIN:
		{
			formatex ( g_LINE, charsmax ( g_LINE ), "[%s] Begin code for client begin", g_TIME );

			write_file ( g_FILE, g_LINE );
		}

		case ACTION_HUD_BEGIN:
		{
			formatex ( g_LINE, charsmax ( g_LINE ), "[%s] Begin code for hud block", g_TIME );

			write_file ( g_FILE, g_LINE );
		}
	}
}

public plugin_init ( )
{
	register_plugin ( PLUGIN, VERSION, AUTHOR );

	if ( g_BODY )
	{
		if ( g_DEBUG )
		{
			_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_BODY_BEGIN );
		}

		g_MSGID_CLCORPSE 	=	get_user_msgid ( "ClCorpse" );

		set_msg_block ( g_MSGID_CLCORPSE, BLOCK_SET );
	}

	if ( g_SETTINGS )
	{
		if ( g_DEBUG )
		{
			_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_SETTINGS_BEGIN );
		}

		static const server_vars[][] = { "fps_max", "fps_modem", "sys_tickrate", "mp_timelimit" };
		static const server_values[][] = { "1000", "1", "1000", "45" };

		new a, j;

		for ( a = 0; a < sizeof server_vars; a++ )
		{
			for ( j = 0; j < sizeof server_values; j++ )
			{
				set_cvar_string ( server_vars [ a ], server_values [ j ] );
			}
		}
	}


	if ( g_WEAPONS )
	{
		unregister_forward ( FM_Spawn, g_SPAWN_FORWARD );
	}

	if ( g_HUD )
	{
		if ( g_DEBUG )
		{
			_WRITEDEBUGFILE ( BOOSTER_DEBUG_FILE, ACTION_HUD_BEGIN );
		}

		g_MSGID_HUD 	=	get_user_msgid ( "HudTextArgs" );

		set_msg_block ( g_MSGID_HUD, BLOCK_SET );
	}
}
Fisier de configurare:
ServerBooster.ini | Afiseaza codul
;	Server Booster 1.0
; 	by LondoN eXtream
;
;	This is the configuration file
;	===============================

[SERVER BOOSTER]

; If you want to debug the plugin set this to 1, either to 0
DEBUG = 0

; Body dissappear ( for some more fps )
BODY = 1

; Server Side settings enabled or not?
SETTINGS = 1

; Removing all weapon entities from ground?
WEAPONS = 1

; Wanna some fog whithout lag?
FOG = 0

; Want connect song without lag?
SONGS = 1

; Song list here, separated by comma
MEDIA = sound/ServerBooster/loading.mp3, sound/ServerBooster/loading2.mp3

; Want to apply some client-side settings for more fps?
CLIENT = 1

; Want to remove default hud messages?
HUD = 1
Instalare:
- plasati fisierele in folderul amxmodx
- adaugati in plugins.ini

Code: Select all

amx_settings_api.amxx
ServerBooster.amxx

Re: Server Booster v1.0 (2019)

Posted: 24 Sep 2019, 14:04
by levin
nu ai cum să sporești fps la jucători, să crești eficiența la sv/net/etc...mai ales printr-un plugin
și oricum e slowhack ce ai pus

Re: Server Booster v1.0 (2019)

Posted: 24 Sep 2019, 15:48
by Filiq_
Din cate vad incerci sa setezi fps la sv, cum ai reusit minunatia asta? :)))

Re: Server Booster v1.0 (2019)

Posted: 24 Sep 2019, 16:22
by LondoN eXtream
Filiq_ wrote:
24 Sep 2019, 15:48
Din cate vad incerci sa setezi fps la sv, cum ai reusit minunatia asta? :)))
Alea sunt puse orientativ, atat cat pe partea server-side cat si client side. In functie de modul serverului fiecare isi poate seta anumite cvar-uri pentru un gameplay asa cum ii place lui.
L E V I N wrote:
24 Sep 2019, 14:04
nu ai cum să sporești fps la jucători, să crești eficiența la sv/net/etc...mai ales printr-un plugin
și oricum e slowhack ce ai pus
O sporeste intr-o anumita masura, spre exemplu mesajele hud default ale serverului provoaca lag, mai ales pe un server de zombie full. Nu am zis ca pui pluginul meu si o sa ai 9999 fps.

Code: Select all

CLIENT = 0
si ai rezolvat cu slowhack