Vice City: Multiplayer

Server Development => Scripting and Server Management => Client Scripting => Topic started by: AroliS^ on May 20, 2019, 09:53 PM

Title: Real Time
Post by: AroliS^ on May 20, 2019, 09:53 PM
it is working great!
   
function Script::ScriptProcess()
{     
local time = System.GetDate( System.GetTimestamp( ), 'r' );
::time[ "date" ].Text = time.hour +" : "+ time.min;
}

in somewhere in your clientside's script!
function labelcreator( pos, colour, resizable )
{
local ui = GUILabel( pos, colour, resizable );
return  ui;
}

::time <-
{
date = labelcreator( VectorScreen( sX * 0.671, sY * 0.115 ), Colour( 255, 255, 255 ), true )
}

::timer[ "date" ].FontSize = sX * 0.025;


(https://3.bp.blogspot.com/-ZcE8p26iBfk/XOMfwwzWnmI/AAAAAAAAA20/cwVwbtpz9BoTC_irY523i8nqHtJII-_qQCLcBGAs/s320/unknown.png)

pastebin - https://pastebin.com/YUZPZkxz
Title: Re: Real Time
Post by: dracc on May 21, 2019, 08:01 AM
Well, you run System.GetDate and update the GUILabel on every single processed frame - no wonder it's slow.
Title: Re: Real Time
Post by: . on May 21, 2019, 09:01 PM
Quote from: dracc on May 21, 2019, 08:01 AMWell, you run System.GetDate and update the GUILabel on every single processed frame - no wonder it's slow.

Updating a GUI already happens at every frame.

His problem is that he is changing the font size at every frame. Which means the font atlas must be re-built on every frame. And that will actually kill your performance.

Basically it all boils down to this line:
::timer[ "date" ].FontSize = sX * 0.025;
This is a known issue. Pick a set of fonts and sizes and stick with them. Otherwise use a pre-generated image with the text and scale that.
Title: Re: Real Time
Post by: AroliS^ on May 22, 2019, 01:54 AM
Updated it thank u :)
Title: Re: Real Time
Post by: =RK=MarineForce on May 26, 2019, 11:57 PM
You are genius bro ;X

i don't know when i made my own server with helpless...