07.06.2015, 22:10
pawn Код:
// [ DEVELOPMENT GAMEMODE ]
// INCLUDES:
#include <a_samp>
//#include <zcmd>
#include <izcmd>
// DEFINES:
#define MAX_ITERATIONS 1000000
#define COMMANDS_CALLED 3
// MAIN:
main()
{
print("Development Mode: cmd_benchmark.amx");
new tick[2];
tick[0] = GetTickCount();
for(new i = 0; i < MAX_ITERATIONS; i ++)
{
CallLocalFunction("OnPlayerCommandText", "is", INVALID_PLAYER_ID, "/loop");
CallLocalFunction("OnPlayerCommandText", "is", INVALID_PLAYER_ID, "/FORMAT hello");
CallLocalFunction("OnPlayerCommandText", "is", INVALID_PLAYER_ID, "/name 3");
}
tick[1] = GetTickCount();
printf("Benchmark of %d commands: %d", MAX_ITERATIONS * COMMANDS_CALLED, tick[1] - tick[0]);
}
// CALLBACKS:
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
//printf("[OnPlayerCommandPerformed]: CMDTEXT: %s - SUCCESS: %d", cmdtext, success);
return 1;
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
//printf("[OnPlayerCommandReceived]: CMDTEXT: %s", cmdtext);
return 1;
}
// COMMANDS:
CMD:loop(playerid, params[])
{
//printf("/loop %s", params);
return 1;
}
CMD:format(playerid, params[])
{
//printf("/format %s", params);
return 1;
}
CMD:name(playerid, params[])
{
//printf("/name %s", params);
return 1;
}