[Plugin] Pawn.CMD
#21

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.
Reply
#22

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.
Reply
#23

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

Reply
#24

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.
Reply
#25

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

Reply
#26

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.
Reply
#27

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.
Reply
#28

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.
Reply
#29

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
    }

}
Reply
#30

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.
Reply
#31

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).
Reply
#32

Wow, awesome release. Definitely gonna use this!
Reply
#33

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

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 ...

?
Reply
#35

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

Good job, I hope you have more releases
Reply
#37

Welcome back, thanks dugi.
Reply
#38

Plugin has been updated to version 2.0.
Reply
#39

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.
Reply
#40

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


Forum Jump:


Users browsing this thread: 1 Guest(s)