Author Topic: Detecting FPS of a player  (Read 2831 times)

xMerkel

  • Newbie
  • *
  • Posts: 34
  • Karma: +1/-12
  • Cpp
    • View Profile
Detecting FPS of a player
« on: August 26, 2014, 04:03:24 pm »
Client:

Code: [Select]
Local <- FindLocalPlayer ( );

class FPS {

Limit = 30;
Max = 1;
Calculation = 0;
Time = 0;
}

FPS <- FPS ( );

function onScriptLoad ( ) {

FPS.Limit = 255 / FPS.Limit;
FPS.Time = GetTickCount ( ) + 1000;
}

function onClientRender ( ) {

if ( GetTickCount ( ) < FPS.Time ) {

FPS.Calculation = FPS.Calculation + 1;

return;
}

if ( FPS.Calculation > FPS.Max ) {

FPS.Limit = 255 / FPS.Calculation;

FPS.Max = FPS.Calculation;
}

Message ( "[#ffffff]Your FPS: " + FPS.Calculation ); // show FPS

FPS.Calculation = 0;
FPS.Time = GetTickCount ( ) + 1000;
}

 

© Liberty Unleashed Team.