//
// Plugin name: Welcome Message
// Author: BraXi
// Version: 1.0
// Website: www.braxi.cba.pl
// Description: Displays welcome message for newly connected player
//
// This plugin was designed for Death Run, after some tweaks it may also work with 
// other mods, but please give credits to me if you find this useful in your mod.
//

init( modVersion )
{
	braxi\_dvar::addDvar( "welcome_message2", "welcome_message2", "^1Udvozollek ^1a ^1nexuS ^1deathrun ^1szerveren", "Jo szorakozást", "", "string" );

	if( getDvar( "welcome_player" ) == "" )
		setDvar( "welcome_player", "0" );

	thread playerSpawned();
}

playerSpawned()
{
	while( 1 )
	{
		level waittill( "player_spawn", player );
	
		if( !isDefined( player.pers["welcomemsg"] ) )
		{
			player.pers["welcomemsg"] = true;
			player thread displayMessage();
		}
	}
}

displayMessage()
{
	self endon( "disconnect" );

	number = getDvarInt( "welcome_player" ) + 1;
	setDvar( "welcome_player", number );

	self iPrintlnBold( "^2T^3e ^2V^3agy a^2(^3z^2)^3 " + number + ". ^2L^3átogató" );
	wait 0.5;
	self iPrintlnBold( level.dvar["welcome_message2"] );
}