I found this code somewhere a long time ago, I believe Arkshine made it, but it produces an error:
Code:
L 10/14/2010 - 11:33:40: [ORPHEU] Function "Con_Printf" not found
L 10/14/2010 - 11:33:40: [AMXX] Displaying debug trace (plugin "get_stats.amxx")
L 10/14/2010 - 11:33:40: [AMXX] Run time error 10: native error (native "OrpheuGetFunction")
L 10/14/2010 - 11:33:40: [AMXX] [0] get_stats.sma::catch (line 15)
I have orpheu 2.3a
This is the code:
PHP Code:
#include <amxmodx>
#include <orpheu>
new Msg[ 100 ];
public plugin_init()
{
register_plugin("Get stats", "2.4", "Unknown")
register_clcmd("say /srvstats", "catch")
}
public catch()
{
new OrpheuHook:handlePrintf = OrpheuRegisterHook( OrpheuGetFunction( "Con_Printf" ), "Con_Printf" );
server_cmd( "stats" );
server_exec();
OrpheuUnregisterHook( handlePrintf );
const tokensN = 7;
const tokenLen = 19;
static tokens[ tokensN ][ tokenLen + 1 ];
for ( new i = 0; i < tokensN; i++ )
{
trim( Msg );
strtok( Msg, tokens[ i ], tokenLen, Msg, charsmax( Msg ), ' ' );
}
new Float:cpu = str_to_float( tokens[ 0 ] );
new Float:in = str_to_float( tokens[ 1 ] );
new Float:out = str_to_float( tokens[ 2 ] );
new uptime = str_to_num ( tokens[ 3 ] );
new users = str_to_num ( tokens[ 4 ] );
new Float:fps = str_to_float( tokens[ 5 ] );
new players = str_to_num ( tokens[ 6 ] );
server_cmd( "say CPU[%f] IN[%f] OUT[%f] UPTIME[%d] USERS[%d] FPS[%f] PLAYERS[%d]", cpu, in, out, uptime, users, fps, players );
}
public OrpheuHookReturn:Con_Printf( const a[], const message[] )
{
copy( Msg,charsmax( Msg ), message );
return OrpheuSupercede;
}
I know nothing about orpheu ^^
__________________