Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ******************************************************
- CREDITS:
- Originally made by LarzI
- Re-written by g_aSlice
- Improved by Alex 'Y_Less' Cole
- ****************************************************** */
- #include <a_samp>
- public OnFilterScriptInit()
- {
- SetTimer( "OneSecTimer", 1, true );
- return 1;
- }
- forward OneSecTimer( );
- public OneSecTimer( )
- {
- static
- s_NextSecond = 0,
- s_PreviousTick = 0,
- s_Seconds = -1 // Updated to reflect removed code.
- ;
- new
- tick = GetTickCount( )
- ;
- // This is just wasted calculations! tick will be larger right from the start.
- /*if ( s_NextSecond == 0 )
- {
- s_NextSecond = tick + 1000;
- s_PreviousTick = tick;
- }*/
- if ( tick >= s_NextSecond )
- {
- ++s_Seconds;
- printf( "%d - Ticks: %d", s_Seconds, tick - s_PreviousTick );
- s_PreviousTick = tick;
- s_NextSecond = tick + 1000; // This is better than adding 999 to it each function call.
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement