SA-MP Forums Archive
[Plugin] Pawn.CMD - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] Pawn.CMD (/showthread.php?tid=608474)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22


Re: Pawn.CMD - the fastest and most functional command processor - Stanford - 02.06.2016

Great job! I hope that you will keep updating it - and it would be cool if someone posts a benchmark with ZCMD, YCMD and iZCMD and maybe other command processors.


Re: Pawn.CMD - the fastest and most functional command processor - Crayder - 02.06.2016

Quote:
Originally Posted by Stanford
View Post
Great job! I hope that you will keep updating it - and it would be cool if someone posts a benchmark with ZCMD, YCMD and iZCMD and maybe other command processors.
There is no need for any of those benchmarks, any plugin processor like this and MCMD knock out any PAWN processor without doubt by miles.


Re: Pawn.CMD - the fastest and most functional command processor - YourShadow - 02.06.2016

Quote:
Originally Posted by Crayder
View Post
@YourShadow Can you let us have some more features like:
- Not ignoring the return value, so we can hide commands
- Disabling commands for certain players, which would return 0 for them
PHP Code:
public OnPlayerReceivedCommand(playeridcmd[], params[], bool:exists

    if (
playerid ...) // condition
    

        
SendClientMessage(playerid0xFFFFFFFF"This command not available for you"); 
        return 
0// will not call "cmd: ..."
    

    return 
1




Re: Pawn.CMD - the fastest and most functional command processor - Crayder - 02.06.2016

Quote:
Originally Posted by YourShadow
View Post
PHP Code:
public OnPlayerReceivedCommand(playeridcmd[], params[], bool:exists

    if (
playerid ...) // condition
    

        
SendClientMessage(playerid0xFFFFFFFF"This command not available for you"); 
        return 
0// will not call "cmd: ..."
    

    return 
1

That would require very slow code, like strcmp. Using many strcmp cases could make Pawn.CMD slower than any other processor.


Re: Pawn.CMD - the fastest and most functional command processor - YourShadow - 02.06.2016

PHP Code:
cmd:ban(playeridparams[])
{
    if (
pAdmin[playerid] == 0// condition
    
{
        
SendClientMessage(playerid0xFFFFFFFF"This command not available for you");
        return; 
// exit from function
    
}
    
    
// code here




Re: Pawn.CMD - the fastest and most functional command processor - Crayder - 02.06.2016

That would have to be placed in every command I want blocked.

Also, do you realize how slow if statements are? Another thing to slow us down.


Re: Pawn.CMD - the fastest and most functional command processor - YourShadow - 02.06.2016

Quote:
Originally Posted by Crayder
View Post
@YourShadow Can you let us have some more features like:
- Not ignoring the return value, so we can hide commands
- Disabling commands for certain players, which would return 0 for them
Show me an example of how you would like it to see.


Re: Pawn.CMD - the fastest and most functional command processor - Yashas - 02.06.2016

Quote:
Originally Posted by YourShadow
View Post
Show me an example of how you would like it to see.
Its here,
http://forum.sa-mp.com/showthread.ph...95#post3475795

Try to keep the syntax same so that people can easily switch. You are beating other plugin based command processors because you have lesser features.

Other processors have two callbacks. You should have one callback before executing the command and one callback after executing the command.


Re: Pawn.CMD - the fastest and most functional command processor - vannesenn - 02.06.2016

Maybe something like this

Code:
CMD:command(playerid, params[], cmd_id)
. cmd_id is unique command ID(like dialogid for dialogs). And then

Code:
public OnPlayerReceivedCommand(playerid, cmd_id, params[], bool:exists)
{
    switch(cmd_id)
    {
         // CODE GOES HERE
    }

}



Re: Pawn.CMD - the fastest and most functional command processor - Crayder - 02.06.2016

Quote:
Originally Posted by vannesenn
View Post
Maybe something like this

Code:
CMD:command(playerid, params[], cmd_id)
. cmd_id is unique command ID(like dialogid for dialogs). And then

Code:
public OnPlayerReceivedCommand(playerid, cmd_id, params[], bool:exists)
{
    switch(cmd_id)
    {
         // CODE GOES HERE
    }

}
Not a bad idea, but not what I was picturing... But still not a bad idea.

Here's what I had in mind.

- Not ignoring the return value of commands:
Allow commands to return whatever integer the scripter wants. Returning '0' would result in the default actions, the unknown command stuff.
You could also add a new parameter to the callback, a 'result'. The 'result' parameter would hold the value returned by the command.

- Add a function for disabling/enabling specific commands for specific players.
SetPlayerCommandAllowed or something similiar, parameters: (playerid, cmdname[], bool:allow)
Setting 'allow' to false would return '0' if the player used this command, otherwise the command would execute.
Or, you could add yet another parameter to the callback, 'bool:allowed'. You would set this to the value set by the scripter. Then we could easily handle what happens when a player used a command they aren't allowed to use.

pawn Code:
native SetPlayerCommandAllowed(playerid, cmdname[], bool:allow);
forward OnPlayerReceivedCommand(playerid, cmd[], params[], bool:exists, result, bool:allowed);
Doing it this way would keep the speed minimal still, and make the scripters' lives easier.


Re: Pawn.CMD - the fastest and most functional command processor - vannesenn - 02.06.2016

Also, he can do this

Code:
CMD:command(playerid, params[], cmd_id, class_is)
class_id is unique ID for class. Eg. class 0 is class for admin's commands. I don't like that future with enable/diable commands per player. It's future which nobody won't use. If you want that, you can create 2D array(1st dimension is cmd_id, 2nd dimension is playerid).


Re: Pawn.CMD - the fastest and most functional command processor - Lucky13 - 02.06.2016

Wow, awesome release. Definitely gonna use this!


Re: Pawn.CMD - the fastest and most functional command processor - xPhantom - 02.06.2016

Nice to see another command processor. Especially since its beating every other by response time.


Re: Pawn.CMD - the fastest and most functional command processor - YourShadow - 02.06.2016

Maybe do something like this:
PHP Code:
cmd_id:pm(CMD_PM);
cmd:pm(playeridparams[])
{
    return 
1;
}
alias:pm("sms");
public 
OnPlayerCommandReceived(playeridcmdtext[]) // executed before cmd
{
    return 
1;
}
public 
OnPlayerCommandPerformed(playeridcmd[], params[], cmdidresult// executed after cmd
{
    if (
result == -1)
    {
        
SendClientMessage(playerid0xFFFFFFFF"SERVER: Unknown command.");
        return;
    }
    
    if (
cmdid == CMD_PM)
    {
        
//
    
}
    
// else if ...

?


Re: Pawn.CMD - the fastest and most functional command processor - DartfoL - 02.06.2016

very nice, i like this new variant, waiting for the update


Respuesta: Pawn.CMD - the fastest and most functional command processor - Whyd - 02.06.2016

Good job, I hope you have more releases


Re: Pawn.CMD - the fastest and most functional command processor - Crayder - 03.06.2016

Welcome back, thanks dugi.


Re: Pawn.CMD - the fastest and most functional command processor - YourShadow - 03.06.2016

Plugin has been updated to version 2.0.


Re: Pawn.CMD - the fastest and most functional command processor - Crayder - 03.06.2016

The strcmp test isn't really sufficient since the speed depends on the number of commands you have.

Like, say you had 50 commands and you were calling the very last one. You would have executed 50 strcmp's just searching for the command! I think you should make this your test.


Re: Pawn.CMD - the fastest and most functional command processor - YourShadow - 03.06.2016

Testing "OnPlayerCommandText" has been conducted with one hundred "else if (strcmp(...".