13.09.2018, 14:09
How do I prohibit the player from using commands except admin in PawnCMD?
I tried code like this:
But in that code, all players can still use it. Can you help me?
I tried code like this:
PHP код:
flags:sendtols(CMD_HELPER | CMD_ADMIN);
CMD:sendtols(playerid, params[])
{
new id;
if(sscanf(params,"u", id)) return SCM(playerid, COLOR_WHITE, "USAGE: /sendtols [playerid/PartOfName]");
if(id != INVALID_PLAYER_ID)
{
pInfo[playerid][pInterior] = 0;
SetPlayerInterior(id, 0);
SetPlayerVirtualWorld(id, 0);
SetPlayerPos(id, 1529.6, -1691.2, 13.3);
SCM(id, COLOR_WHITE, " You have been teleported !");
}
else return SCM(playerid, COLOR_WHITE, "Invalid player specified !");
return 1;
}
public OnPlayerCommandReceived(playerid, cmd[], params[], flags)
{
printf("[Pawn.CMD] [%s]: %s %s", GetNameEx(playerid), cmd, params);
if((flags & CMD_ADMIN) && pInfo[playerid][pAdmin] != 5)
{
SCM(playerid, COLOR_WHITE, "You don't have permission to use this command");
return 0;
}
if((flags & CMD_HELPER) && pInfo[playerid][pAdmin] != 3)
{
SCM(playerid, COLOR_WHITE, "You don't have permission to use this command");
return 0;
}
if((flags & CMD_USER) && pInfo[playerid][pAdmin] >= 0)
{
return 1;
}
return 1;
}
public OnPlayerCommandPerformed(playerid, cmd[], params[], result, flags)
{
if(result == -1)
{
SCM(playerid, COLOR_LIGHTGREEN, "ERROR: Command not found! Use /help");
}
return 1;
}