OFCMD:teszt(playerid, params[]){print(\"teszt\");return 1;}
#include a_samp#define OFCMD:%0(%1,%2) \\forward ofcmd%0(%1,%2); \\public ofcmd%0(%1,%2)public OnPlayerCommandText( playerid, cmdtext[ ] ) {new params[ 356 + 1 ], Spaces, i_Space, g_szrCommand[ 192 + 1 ];i_Space = strfind( cmdtext, \" \" );format( g_szrCommand, (192), \"%s\", cmdtext );strdel( g_szrCommand, i_Space, strlen(cmdtext) );format( params, (356), \"%s\", cmdtext );strdel( params, (0), i_Space + 1 ); GetSpaces( params, Spaces ); new xString[ 64 + 1 ]; format( xString, (64), \"ofcmd%s\", g_szrCommand ); if( i_Space == (-1) || Spaces == strlen(params) ) return CallLocalFunction( xString, \"is\", playerid, \" \" );CallLocalFunction( xString, \"is\", playerid, params );return 1;}stock GetSpaces( text[], &output ) { for( new i; i < strlen(text); i++ ) { if( text == \' \' ) { output ++;}}}
#include < a_samp >#include < zcmd >#include < ofcmd >public OnFilterScriptInit( ) {new AT = GetTickCount( );for( new tests; tests < 10000; tests++ ) { ofcmdteszt( 0, \" \" );}new AT2 = GetTickCount( );new ZT = GetTickCount( );for( new tests; tests < 10000; tests++ ) { cmd_teszt( 0, \" \" );}new ZT2 = GetTickCount( );printf( \"OFCMD in %d ms - 10000x\", AT2 - AT );printf( \"ZCMD in %d ms - 10000x\", ZT2 - ZT );return 1;} CMD:teszt( playerid, params[] ) {print( params );return 1;}OFCMD:teszt( playerid, params[] ) {print( params );return 1;}
#include < a_samp >public OnFilterScriptInit( ) {new AT = GetTickCount( );for( new tests; tests < 10000; tests++ ) { teszt1( 0, \" \" );}new AT2 = GetTickCount( );new ZT = GetTickCount( );for( new tests; tests < 10000; tests++ ) { teszt2( 0, \" \" );}new ZT2 = GetTickCount( );printf( \"teszt1 in %d ms - 10000x\", AT2 - AT);printf( \"teszt2 in %d ms - 10000x\", ZT2 - ZT );return 1;} teszt1( playerid, params[] ) {print( params );return 1;}teszt2( playerid, params[] ) {print( params );return 1;}
new params[ 356 + 1 ], Spaces, i_Space, g_szrCommand[ 192 + 1 ];
format( g_szrCommand, (192), \"%s\", cmdtext ); strdel( g_szrCommand, i_Space, strlen(cmdtext) ); format( params, (356), \"%s\", cmdtext ); strdel( params, (0), i_Space + 1 );
#define OFCMD:%0(%1,%2) \\forward OF_%0(%1,%2); \\public OF_%0(%1,%2)forward OF_OPCT( playerid, cmd[] );public OnPlayerCommandText( playerid, cmdtext[] ) {return CallLocalFunction( \"OF_OPCT\", \"is\", playerid, cmdtext );}public OF_OPCT( playerid, cmd[] ) {new params[ 92 + 1 ];new func[ 64 + 1 ];strmid( params, cmd, strfind(cmd, \" \") + 1, strlen(cmd), sizeof(params) );strmid( cmd, cmd, 1, strfind(cmd, \" \"), (128) );format( func, (64), \"OF_%s\", cmd );if( funcidx(func) == (-1) ) return 1;CallLocalFunction( func, \"is\", playerid, params );return 1;}
#include < a_samp >#include < zcmd >#include < ofcmd >public OnFilterScriptInit( ) {new AT = GetTickCount( );for( new tests; tests < 999999; tests++ ) { OF_OPCT( 0, \"/teszt teszt\" );}new AT2 = GetTickCount( );new ZT = GetTickCount( );for( new tests; tests < 999999; tests++ ) { zcmd_OnPlayerCommandText( 0, \"/teszt teszt\" );}new ZT2 = GetTickCount( );printf( \"OFCMD in %d ms - 10000x\", AT2 - AT );printf( \"ZCMD in %d ms - 10000x\", ZT2 - ZT );return 1;}
#include <a_samp>#define DRCMD:%1(%2,%3) \\forward drcmd_%1(%2,%3); \\public drcmd_%1(%2,%3)#define DRCMD_%1(%2,%3) \\DRCMD:%1(%2,%3)#define drcmd(%1,%2,%3) \\DRCMD:%1(%2,%3)#define CMD:%1(%2,%3) \\DRCMD:%1(%2,%3)#define COMMAND:%1(%2,%3) \\DRCMD:%1(%2,%3)//main() { }public OnFilterScriptInit(){ #define MAX_TEST (5)for(new d; d < 10; ++d) print(\" \"); new dcmdtest = GetTickCount(); for(new a; a < MAX_TEST; ++a) OnPlayerDraCommandText(0, \"/drcmd teszt\"); //printf(\"# DRCMD in %d\",GetTickCount() - dcmdtest);print(\"\\n\"); new zcmdtest = GetTickCount(); for(new a; a < MAX_TEST; ++a) OnPlayerCommandZCMDText(0, \"/drcmd teszt\"); print(\"\\n\"); //printf(\"# ZCMD in %d\",GetTickCount() - zcmdtest); new ofcmdtest = GetTickCount(); for(new a; a < MAX_TEST; ++a) OF_OPCT(0, \"/drcmd teszt\"); //printf(\"# OFCMD in %d\", GetTickCount() - ofcmdtest); return true;}forward OnPlayerDraCommandText(playerid, cmdtext[]);public OnPlayerDraCommandText(playerid, cmdtext[]){newfunction[32],szokozmeddig = -1;while(++szokozmeddig < strlen(cmdtext)) if((cmdtext[szokozmeddig] == \' \')) break;strmid(function, cmdtext, 1, szokozmeddig);format(function, sizeof(function), \"drcmd_%s\", function);while(cmdtext[szokozmeddig] == \' \') szokozmeddig++;printf(\"DRCMD FUNCTION: \'%s\'\", function);printf(\"DRCMD PARAMS: \'%s\'\", cmdtext[szokozmeddig]);if(funcidx(function) != -1){if(szokozmeddig == strlen(cmdtext)){ return CallLocalFunction(function, \"is\", playerid, \"\\1\");}return CallLocalFunction(function, \"is\", playerid, cmdtext[szokozmeddig]);}return 0;}staticbool:zcmd_g_HasOPCS = false,bool:zcmd_g_HasOPCE = false;#define MAX_FUNC_NAME (32)forward OnPlayerCommandZCMDText(playerid, cmdtext[]);public OnPlayerCommandZCMDText(playerid, cmdtext[]){ if (zcmd_g_HasOPCS && !CallLocalFunction(\"OnPlayerCommandReceived\", \"is\", playerid, cmdtext)) { return 1; } new pos, funcname[MAX_FUNC_NAME]; while (cmdtext[++pos] > \' \'){funcname[pos-1] = tolower(cmdtext[pos]);}format(funcname, sizeof(funcname), \"cmd_%s\", funcname); while (cmdtext[pos] == \' \') pos++;if (!cmdtext[pos]){if (zcmd_g_HasOPCE){ return CallLocalFunction(\"OnPlayerCommandPerformed\", \"isi\", playerid, cmdtext, CallLocalFunction(funcname, \"is\", playerid, \"\\1\"));}return CallLocalFunction(funcname, \"is\", playerid, \"\\1\");}if (zcmd_g_HasOPCE){return CallLocalFunction(\"OnPlayerCommandPerformed\", \"isi\", playerid, cmdtext, CallLocalFunction(funcname, \"is\", playerid, cmdtext[pos]));}printf(\"ZCMD FUNCTION: \'%s\'\", funcname);printf(\"ZCMD PARAMS: \'%s\'\", cmdtext[pos]);return CallLocalFunction(funcname, \"is\", playerid, cmdtext[pos]);}forward OF_OPCT( playerid, cmd[] );public OF_OPCT( playerid, cmd[] ) {new params[ 92 + 1 ];new func[ 64 + 1 ];strmid( params, cmd, strfind(cmd, \" \") + 1, strlen(cmd), sizeof(params) );strmid( cmd, cmd, 1, strfind(cmd, \" \"), (128) );format( func, (64), \"OF_%s\", cmd );printf(\"OFRCMD FUNCTION: \'%s\'\", func);printf(\"OFRCMD PARAMS: \'%s\'\", params);if( funcidx(func) == (-1) ) return 1;CallLocalFunction( func, \"is\", playerid, params );return 1;}
strmid( cmd, cmd, 1, strfind(cmd, \" \"), (128) );
new func[ 64 + 1 ];---format( func, (64), \"OF_%s\", cmd );if( funcidx(func) == (-1) ) return 1;CallLocalFunction( func, \"is\", playerid, params );
format(cmd, 64, \"OF_%s\", cmd);
#include < a_samp > public OnFilterScriptInit( ) {new AT = GetTickCount( );for( new tests; tests < 10; tests++ ) { OF_OPCT( tests, \"/teszt 1\" );}new AT2 = GetTickCount( );new ZT = GetTickCount( );print( \" \" );for( new tests; tests < 10; tests++ ) { OnPlayerCommandZCMDText( tests, \"/teszt 1\" );}print( \" \" );new ZT2 = GetTickCount( );printf( \"OFCMD in %d ms - 10x\", AT2 - AT );printf( \"ZCMD in %d ms - 10x\", ZT2 - ZT );return 1;}forward OF_OPCT( playerid, cmd[] );public OF_OPCT( playerid, cmd[] ) {new cmd2[ 128 + 1 ];format( cmd2, (128), \"%s\", cmd );new params[ 92 + 1 ];strmid( params, cmd2, strfind(cmd2, \" \") + 1, strlen(cmd2), sizeof(params) );strmid( cmd2, cmd2, 1, strfind(cmd2, \" \"), (128) ); printf( \"OFRCMD FUNC \\\"%s\\\"\\nOFRCMD PARAM \\\"%s\\\"\", cmd2, params ); if( funcidx(cmd2) == (-1) ) return 1;return CallLocalFunction( cmd2, \"is\", playerid, params );}static bool:zcmd_g_HasOPCS = false, bool:zcmd_g_HasOPCE = false;#define MAX_FUNC_NAME (32)forward OnPlayerCommandZCMDText(playerid, cmdtext[]);public OnPlayerCommandZCMDText(playerid, cmdtext[]){ if (zcmd_g_HasOPCS && !CallLocalFunction(\"OnPlayerCommandReceived\", \"is\", playerid, cmdtext)) { return 1; } new pos, funcname[MAX_FUNC_NAME]; while (cmdtext[++pos] > \' \') { funcname[pos-1] = tolower(cmdtext[pos]); } format(funcname, sizeof(funcname), \"cmd_%s\", funcname); while (cmdtext[pos] == \' \') pos++; if (!cmdtext[pos]) { if (zcmd_g_HasOPCE) { return CallLocalFunction(\"OnPlayerCommandPerformed\", \"isi\", playerid, cmdtext, CallLocalFunction(funcname, \"is\", playerid, \"\\1\")); } return CallLocalFunction(funcname, \"is\", playerid, \"\\1\"); } if (zcmd_g_HasOPCE) { return CallLocalFunction(\"OnPlayerCommandPerformed\", \"isi\", playerid, cmdtext, CallLocalFunction(funcname, \"is\", playerid, cmdtext[pos])); } printf(\"ZCMD FUNC: \\\"%s\\\"\", funcname); printf(\"ZCMD PARAM: \\\"%s\\\"\", cmdtext[pos]); return CallLocalFunction(funcname, \"is\", playerid, cmdtext[pos]);}
#define OFCMD:%0(%1,%2) \\forward %0(%1,%2); \\public %0(%1,%2)forward OF_OPCT( playerid, cmd[] );public OnPlayerCommandText( playerid, cmdtext[] ) {CallLocalFunction( \"OF_OPCT\", \"is\", playerid, cmdtext );return 1;}forward OF_OPCT( playerid, cmd[] );public OF_OPCT( playerid, cmd[] ) {new cmd2[ 128 + 1 ];format( cmd2, (128), \"%s\", cmd );new params[ 92 + 1 ];if( strfind( cmd2, \" \" ) == -1 ) return CallLocalFunction( cmd2, \"is\", playerid, \"\\1\" );if( cmd2[ strlen(cmd2) -1 ] == \' \' ) return CallLocalFunction( cmd2, \"is\", playerid, \"\\1\" );strmid( params, cmd2, strfind(cmd2, \" \") + 1, strlen(cmd2), sizeof(params) );strmid( cmd2, cmd2, 1, strfind(cmd2, \" \"), (128) ); printf( \"OFCMD FUNC: \\\"%s\\\"\\nOFCMD PARAM: \\\"%s\\\"\", cmd2, params ); if( funcidx(cmd2) == (-1) ) return 1;return CallLocalFunction( cmd2, \"is\", playerid, params );}
Console input: reloadfs teszt[14:37:10] Filterscript \'teszt.amx\' unloaded.[14:37:10] ----------------------------[14:37:10] [14:37:10] [14:37:10] OFCMD in 24 ms - 10000x[14:37:10] ZCMD in 28 ms - 10000x[14:37:10] OFCMD2 in 19 ms - 10000x[14:37:10] OFCMD3 in 20 ms - 10000x[14:37:10] ----------------------------[14:37:10] [14:37:10] [14:37:10] OFCMD in 21 ms - 10000x[14:37:10] ZCMD in 27 ms - 10000x[14:37:10] OFCMD2 in 20 ms - 10000x[14:37:10] OFCMD3 in 19 ms - 10000x[14:37:10] ----------------------------[14:37:10] [14:37:10] [14:37:10] OFCMD in 22 ms - 10000x[14:37:10] ZCMD in 28 ms - 10000x[14:37:10] OFCMD2 in 18 ms - 10000x[14:37:10] OFCMD3 in 16 ms - 10000x[14:37:10] ----------------------------[14:37:10] [14:37:10] [14:37:10] OFCMD in 21 ms - 10000x[14:37:10] ZCMD in 28 ms - 10000x[14:37:10] OFCMD2 in 19 ms - 10000x[14:37:10] OFCMD3 in 16 ms - 10000x[14:37:10] ----------------------------[14:37:10] [14:37:10] [14:37:10] OFCMD in 20 ms - 10000x[14:37:10] ZCMD in 32 ms - 10000x[14:37:10] OFCMD2 in 20 ms - 10000x[14:37:10] OFCMD3 in 17 ms - 10000x
#include < a_samp > public OnFilterScriptInit( ){for(new i; i<5;i++){ print(\"----------------------------\");new AT = GetTickCount( );for( new tests; tests < 10000; tests++ ) { OF_OPCT( tests, \"/teszt 1\" );}new AT2 = GetTickCount( );new ZT = GetTickCount( );print( \" \" );for( new tests; tests < 10000; tests++ ) { OnPlayerCommandZCMDText( tests, \"/teszt 1\" );}print( \" \" );new ZT2 = GetTickCount( );new AT3 = GetTickCount( );for( new tests; tests < 10000; tests++ ) { OF_OPCT2( tests, \"/teszt 1\" );}new AT4 = GetTickCount( );new AT5 = GetTickCount( );for( new tests; tests < 10000; tests++ ) { OF_OPCT3( tests, \"/teszt 1\" );}new AT6 = GetTickCount( );printf( \"OFCMD in %d ms - 10000x\", AT2 - AT );printf( \"ZCMD in %d ms - 10000x\", ZT2 - ZT );printf( \"OFCMD2 in %d ms - 10000x\", AT4 - AT3 );printf( \"OFCMD3 in %d ms - 10000x\", AT6 - AT5 );}return 1;}forward OF_OPCT( playerid, cmd[] );public OF_OPCT( playerid, cmd[] ) {new cmd2[ 128 + 1 ];format( cmd2, (128), \"%s\", cmd );new params[ 92 + 1 ];strmid( params, cmd2, strfind(cmd2, \" \") + 1, strlen(cmd2), sizeof(params) );strmid( cmd2, cmd2, 1, strfind(cmd2, \" \"), (128) ); //printf( \"OFRCMD FUNC \\\"%s\\\"\\nOFRCMD PARAM \\\"%s\\\"\", cmd2, params );if( funcidx(cmd2) == (-1) ) return 1;return CallLocalFunction( cmd2, \"is\", playerid, params );}forward OF_OPCT2( playerid, cmd[] );public OF_OPCT2( playerid, cmd[] ){new cmd2[128];format( cmd2, (128), \"%s\", cmd );new params[92];strmid( params, cmd2, strfind(cmd2, \" \") + 1, strlen(cmd2), sizeof(params) );cmd2[strfind(cmd2, \" \")] = EOS; //printf( \"OFRCMD2 FUNC \\\"%s\\\"\\nOFRCMD2 PARAM \\\"%s\\\"\", cmd2, params );if( funcidx(cmd2) == (-1) ) return 1;return CallLocalFunction( cmd2, \"is\", playerid, params );}forward OF_OPCT3( playerid, cmd[] );public OF_OPCT3( playerid, cmd[] ){new cmd2[128];strcat(cmd2, cmd);new params[92];strmid( params, cmd2, strfind(cmd2, \" \") + 1, strlen(cmd2), sizeof(params) );cmd2[strfind(cmd2, \" \")] = EOS; //printf( \"OFRCMD3 FUNC \\\"%s\\\"\\nOFRCMD3 PARAM \\\"%s\\\"\", cmd2, params );if( funcidx(cmd2) == (-1) ) return 1;return CallLocalFunction( cmd2, \"is\", playerid, params );}static bool:zcmd_g_HasOPCS = false, bool:zcmd_g_HasOPCE = false;#define MAX_FUNC_NAME (32)forward OnPlayerCommandZCMDText(playerid, cmdtext[]);public OnPlayerCommandZCMDText(playerid, cmdtext[]){ if (zcmd_g_HasOPCS && !CallLocalFunction(\"OnPlayerCommandReceived\", \"is\", playerid, cmdtext)) { return 1; } new pos, funcname[MAX_FUNC_NAME]; while (cmdtext[++pos] > \' \') { funcname[pos-1] = tolower(cmdtext[pos]); } format(funcname, sizeof(funcname), \"cmd_%s\", funcname); while (cmdtext[pos] == \' \') pos++; if (!cmdtext[pos]) { if (zcmd_g_HasOPCE) { return CallLocalFunction(\"OnPlayerCommandPerformed\", \"isi\", playerid, cmdtext, CallLocalFunction(funcname, \"is\", playerid, \"\\1\")); } return CallLocalFunction(funcname, \"is\", playerid, \"\\1\"); } if (zcmd_g_HasOPCE) { return CallLocalFunction(\"OnPlayerCommandPerformed\", \"isi\", playerid, cmdtext, CallLocalFunction(funcname, \"is\", playerid, cmdtext[pos])); } //printf(\"ZCMD FUNC: \\\"%s\\\"\\nZCMD PARAM: \\\"%s\\\"\", funcname, cmdtext[pos]); return CallLocalFunction(funcname, \"is\", playerid, cmdtext[pos]);}
[15:16:58] [15:16:58] OFCMD in 144 ms[15:16:58] ZCMD in 186 ms[15:16:58] [15:16:58] OFCMD in 135 ms[15:16:58] ZCMD in 186 ms[15:16:59] [15:16:59] OFCMD in 133 ms[15:16:59] ZCMD in 188 ms[15:16:59] [15:16:59] OFCMD in 134 ms[15:16:59] ZCMD in 186 ms[15:16:59] [15:16:59] OFCMD in 134 ms[15:16:59] ZCMD in 190 ms[15:17:00] [15:17:00] OFCMD in 133 ms[15:17:00] ZCMD in 186 ms[15:17:00] [15:17:00] OFCMD in 134 ms[15:17:00] ZCMD in 192 ms[15:17:00] [15:17:00] OFCMD in 133 ms[15:17:00] ZCMD in 190 ms[15:17:01] [15:17:01] OFCMD in 132 ms[15:17:01] ZCMD in 189 ms[15:17:01] [15:17:01] OFCMD in 133 ms[15:17:01] ZCMD in 192 ms[15:17:01] [15:17:01] OFCMD in 133 ms[15:17:01] ZCMD in 188 ms[15:17:01] [15:17:02] OFCMD in 135 ms[15:17:02] ZCMD in 189 ms[15:17:02] [15:17:02] OFCMD in 134 ms[15:17:02] ZCMD in 189 ms[15:17:02] [15:17:02] OFCMD in 134 ms[15:17:02] ZCMD in 188 ms[15:17:02] [15:17:03] OFCMD in 133 ms[15:17:03] ZCMD in 189 ms[15:17:03] [15:17:03] OFCMD in 134 ms[15:17:03] ZCMD in 190 ms[15:17:03] [15:17:03] OFCMD in 135 ms[15:17:03] ZCMD in 188 ms[15:17:03] [15:17:04] OFCMD in 134 ms[15:17:04] ZCMD in 187 ms[15:17:04] [15:17:04] OFCMD in 134 ms[15:17:04] ZCMD in 187 ms[15:17:04] [15:17:04] OFCMD in 134 ms[15:17:04] ZCMD in 190 ms[15:17:04] [15:17:05] OFCMD in 131 ms[15:17:05] ZCMD in 184 ms[15:17:05] [15:17:05] OFCMD in 134 ms[15:17:05] ZCMD in 187 ms[15:17:05] [15:17:05] OFCMD in 135 ms[15:17:05] ZCMD in 188 ms[15:17:05] [15:17:06] OFCMD in 134 ms[15:17:06] ZCMD in 187 ms[15:17:06] [15:17:06] OFCMD in 133 ms[15:17:06] ZCMD in 185 ms[15:17:06] [15:17:06] OFCMD in 134 ms[15:17:06] ZCMD in 189 ms[15:17:06] [15:17:07] OFCMD in 134 ms[15:17:07] ZCMD in 188 ms[15:17:07] [15:17:07] OFCMD in 134 ms[15:17:07] ZCMD in 184 ms[15:17:07] [15:17:07] OFCMD in 132 ms[15:17:07] ZCMD in 188 ms[15:17:07] [15:17:08] OFCMD in 132 ms[15:17:08] ZCMD in 185 ms[15:17:08] [15:17:08] OFCMD in 134 ms[15:17:08] ZCMD in 189 ms[15:17:08] [15:17:08] OFCMD in 132 ms[15:17:08] ZCMD in 188 ms[15:17:08] [15:17:08] OFCMD in 132 ms[15:17:08] ZCMD in 188 ms[15:17:09] [15:17:09] OFCMD in 132 ms[15:17:09] ZCMD in 184 ms[15:17:09] [15:17:09] OFCMD in 136 ms[15:17:09] ZCMD in 185 ms[15:17:09] [15:17:09] OFCMD in 135 ms[15:17:09] ZCMD in 189 ms[15:17:10] [15:17:10] OFCMD in 130 ms[15:17:10] ZCMD in 187 ms[15:17:10] [15:17:10] OFCMD in 132 ms[15:17:10] ZCMD in 186 ms[15:17:10] [15:17:10] OFCMD in 135 ms[15:17:10] ZCMD in 187 ms[15:17:11] [15:17:11] OFCMD in 134 ms[15:17:11] ZCMD in 187 ms[15:17:11] [15:17:11] OFCMD in 132 ms[15:17:11] ZCMD in 185 ms[15:17:11] [15:17:11] OFCMD in 133 ms[15:17:11] ZCMD in 188 ms[15:17:12] [15:17:12] OFCMD in 133 ms[15:17:12] ZCMD in 186 ms[15:17:12] [15:17:12] OFCMD in 134 ms[15:17:12] ZCMD in 188 ms[15:17:12] [15:17:12] OFCMD in 134 ms[15:17:12] ZCMD in 186 ms[15:17:12] [15:17:13] OFCMD in 136 ms[15:17:13] ZCMD in 189 ms[15:17:13] [15:17:13] OFCMD in 132 ms[15:17:13] ZCMD in 188 ms[15:17:13] [15:17:13] OFCMD in 133 ms[15:17:13] ZCMD in 187 ms[15:17:13] [15:17:14] OFCMD in 132 ms[15:17:14] ZCMD in 189 ms[15:17:14] [15:17:14] OFCMD in 133 ms[15:17:14] ZCMD in 186 ms[15:17:14] [15:17:14] [15:17:14] Teszt végeredmények: OFCMD(134 MS) | ZCMD(188 MS)[15:17:14]
#include < a_samp >forward OnPlayerOFText( playerid, cmd[] );public OnPlayerOFText( playerid, cmd[] ) {new cmdtext[ 128 + 1 ];format( cmdtext, (128), \"%s\", cmd );strdel( cmdtext, 0, 1 );if( strfind(cmdtext, \" \") == -1 ) {strins( cmdtext, \"of_\", 0, (128) ); if( funcidx(cmdtext) == -1 ) return 1;CallLocalFunction( cmdtext, \"is\", playerid, \'\\1\' );return 1;}new Space = strfind( cmdtext, \" \" );strdel( cmdtext, Space, strlen(cmdtext) );strins( cmdtext, \"of_\", 0, (128) ); if( funcidx(cmdtext) == -1 ) return 1; new params[ 126 + 1 ]; strmid( params, cmdtext, Space + 1, strlen(cmdtext), (126) );CallLocalFunction( cmdtext, \"is\", playerid, params );return 1;}public OnFilterScriptInit( ) {new OFCMD[ 50 ];new ZCMD[ 50 ];for( new i; i < 50; i++ ) {new AT = GetTickCount( );for( new tests; tests < 100000; tests++ ) { OnPlayerOFText( tests, \"/teszt a\" );}new AT2 = GetTickCount( );new ZT = GetTickCount( );print( \" \" );for( new tests; tests < 100000; tests++ ) { OnPlayerCommandZCMDText( tests, \"/teszt a\" );}new ZT2 = GetTickCount( );printf( \" OFCMD in %d ms\", AT2 - AT );printf( \" ZCMD in %d ms\", ZT2 - ZT );OFCMD[ i ] = AT2 - AT; ZCMD[ i ] = ZT2 - ZT;}print( \" \" );print( \" \" );printf( \"Teszt végeredmények: OFCMD(%d MS) | ZCMD(%d MS)\", (OFCMD[0]+OFCMD[1]+OFCMD[2]+OFCMD[3]+OFCMD[4]+OFCMD[5]+OFCMD[6]+OFCMD[7]+OFCMD[8]+OFCMD[9])/10, (ZCMD[0]+ZCMD[1]+ZCMD[2]+ZCMD[3]+ZCMD[4]+ZCMD[5]+ZCMD[6]+ZCMD[7]+ZCMD[8]+ZCMD[9])/10 );print( \" \" );return 1;}static bool:zcmd_g_HasOPCS = false, bool:zcmd_g_HasOPCE = false;#define MAX_FUNC_NAME (32)forward OnPlayerCommandZCMDText(playerid, cmdtext[]);public OnPlayerCommandZCMDText(playerid, cmdtext[]){ if (zcmd_g_HasOPCS && !CallLocalFunction(\"OnPlayerCommandReceived\", \"is\", playerid, cmdtext)) { return 1; } new pos, funcname[MAX_FUNC_NAME]; while (cmdtext[++pos] > \' \') { funcname[pos-1] = tolower(cmdtext[pos]); } format(funcname, sizeof(funcname), \"cmd_%s\", funcname); while (cmdtext[pos] == \' \') pos++; if (!cmdtext[pos]) { if (zcmd_g_HasOPCE) { return CallLocalFunction(\"OnPlayerCommandPerformed\", \"isi\", playerid, cmdtext, CallLocalFunction(funcname, \"is\", playerid, \"\\1\")); } return CallLocalFunction(funcname, \"is\", playerid, \"\\1\"); } if (zcmd_g_HasOPCE) { return CallLocalFunction(\"OnPlayerCommandPerformed\", \"isi\", playerid, cmdtext, CallLocalFunction(funcname, \"is\", playerid, cmdtext[pos])); } return CallLocalFunction(funcname, \"is\", playerid, cmdtext[pos]);}
#define OFCMD:%0(%1,%2) \\forward of_%0(%1,%2); \\public of_%0(%1,%2)forward OnPlayerOFText( playerid, cmd[] );public OnPlayerOFText( playerid, cmd[] ) {new cmdtext[ 128 + 1 ];format( cmdtext, (128), \"%s\", cmd );strdel( cmdtext, 0, 1 );if( strfind(cmdtext, \" \") == -1 ) {strins( cmdtext, \"of_\", 0, (128) ); if( funcidx(cmdtext) == -1 ) return 1;CallLocalFunction( cmdtext, \"is\", playerid, \'\\1\' );return 1;}new Space = strfind( cmdtext, \" \" );strdel( cmdtext, Space, strlen(cmdtext) );strins( cmdtext, \"of_\", 0, (128) ); if( funcidx(cmdtext) == -1 ) return 1; new params[ 126 + 1 ]; strmid( params, cmdtext, Space + 1, strlen(cmdtext), (126) );CallLocalFunction( cmdtext, \"is\", playerid, params );return 1;}