Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myTime <- {};
- iTime <- 600; // Valor em segundos...
- function onPlayerJoin( player )
- {
- myTime.rawset( player.ID, time() );
- }
- function onPlayerSpawn( player )
- {
- MessagePlayer( "Calculando iTime = " + TimeCalc( iTime, 0 ), player );
- MessagePlayer( "Voce entrou no server ha " + TimeCalc( myTime[ player.ID ], 1 ), player );
- }
- function TimeCalc( value, type )
- {
- if ( value )
- {
- local a;
- if ( type == 0 ) a = value; // Tempo total. Usado quando o valor já é especificado em segundos...
- else a = time() - value; // Descontando do tempo do servidor. Tempo parcial
- local hours = a / 3600,
- a = a % 3600,
- mins = a / 60,
- a = a % 60,
- secs = a / 1;
- if ( hours >= 1 ) return format( "%02d:%02d:%02d", hours, mins, secs );
- else if ( ( mins >= 1 ) && ( hours < 1 ) ) return format( "%02d:%02d", mins, secs );
- else if ( ( secs >= 1 ) && ( mins < 1 ) ) return "00:" + format( "%02d", secs );
- }
- else return "00:00:00";
- }
Advertisement
Add Comment
Please, Sign In to add comment