Stock function
#1

I made this stock function to check if a player is an admin, so I don't have to keep writing the whole check out every time I make a command:

pawn Код:
stock AdminCheck(playerid, levell)
{
    if(!IsPlayerAdmin(playerid) || pData[playerid][Level] < levell) return SendClientMessage(playerid, ERROR, "Error: {FFFFFF}You do not have permission to use this command!");
    return 1;
}
Then when I make a command I do:
pawn Код:
CMD:setscore(playerid, params[])
{
    new score;
   
    AdminCheck(playerid, 3);
//rest of code
But when I use a command and I'm an admin, it sends the error message but then still continues doing what it's supposed to do. For example if I do /kick, it'll do:
Код:
Error: You do not have permission to use this command!
Usage: /kick [player name/ID] [reason]
in the chat.
Reply


Messages In This Thread
Stock function - by Derexi - 21.08.2014, 14:17
Re: Stock function - by Stinged - 21.08.2014, 14:22
Re: Stock function - by Kyance - 21.08.2014, 14:23
Re: Stock function - by Derexi - 21.08.2014, 14:27
Re: Stock function - by Threshold - 21.08.2014, 14:29
Re: Stock function - by Derexi - 21.08.2014, 14:35

Forum Jump:


Users browsing this thread: 1 Guest(s)