Pawn.CMD -
YourShadow - 01.06.2016
Pawn.CMD 3.3.3
Description:
The fastest command processor for SA:MP server.
This plugin is compatible with any SA:MP version despite memory hacking.
Natives:
PHP Code:
native PC_RegAlias(const cmd[], const alias[], ...);
native PC_SetFlags(const cmd[], flags);
native PC_GetFlags(const cmd[]);
native PC_RenameCommand(const cmd[], const newname[]);
native PC_CommandExists(const cmd[]);
native PC_DeleteCommand(const cmd[]);
native CmdArray:PC_GetCommandArray();
native CmdArray:PC_GetAliasArray(const cmd[]);
native PC_GetArraySize(CmdArray:arr);
native PC_GetCommandName(CmdArray:arr, index, dest[], size = sizeof dest);
native PC_FreeArray(&CmdArray:arr);
native PC_EmulateCommand(playerid, const cmdtext[]);
Callbacks:
PHP Code:
forward PC_OnInit();
forward OnPlayerCommandReceived(playerid, cmd[], params[], flags);
forward OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags);
How to install:
Extract archive in server folder. Update your server.cfg.
- Windows
Code:
plugins pawncmd.dll
- Linux
Configuration (pawncmd.cfg in plugins folder)
The values in parentheses are default values- CaseInsensitivity (true)
- LegacyOpctSupport (true)
- LocaleName ("C")
- UseCaching (true)
Example command:
PHP Code:
#include <Pawn.CMD>
cmd:help(playerid, params[]) // you can also use 'CMD' and 'COMMAND' instead of 'cmd'
{
// code here
return 1;
}
Registering aliases:
You can register aliases for a command.
PHP Code:
#include <Pawn.CMD>
cmd:help(playerid, params[])
{
// code here
return 1;
}
alias:help("commands", "cmds")
Using flags:
You can set flags for a command.
PHP Code:
#include <Pawn.CMD>
enum (<<= 1)
{
CMD_ADMIN = 1, // 0b00000000000000000000000000000001
CMD_MODER, // 0b00000000000000000000000000000010
CMD_JR_MODER // 0b00000000000000000000000000000100
};
new pPermissions[MAX_PLAYERS];
flags:ban(CMD_ADMIN)
cmd:ban(playerid, params[])
{
// code here
return 1;
}
alias:ban("block")
flags:kick(CMD_ADMIN | CMD_MODER)
cmd:kick(playerid, params[])
{
// code here
return 1;
}
flags:jail(CMD_ADMIN | CMD_MODER | CMD_JR_MODER)
cmd:jail(playerid, params[])
{
// code here
return 1;
}
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
if (!(flags & pPermissions[playerid]))
{
printf("player %d doesn’t have access to command '%s'", playerid, cmd);
return 0;
}
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if (result == -1)
{
SendClientMessage(playerid, 0xFFFFFFFF, "SERVER: Unknown command.");
return 0;
}
return 1;
}
public PC_OnInit()
{
const testAdminPlayerId = 1, testModerPlayerId = 2, testJrModerPlayerId = 3, testSimplePlayerId = 4;
pPermissions[testAdminPlayerId] = CMD_ADMIN | CMD_MODER | CMD_JR_MODER;
pPermissions[testModerPlayerId] = CMD_MODER | CMD_JR_MODER;
pPermissions[testJrModerPlayerId] = CMD_JR_MODER;
pPermissions[testSimplePlayerId] = 0;
PC_EmulateCommand(testAdminPlayerId, "/ban 4 some reason"); // ok
PC_EmulateCommand(testModerPlayerId, "/ban 8 some reason"); // not ok, moder doesn’t have access to 'ban'
PC_EmulateCommand(testModerPlayerId, "/kick 15 some reason"); // ok
PC_EmulateCommand(testModerPlayerId, "/jail 16 some reason"); // ok, moder can use commands of junior moderator
PC_EmulateCommand(testJrModerPlayerId, "/jail 23 some reason"); // ok
PC_EmulateCommand(testSimplePlayerId, "/ban 42 some reason"); // not ok
}
If you want to use Pawn.CMD in a filterscript, put this define before including:
PHP Code:
#define FILTERSCRIPT
Changelog:
1.0:
- First release
2.0:
- Now plugin is fully compatible with zcmd command style
2.1:
- Fixed bugs
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"
- Parameter "cmdtext" splitted into "cmd" and "params"
- Pawn.CMD is not compatible with zcmd style anymore
3.1:
- Added natives PC_CommandExists, PC_GetCommandArray, PC_GetAliasArray, PC_GetArraySize, PC_FreeArray, PC_GetCommandName
- Added macros PC_HasFlag
- Added public PC_OnInit
- Changed native PC_GetFlags
- Compatibility with YSI
3.1.1:
- Fixed bug in native PC_RenameCommand
3.1.2:
- Fixed bug in scripts queue
3.1.3:
- Fixed error "File or function is not found"
3.1.4:
- Added support for OPCT
3.2.0:
- Increased stability
3.3.0:
- Fixed YSI (y_hooks) incompatibility
- Fixed multibyte strings
-
Semicolons at the end of alias and flags declarations not allowed now
- Added pawncmd.cfg file (More info in README.md)
- Completely rewritten using samp-ptl
3.3.1:
- Fixed Windows issues
3.3.2 (hotfix):
- Fixed UB (server crashing)
3.3.3:
- Fixed "bad conversion" error
- Updated samp-ptl to the latest version
Download binaries:
https://github.com/urShadow/Pawn.CMD/releases
Source code:
https://github.com/urShadow/Pawn.CMD
Re: Pawn.CMD - the fastest and most functional command processor -
povargek - 01.06.2016
consecrated, +rep
Re: Pawn.CMD - the fastest and most functional command processor -
vannesenn - 01.06.2016
Lol, bro, it's not micro, it's mini. 12 ms for ... comands? 100?
Re: Pawn.CMD - the fastest and most functional command processor -
iKevin - 01.06.2016
Cool.
Re: Pawn.CMD - the fastest and most functional command processor -
SickAttack - 01.06.2016
Any benchmark with ZCMD?
Re: Pawn.CMD - the fastest and most functional command processor -
YourShadow - 01.06.2016
Quote:
Originally Posted by SickAttack
Any benchmark with ZCMD?
|
Obvious that Pawn.CMD faster than zcmd, because it works through memory hack.
Re: Pawn.CMD - the fastest and most functional command processor -
vannesenn - 01.06.2016
Micro(μ) is x10 on -6, mili(m) is x10 on -3. That is from SI
Re: Pawn.CMD - the fastest and most functional command processor -
Crystallize - 01.06.2016
how much faster than zcmd?
Re: Pawn.CMD - the fastest and most functional command processor -
vannesenn - 01.06.2016
This looks like a troll. Look at guy's name, lol. Frist post was this topic, really? No way.
Re: Pawn.CMD - the fastest and most functional command processor -
zSuYaNw - 01.06.2016
hoho Niice woork!
Re: Pawn.CMD - the fastest and most functional command processor -
Crystallize - 01.06.2016
Quote:
Originally Posted by vannesenn
This looks like a troll. Look at guy's name, lol. Frist post was this topic, really? No way.
|
You never heard of UrShadow? bro get outta your cave , watch his github.
Re: Pawn.CMD - the fastest and most functional command processor -
Ritzy2K - 01.06.2016
Quote:
Originally Posted by vannesenn
This looks like a troll. Look at guy's name, lol. Frist post was this topic, really? No way.
|
Why the fuck are you spamming this thread all the way?
Re: Pawn.CMD - the fastest and most functional command processor -
Crayder - 01.06.2016
Quote:
Originally Posted by vannesenn
This looks like a troll. Look at guy's name, lol. Frist post was this topic, really? No way.
|
Lol... Dude, you need to get around the community more... urShadow is a pretty big deal. Not for all of the best reasons, but he does some pretty badass things.
And no this is actually not his first post. His last threads were removed because they are not allowed on this forum because of techniques they used (not necessarily bad techniques, in fact some were techniques we use all the time).
(also, speaking of trolling, that's kind of urShadow's thing outside of this forum)
Re: Pawn.CMD - the fastest and most functional command processor - WhiteGhost - 01.06.2016
Faster than izcmd too?
Re: Pawn.CMD - the fastest and most functional command processor -
YourShadow - 01.06.2016
Quote:
Originally Posted by WhiteGhost
Faster than izcmd too?
|
Yes.
Re: Pawn.CMD - the fastest and most functional command processor - WhiteGhost - 01.06.2016
Another thing it work as normal commands right?
PHP Code:
cmd:test(playerid,params[])
{
SCM(playerid,-1,"Test Command Worked.");
return 1;
}
Re: Pawn.CMD - the fastest and most functional command processor -
YourShadow - 01.06.2016
Yes, but the return value will be ignored.
Re: Pawn.CMD - the fastest and most functional command processor -
TwinkiDaBoss - 01.06.2016
Great work. Can you possibly add like "help" parameter in YCMD?
Re: Pawn.CMD - the fastest and most functional command processor -
vannesenn - 01.06.2016
Quote:
Originally Posted by Crayder
Lol... Dude, you need to get around the community more... urShadow is a pretty big deal. Not for all of the best reasons, but he does some pretty badass things.
And no this is actually not his first post. His last threads were removed because they are not allowed on this forum because of techniques they used (not necessarily bad techniques, in fact some were techniques we use all the time).
(also, speaking of trolling, that's kind of urShadow's thing outside of this forum)
|
I don't play SA-MP anymore like before two-three years. I visit this form maybe twice a day, not a lot. I'm more active on ZB SA-MP(SA-MP forum for West Balcan). I don't remember I saw urShadow's topic in plugin forum/bord. Sorry, but his current name looks like big troll
Re: Pawn.CMD - the fastest and most functional command processor -
Crayder - 01.06.2016
Quote:
Originally Posted by vannesenn
I don't play SA-MP anymore like before two-three years. I visit this form maybe twice a day, not a lot. I'm more active on ZB SA-MP(SA-MP forum for West Balcan). I don't remember I saw urShadow's topic in plugin forum/bord. Sorry, but his current name looks like big troll
|
urShadow has been here way longer than "two-three" years... Now off of that subject... :P
@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