04.01.2018, 17:05
• Introduction
Hi everyone, I'm bringing a tutorial on how to use the PawnCMD command processor.
to the forum because I see that few members talk about and use.
Although very simple many do not know yet or are afraid to use it.
I use it for some time and I recommend it, very simple to use and in my opinion much faster and more practical.
Pawn.CMD - a new command processor that works through a plugin.
This plugin is compatible with any version of SA: MP.
Its use is very similar to ZCMD, but in the author's tests,
PawnCMD stands out in the comparative speed of response among the other command processors.
See the image:
• Installation
To get started, we must download the updated version of Plugin / Include Download
Add to include in the include folder of Pawno.
Add the plugin in the plugins folder at the root of the server. .dll if it's windowns
.so if it's linux.
Edit "server.cfg" and add pawncmd in line plugins.
• Example of use
Example of use with simple command without use of parameters:
Example of use with parameters. We use sscanf for example:
• Using additional commands
To use additional commands with the same functions we will use alias example:
• Use of constraints on commands
To create a constraint on the commands we can use the callback OnPlayerCommandReceived
See examples:
• No typed command
Use the callback OnPlayerCommandPerformed for the player to receive the no-command message:
• Download & Credits
Download GitHub
Creator of PawnCMD: YourShadow
Hi everyone, I'm bringing a tutorial on how to use the PawnCMD command processor.
to the forum because I see that few members talk about and use.
Although very simple many do not know yet or are afraid to use it.
I use it for some time and I recommend it, very simple to use and in my opinion much faster and more practical.
Pawn.CMD - a new command processor that works through a plugin.
This plugin is compatible with any version of SA: MP.
Its use is very similar to ZCMD, but in the author's tests,
PawnCMD stands out in the comparative speed of response among the other command processors.
See the image:
• Installation
To get started, we must download the updated version of Plugin / Include Download
Код:
Pawn.CMD.inc
Код:
pawncmd.dll
Код:
pawncmd.so
Edit "server.cfg" and add pawncmd in line plugins.
• Example of use
Example of use with simple command without use of parameters:
PHP код:
#include <Pawn.CMD>
CMD:jetpack(playerid, params[]) // simple command to create a jetpack
{
SetPlayerSpecialAction(playerid, 2);
SendClientMessage(playerid, -1, "Jetpack created successfully.");
return 1;
}
CMD:armour(playerid, params[]) // simple command to create a armour
{
SetPlayerArmour(playerid, 100);
SendClientMessage(playerid, -1, "Armour created successfully.");
return 1;
}
Example of use with parameters. We use sscanf for example:
PHP код:
#include <Pawn.CMD>
#include <sscanf2>
CMD:kick(playerid, params[])
{
new ID;
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, -1, "Use /kick [ID]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Error, id invalid.");
SendClientMessage(playerid, -1, "Command performed successfully.");
SendClientMessage(ID, -1, "You have been kicked by an admin.");
SetTimerEx("Kickar", 100, false, "i", ID);
return 1;
}
forward Kickar(playerid);
public Kickar(playerid) return Kick(playerid);
• Using additional commands
To use additional commands with the same functions we will use alias example:
PHP код:
CMD:jetpack(playerid, params[]) // simple command to create a jetpack
{
SetPlayerSpecialAction(playerid, 2);
SendClientMessage(playerid, -1, "Jetpack created successfully.");
return 1;
}
alias:jetpack("createjetpack", "cjet"); // /createrjetpack or /cjet has the same function as /jetpack
• Use of constraints on commands
To create a constraint on the commands we can use the callback OnPlayerCommandReceived
See examples:
PHP код:
#include <Pawn.CMD>
#include <sscanf2>
new CMD_ADMIN = 1;
flags:jetpack(CMD_ADMIN); // Use flags:cmd(CMD_ADMIN) to restrict the command, remember to create the constraint in OnPlayerCommandReceived
flags:kick(CMD_ADMIN);
CMD:jetpack(playerid, params[]) // simple command to create a jetpack
{
SetPlayerSpecialAction(playerid, 2);
SendClientMessage(playerid, -1, "Jetpack created successfully.");
return 1;
}
CMD:kick(playerid, params[])
{
new ID;
if(sscanf(params, "u", ID)) return SendClientMessage(playerid, -1, "Use /kick [ID]");
if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, -1, "Error, id invalid.");
SendClientMessage(playerid, -1, "Command performed successfully.");
SendClientMessage(ID, -1, "You have been kicked by an admin.");
SetTimerEx("Kickar", 100, false, "i", ID);
return 1;
}
PHP код:
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
if((flags & CMD_ADMIN) && Admin[playerid] == 0) // You should change "Admin [playerid]" to the admin variable used in your GM.
{
SendClientMessage(playerid, -1, "Error, Command Restricted to Administrators.");
return 0;
}
return 1;
}
• No typed command
Use the callback OnPlayerCommandPerformed for the player to receive the no-command message:
PHP код:
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if(result == -1)
{
SendClientMessage(playerid, -1, "Error, nonexistent command.");
return 0;
}
return 1;
}
• Download & Credits
Download GitHub
Creator of PawnCMD: YourShadow