Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onScriptLoad()
- {
- TicksStart <- 0;
- TicksStart = GetTickCount();
- }
- function Timing( ticks )
- {
- ticks = floor ( ticks / 1000 );
- local days = floor ( ticks % 604800 / 86400 );
- local hours = floor ( ticks % 86400 / 3600 );
- local mins = floor ( ticks % 3600 / 60 );
- local secs = ticks % 60;
- local weeks = floor ( ( ticks - days*86400 - hours*3600 - mins*60 - secs ) / 604800 );
- local a = [];
- if ( weeks != 0 ) a.append( weeks + " weeks " );
- if ( days != 0 ) a.append( days + " days " );
- if ( hours != 0 ) a.append( hours + " hours " );
- if ( mins != 0 ) a.append( mins + " minutes and " );
- if ( secs != 0 ) a.append( secs + " seconds" );
- return JoinArray( a, " " );
- }
- function JoinArray( array, delimit )
- {
- local a, z = array.len(), output = "";
- if ( z > 0 )
- {
- if ( z > 1 )
- {
- for ( a = 1; a < z; a++ )
- output += delimit + array[ a ];
- return array[ 0 ] + output;
- }
- else return array[ 0 ];
- }
- else return output;
- }
- function onPlayerCommand( player, cmd, text )
- {
- if ( cmd == "uptime" )
- {
- MessagePlayer( "** Uptime " + Timing( floor( GetTickCount() - TicksStart ) ) + "." , player);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement