Command structure for admin... Would this work and be efficient?
#1

Im thinking instead of putting else or deny messages in each command for admins, to do this instead...

Example below will be for rcon admin only, but you should be able to get the idea of what i mean using it for other admins too.

pawn Код:
if(IsPlayerAdmin(playerid))
{
   dcmd(gmx,3,cmdtext);
   dcmd(giveallweapon,13,cmdtext);
}
Im just wondering if by defining my admin commands like this under OnPlayerCommandText, would it work? would it be any more or less efficient than writing a deny or else in each command. And are there any possible drawbacks from using it this way?

Reply
#2

The only bad thing about doing that is you can only have "SERVER: Unknown Command" thrown their way.

Also there are no need for elses in admin checks:

pawn Код:
dcmd_command(playerid, params[])
{
  if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You are not an admin!");
  //do stuff
  return 1;
}
Reply
#3

Yea i had it similar to that with a deny mesage. But i'd rather the players not know the admin commands unless they need to.

I've customised the unknown command message, it just tells them to check /commands


Anyway thanks for your reply.
Reply
#4

I think it should work
Reply
#5

Quote:
Originally Posted by Outbreak
Im just wondering if by defining my admin commands like this under OnPlayerCommandText, would it work? would it be any more or less efficient than writing a deny or else in each command. And are there any possible drawbacks from using it this way?
It's better like that, also saves a lot of lines.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)