1.0
Informations
♠ You will be able to view how much time a function take.
Header File
Code: Select all
/* Counts by now */
native Execution_Time_Stick( );
/* Returns time counted, float inside string */
/* Do not exceed 128 characters */
/* 16 characters is a good value to use */
native Execution_Time_Return( String[ ], Length );
/* Transforms float inside string in pure float */
stock Float: Execution_Time_Return_Float( String[ ] )
return str_to_float( String );Code: Select all
#include < amxmodx >
#include < execution_time >
new g_String[ 16 ];
public plugin_init( ) {
Execution_Time_Stick( );
for( new i = 0; i < 24000; i++ )
server_print( "1 + 1 = 2" );
Execution_Time_Return( g_String, charsmax( g_String ) );
server_print( "Printing 24,000 lines to server's console took %f seconds!", Execution_Time_Return_Float( g_String ) );
Execution_Time_Stick( );
for( new i = 0; i < 12000; i++ )
server_print( "1 + 1 = 2" );
Execution_Time_Return( g_String, charsmax( g_String ) );
server_print( "Printing 12,000 lines to server's console took %f seconds!", Execution_Time_Return_Float( g_String ) );
} Code: Select all
/*
Input: "0.200000"
Output: "0.2"
*/
Remove_Unused_Zeros( String[ ] ) {
for( new Iterator = strlen( String ) - 1; Iterator >= 2; Iterator-- ) {
if( String[ Iterator ] == '0' ) {
if( String[ Iterator - 1 ] == '.' )
break;
else
String[ Iterator ] = '^0';
}
}
} 