Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- public OnFilterScriptInit()
- {
- SetTimer( "OneSecTimer", 1, true );
- return 1;
- }
- forward OneSecTimer( );
- public OneSecTimer( )
- {
- static
- s_NextSecond = 0,
- s_PreviousTick = 0,
- s_Seconds = 0
- ;
- if ( s_NextSecond == 0 )
- {
- s_NextSecond = GetTickCount( ) + 1000;
- s_PreviousTick = GetTickCount( );
- }
- if ( GetTickCount( ) >= s_NextSecond )
- {
- s_Seconds++;
- printf( "%d - Ticks: %d", s_Seconds, GetTickCount( ) - s_PreviousTick );
- s_PreviousTick = GetTickCount( );
- s_NextSecond = GetTickCount( ) + 1000; // This is better than adding 999 to it each function call.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment