This Include: 513 | 10/11/2016 This Include: 522 | 10/11/2016 This Include: 512 | 10/11/2016 This Include: 508 | 10/11/2016 This Include: 513 | 10/11/2016 I-ZCMD: 1,111 | 10/08/2016 I-ZCMD: 1,106 | 10/08/2016 I-ZCMD: 1,105 | 10/08/2016 I-ZCMD: 1,118 | 10/08/2016 I-ZCMD: 1,115 | 10/08/2016
With Callbacks: This Include: 568 | 10/11/2016 This Include: 571 | 10/11/2016 This Include: 571 | 10/11/2016 This Include: 570 | 10/11/2016 This Include: 569 | 10/11/2016 Pawn.CMD: 1,434 | 10/10/2016 Pawn.CMD: 1,443 | 10/10/2016 Pawn.CMD: 1,432 | 10/10/2016 Pawn.CMD: 1,450 | 10/10/2016 Pawn.CMD: 1,449 | 10/10/2016 Without Callbacks: This Include: 533 | 10/11/2016 This Include: 531 | 10/11/2016 This Include: 528 | 10/11/2016 This Include: 533 | 10/11/2016 This Include: 532 | 10/11/2016 Pawn.CMD: 484 | 10/10/2016 Pawn.CMD: 497 | 10/10/2016 Pawn.CMD: 484 | 10/10/2016 Pawn.CMD: 487 | 10/10/2016 Pawn.CMD: 491 | 10/10/2016
With Callbacks: This Include: 659 | 10/10/2016 This Include: 658 | 10/10/2016 This Include: 663 | 10/10/2016 This Include: 661 | 10/10/2016 This Include: 664 | 10/10/2016 Without Callbacks: This Include: 624 | 10/10/2016 This Include: 626 | 10/10/2016 This Include: 623 | 10/10/2016 This Include: 623 | 10/10/2016 This Include: 624 | 10/10/2016
This Include: 613 | 10/10/2016 This Include: 610 | 10/10/2016 This Include: 613 | 10/10/2016 This Include: 617 | 10/10/2016 This Include: 612 | 10/10/2016 This Include: 841 | 10/10/2016 This Include: 848 | 10/10/2016 This Include: 843 | 10/10/2016 This Include: 846 | 10/10/2016 This Include: 850 | 10/10/2016 This Include: 866 | 10/09/2016 This Include: 861 | 10/09/2016 This Include: 864 | 10/09/2016 This Include: 865 | 10/09/2016 This Include: 863 | 10/09/2016 This Include: 882 | 10/08/2016 This Include: 893 | 10/08/2016 This Include: 878 | 10/08/2016 This Include: 883 | 10/08/2016 This Include: 892 | 10/08/2016
// ** MAIN
main()
{
new tick = GetTickCount();
for(new i = 0; i < 50000; i ++)
{
OnPlayerCommandText(0, "/AaaaaaaaaaaaaaaAaaaaaaaaAa6 test");
OnPlayerCommandText(0, "/AaaaaaaaaaaaaaaAaaaaaaaaAa6 test");
OnPlayerCommandText(0, "/AaaaaaaaaaaaaaaAaaaaaaaaAa6 test");
}
printf("%d", GetTickCount() - tick);
}
// ** CALLBACKS
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], success)
{
/*if(success)
{
print("success true");
}
else
{
print("success false");
}*/
return 1;
}
// ** COMMANDS
CMD:aaaaaaaaaaaaaaaaaaaaaaaaaa6(playerid, params[])
{
//printf("%d %s", playerid, params);
return 1;
}
// ** INCLUDES
#include <a_samp>
#include <sscanf2>
#include <command_processor>
// ** MAIN
main()
{
print("Loaded \"command_processor_benchmark.amx\".");
}
// ** CALLBACKS
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
new tick = GetTickCount();
for(new i = 0; i < 50000; i ++)
{
OnPlayerCommandText(playerid, "/AaaaaaaaaaaaAaaaaaaaaAa6 test");
OnPlayerCommandText(playerid, "/AaaaaaaaaaaaAaaaaaaaaAa6 test");
OnPlayerCommandText(playerid, "/AaaaaaaaaaaaAaaaaaaaaAa6 test");
}
printf("%d", GetTickCount() - tick);
return 1;
}
public OnPlayerCommandReceived(playerid, cmd[], params[])
{
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], success)
{
/*if(success)
{
print("success true");
}
else
{
print("success false");
}*/
return 1;
}
// ** COMMANDS
command(aaaaaaaaaaaaaaaaaaaaaaa6, playerid, params[])
{
//printf("%d %s", playerid, params);
return 1;
}
// ** INCLUDES
#include <a_samp>
#include <Pawn.CMD>
// ** MAIN
main()
{
print("Loaded \"command_processor_pawncmd_benchmark.amx\".");
}
// ** CALLBACKS
public OnGameModeInit()
{
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
new tick = GetTickCount();
for(new i = 0; i < 50000; i ++)
{
PC_EmulateCommand(playerid, "/AaaaaaaaaaaaAaaaaaaaaAa6 test");
PC_EmulateCommand(playerid, "/AaaaaaaaaaaaAaaaaaaaaAa6 test");
PC_EmulateCommand(playerid, "/AaaaaaaaaaaaAaaaaaaaaAa6 test");
}
printf("%d", GetTickCount() - tick);
return 1;
}
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
/*if(result)
{
print("result true");
}
else
{
print("result false");
}*/
return 1;
}
// ** COMMANDS
CMD:aaaaaaaaaaaaaaaaaaaaaaa6(playerid, params[])
{
//printf("%d %s", playerid, params);
return 1;
}
forward OnPlayerCommandReceived(playerid, cmd[], params[]); - Please note that cmd does not include the slash "/". forward OnPlayerCommandPerformed(playerid, cmd[], params[], success); - Please note that cmd does not include the slash "/".
- isnull macro will be defined by the include
Why should anyone here download this one? there's no noticeable difference ingame
|
ZCMD: 2,163 ZCMD: 2,147 ZCMD: 2,124 ZCMD: 2,160 ZCMD: 2,156
So the coding syntax for the command remains the same? Like for example I wanted to create a command with the syntax, CMD: or command( etc??
And what's new with this command processor compare to the other command processor (excluding the performance speed)? |
#define CMD:%1(%2) forward cmd_%1(%2); public cmd_%1(%2) #define COMMAND:%1(%2) forward cmd_%1(%2); public cmd_%1(%2)
So the coding syntax for the command remains the same? Like for example I wanted to create a command with the syntax, CMD: or command( etc??
And what's new with this command processor compare to the other command processor (excluding the performance speed)? |
So the coding syntax for the command remains the same? Like for example I wanted to create a command with the syntax, CMD: or command( etc??
And what's new with this command processor compare to the other command processor (excluding the performance speed)? |
I have a question: how can I disable commands, like let's say I don't want players that are not logged in to use any commands. With ZCMD I could do it with OnPlayerCommandReceived, but I just found that this include doesn't have OnPlayerCommandReceived and I can't do it with OnPlayerCommandPerformed.
|
public OnPlayerCommandText(playerid, cmdtext[])
{
#if defined OnPlayerCommandReceived
if (!OnPlayerCommandReceived(playerid, cmdtext)) return 1;
#endif
...
}
public OnPlayerCommandReceived(playerid, cmdtext[])
{
if (!gPlayer_LoggedIn[playerid]) return 0;
return 1;
}
#if defined OnPlayerCommandReceived
forward OnPlayerCommandReceived(playerid, cmdtext[]);
#endif
For now you can add three lines at the top of it:
pawn Код:
pawn Код:
Something last I forgot: pawn Код:
|
This Include: 866 This Include: 861 This Include: 864 This Include: 865 This Include: 863
This Include: 882 This Include: 893 This Include: 878 This Include: 883 This Include: 892
forward OnPlayerCommandPerformed(playerid, cmd[], params[], success); - Please note that cmd does not include the slash "/".
forward OnPlayerCommandReceived(playerid, cmd[], params[]); - Please note that cmd does not include the slash "/".
Doesn't this limit params? The reason why I never used something like this is because of that.
(Unless the text box is actually limited to 156 characters ('/' + 27 + space + 127)) |
I have a question: how can I disable commands, like let's say I don't want players that are not logged in to use any commands. With ZCMD I could do it with OnPlayerCommandReceived, but I just found that this include doesn't have OnPlayerCommandReceived and I can't do it with OnPlayerCommandPerformed.
|
For now you can add three lines at the top of it:
pawn Код:
pawn Код:
Something last I forgot: pawn Код:
|
CommandExist(cmd[]);
Can you add a function to check if a command exists?
ex: PHP код:
btw Good job. |
OnPlayerCommandReceived could help you achieve that, it will be called if a command exists and will yet not perform. Take advantage of the cmd[] argument.
Please note that cmd[] does not include the slash "/". I'm planning on adding a built-in command list, so that function will most like be introduced later on without you having to do anything with OnPlayerCommandReceived. |