04.06.2016, 18:40
Quote:
A feature where command names are dynamically stored with each command having separate index will be useful. Imagine a situation where all commands are supposed to be printed without scanning the whole AMX file.
pawn Код:
|
I suggested permissions above, and it would be great if it was added.
Quote:
Maybe do something like this:
PHP код:
|
pawn Код:
#define CMD_ADMIN (0b00000001)
#define CMD_VIP (0b00000010)
#define CMD_SUPER (0b00000100)
#define CMD_JAIL (0b00001000)
cmd_id:ban(CMD_ADMIN);
cmd:ban(playerid, params[])
{
return 1;
}
cmd_id:warn(CMD_ADMIN);
cmd:warn(playerid, params[])
{
return 1;
}
cmd_id:car(CMD_VIP | CMD_ADMIN);
cmd:car(playerid, params[])
{
return 1;
}
cmd_id:myhouse(CMD_VIP);
cmd:myhouse(playerid, params[])
{
return 1;
}
new bool:pVIP[MAX_PLAYERS], pAdmin[MAX_PLAYERS];
public OnPlayerCommandReceived(playerid, cmdtext[], cmdid)
{
// Don't allow player to use "car" or "myhouse" unless they are VIP
if((cmdid & CMD_VIP) && !pVIP[playerid]) {
return 0;
}
// Don't allow player to use "ban", "warn", or "car" unless they are Admin
if((cmdid & CMD_ADMIN) && !pAdmin[playerid]) {
return 0;
}
return 1;
}