Liberty Unleashed

Scripting => Script Releases => Topic started by: Beary on December 22, 2014, 11:36:32 pm

Title: [GUI]Server announcement
Post by: Beary on December 22, 2014, 11:36:32 pm
Only a GUI script that appear when the players enter the server, click [OK] to close, or birth will be closed :)

--------------------------------------------------------------
g_bEnabled <- false;
g_pLocalPlayer <- FindLocalPlayer();

function onScriptLoad()
{
::g_Window <- GUIWindow( VectorScreen( ScreenWidth - ( ScreenWidth / 1.5 ), ScreenHeight - ( ScreenHeight / 1.5 ) ), ScreenSize( 300, 200 ), "announcement" );
::g_Button <- GUIButton( VectorScreen( 125, 170 ), ScreenSize( 50, 25 ), "OK" );
::g_Text <- GUILabel( VectorScreen( 100, 5 ), ScreenSize( 0, 0 ), "" );
::g_Text1 <- GUILabel( VectorScreen( 10, 5 ), ScreenSize( 0, 0 ), "   Christmas carnival!" );
::g_Text2 <- GUILabel( VectorScreen( 10, 35 ), ScreenSize( 0, 0 ), " Happy New Year:)" );
::g_Text3 <- GUILabel( VectorScreen( 10, 55 ), ScreenSize( 0, 0 ), " By:CN-Svr-Admins" );
::g_Text4 <- GUILabel( VectorScreen( 10, 75 ), ScreenSize( 0, 0 ), "" );
::g_Window.Visible = false;
::g_Window.Colour = Colour( 0, 0, 0 );
::g_Window.Alpha = 150;
::g_Button.Colour = Colour( 100, 100, 100 );
::g_Button.Alpha = 180;
::g_Text.TextColour = Colour( 160, 160, 160 );
::g_Text.FontSize = 11;
::g_Text1.TextColour = Colour( 255, 255, 0 );
::g_Text1.FontSize = 20;
::g_Text2.TextColour = Colour( 255, 255, 0 );
::g_Text2.FontSize = 11;
::g_Text3.TextColour = Colour( 255, 255, 0 );
::g_Text3.FontSize = 11;
::g_Text4.TextColour = Colour( 255, 255, 0 );
::g_Text4.FontSize = 11;
::g_bEnabled = true;
CMDS( true );
AddGUILayer( ::g_Window );
::g_Window.AddChild( ::g_Button );
::g_Window.AddChild( ::g_Text );
::g_Window.AddChild( ::g_Text1 );
::g_Window.AddChild( ::g_Text2 );
::g_Window.AddChild( ::g_Text3 );
::g_Window.AddChild( ::g_Text4 );
::g_Button.SetCallbackFunc( "DeleteCommands" );

return 1;
}

function onClientSpawn( pClass )
{

   ::g_bEnabled = false;
CMDS( false );
   return 1;
}

function DeleteCommands()
{
::g_bEnabled = false;
CMDS( false );
}

function CMDS( enabled )
{
if ( enabled )
{
::g_Window.Visible = true;
ShowMouseCursor( true );
ToggleCameraMovement ( false );
g_pLocalPlayer.Frozen = true;
}
else
{
::g_Window.Visible = false;
ShowMouseCursor( false );
ToggleCameraMovement ( true );
g_pLocalPlayer.Frozen = false;
}
}
--------------------------------------------------------------
Maybe you should create a ann.nut and add a <script file= "ann.nut" client= "1" / > in Script.xml