[Plugin] Pawn.CMD

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

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

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");
Reply

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

?
Reply

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!
Reply

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)
Reply

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?
Reply

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

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

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

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
Reply

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

Why this?

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

Thanks Bro

but why?

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

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

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

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

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

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)
Reply

I checked with YSI 4.
Reply


Forum Jump:


Users browsing this thread: 11 Guest(s)