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 - YourShadow - 18.06.2016

Quote:
Originally Posted by Crayder
View Post
YourShadow, are you going to try out my command ID suggestion from before?

https://sampforum.blast.hk/showthread.php?pid=3711131#pid3711131
Yes, it will be added in the next update.


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

Quote:
Originally Posted by Crayder
View Post
YourShadow, are you going to try out my command ID suggestion from before?

https://sampforum.blast.hk/showthread.php?pid=3711131#pid3711131
Your? Also, I frist wrote idea with ids, so also that's my idea/suggestion, not only yours.


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

Quote:
Originally Posted by Ralfie
View Post
Hi, previously we used to
CallRemoteFunction("OnPlayerCommandText", "is", id, "/forcecmd");
to force any command on a certain player. Is it possible to do that using the plugin now?
cmd_forcecmd(id, "params");


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

Quote:
Originally Posted by vannesenn
View Post
Your? Also, I frist wrote idea with ids, so also that's my idea/suggestion, not only yours.
Lol, your idea? No. The original topic on that in this thread was MY idea on more YCMD-like features, starting here.

And in reply to that, YourShadow suggested this:
Quote:
Originally Posted by YourShadow
View Post
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 - vannesenn - 19.06.2016

Quote:
Originally Posted by Crayder
View Post
Lol, your idea? No. The original topic on that in this thread was MY idea on more YCMD-like features, starting here.

And in reply to that, YourShadow suggested this:
I wrote this, mentioning IDs for commands.

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
    }

}
After my post, you wrote this, but I still don't see where you mentioned IDs

Quote:
Originally Posted by Crayder
View Post
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.
And, after all, you wrote

Quote:
Originally Posted by Crayder
View Post
YourShadow, are you going to try out my command ID suggestion from before?

https://sampforum.blast.hk/showthread.php?pid=3711131#pid3711131
I don't see IDs in your suggestion(s). Can you Quote post where you suggested something with IDs? Thanks!


Re: Pawn.CMD - the fastest and most functional command processor - Spmn - 19.06.2016

Quote:
Originally Posted by Ralfie
View Post
But this cannot be changed as a custom input during runtime. I know that you can call a command as such, but we used to call any with a custom input. For example: http://pastebin.com/raw/K7huGFvb
Where everything passed is handled the same as a typed command...
Code:
CMD:callcommand(playerid, params[])
{
	new public[32], pid, cmd[32], parameters[128];
	if(sscanf(params, "us[32]s[128]", pid, cmd, parameters)) return SendClientMessage(playerid, -1, "* /callcommand [playerid] [command name] [parameters]");

	format(public, sizeof(public), "cmd_%s", cmd);
	CallLocalFunction(public, "is", pid, parameters);
	return 1;
}
eg: /callcommand 0 ban 1

Note that I didn't put a slash in front of command name (ban instead of /ban)


Re: Pawn.CMD - the fastest and most functional command processor - SecretBoss - 22.06.2016

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Yeap.
PHP код:
CMD:returnsettings(playeridparams[]) return cmd_settings(playeridparams); 
Params are not required on (I)ZCMD if you are not using them, are they required for your script?


Re: Pawn.CMD - the fastest and most functional command processor - Luicy. - 22.06.2016

Thanks alot for this, works like a charm.
Reputation waits for you. ;3


Re: Pawn.CMD - the fastest and most functional command processor - Luicy. - 22.06.2016

Something isn't working right for me.
Run time error 19 after including this, tried to remove it and add zcmd, worked fine.
Yes I do have the plugin in the folder & in config.

Edit: fixed by renaming pawn.cmd to pawn_cmd.

Edit2:
Код:
[19:29:06] [Pawn.CMD] command 'attachforall' has been registered
[19:29:06] [Pawn.CMD] command 'attachforme' has been registered
[19:29:06] [Pawn.CMD] command 'online' has been registered
But still don't happen anything when I type any of these commands.


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

Quote:
Originally Posted by Meller
Посмотреть сообщение
Something isn't working right for me.
Run time error 19 after including this, tried to remove it and add zcmd, worked fine.
Yes I do have the plugin in the folder & in config.

Edit: fixed by renaming pawn.cmd to pawn_cmd.

Edit2:
Код:
[19:29:06] [Pawn.CMD] command 'attachforall' has been registered
[19:29:06] [Pawn.CMD] command 'attachforme' has been registered
[19:29:06] [Pawn.CMD] command 'online' has been registered
But still don't happen anything when I type any of these commands.
Show your includes.


Re: Pawn.CMD - the fastest and most functional command processor - SecretBoss - 23.06.2016

Well I run some tests and placing or not params wherever you don't need them won't cause any problem. Correct me if I am wrong


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

Pawn.CMD was updated to version 3.0.

- Added macros "callcmd" to call a command. Example: callcmd::ban(playerid, "42");
- Added natives: PC_SetFlags, PC_GetFlags, PC_EmulateCommand, PC_RenameCommand, PC_DeleteCommand.
- Added macros "isnull" to check command's params.
- Removed call "logprintf" on command's registration.
- "cmdtext" was splitted into "cmd" and "params".
- Pawn.CMD is not compatible with zcmd style anymore.


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

Why this?

Pawn.CMD is not compatible with zcmd style anymore."


Re: Pawn.CMD - the fastest and most functional command processor - Heroes9614 - 23.06.2016

Thanks Bro

but why?

"Pawn.CMD is not compatible with zcmd style anymore."


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

Quote:
Originally Posted by Heroes9614
Посмотреть сообщение
Thanks Bro

but why?

"Pawn.CMD is not compatible with zcmd style anymore."
The callbacks have changed params, everything else is in tact.


Re: Pawn.CMD - the fastest and most functional command processor - Luicy. - 23.06.2016

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Show your includes.
Sorry for late response but here:
PHP код:
#include <a_samp>
#include <easy-mysql>
#include <YSI\y_hooks>
#include <Pawn.CMD> 
and

Код:
plugins pawncmd mysql sscanf streamer
If I remove pawncmd and Pawn.CMD and add ZCMD, it works. But with Pawn.CMD it don't return anything even if it's not a valid command.


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

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Pawn.CMD was updated to version 3.0
Thank you for updating it works well!


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

Quote:
Originally Posted by Meller
Посмотреть сообщение
Sorry for late response but here:
PHP код:
#include <a_samp>
#include <easy-mysql>
#include <YSI\y_hooks>
#include <Pawn.CMD> 
and

Код:
plugins pawncmd mysql sscanf streamer
If I remove pawncmd and Pawn.CMD and add ZCMD, it works. But with Pawn.CMD it don't return anything even if it's not a valid command.
Strange, I checked with YSI, and it worked...


Re: Pawn.CMD - the fastest and most functional command processor - OstGot - 24.06.2016

Quote:
Originally Posted by YourShadow
Посмотреть сообщение
Strange, I checked with YSI, and it worked...
There is YSI 3 and YSI 4 (and they differ from one another)


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

I checked with YSI 4.