Command structure for admin... Would this work and be efficient? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Command structure for admin... Would this work and be efficient? (
/showthread.php?tid=91332)
Command structure for admin... Would this work and be efficient? -
Outbreak - 14.08.2009
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?
Re: Command structure for admin... Would this work and be efficient? -
Rusty1337 - 14.08.2009
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;
}
Re: Command structure for admin... Would this work and be efficient? -
Outbreak - 14.08.2009
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.
Re: Command structure for admin... Would this work and be efficient? -
Agent_Smith - 14.08.2009
I think it should work
Re: Command structure for admin... Would this work and be efficient? -
Finn - 14.08.2009
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.