I'm mad of ZCMD
#4

pawn Код:
COMMAND:ban(playerid,params[])
   {
                       new id,reason[101],me[MAX_PLAYER_NAME],target[MAX_PLAYER_NAME];
            if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,red,"You are not an admin!");
                if (sscanf(params,"is",id,reason)) return SendClientMessage(playerid, red, "USAGE: /ban [ID]");
                       
                if (id == playerid) return SendClientMessage(playerid,red,"You can't ban yourself!");
                        if (id == INVALID_PLAYER_ID) return SendClientMessage(playerid, red, "Player not found");              
                       if (strlen(reason) < 101) return SendClientMessage(playerid,red,"Your reason must be less than 101 characters!");                       
                       if (IsPlayerAdmin(id))
                        {
                        SendClientMessage(playerid,red,"You can't ban an admin!");
                        new errstring[128], me;
                        GetPlayerName(playerid,me,sizeof(me));
                        format(errstring,sizeof(errstring),"%s has tried to ban you, but failed", me);
                        SendClientMessage(id,red,errstring)
                        return 1;
                        }
                       else
                        {
                new mess[128], me, target;
                        GetPlayerName(playerid,me,sizeof(me));
                        GetPlayerName(id,target,sizeof(target));
            format(mess,sizeof(mess),"Administrator \"%s\" has banned \"%s\". (Reason: %s)",me,target,reason);
            SendClientMessageToAll(red,mess);
            Ban(id);
                        return 1;
                }
    return 1;
   }
Fix the identation as its sucks and i dont get why it doesnt set it as i want..
It should be optimized creating an stock with GetPlayerName, as we use it lot of times, test it now as i cant, as soon as im outta college i will test it myself and optimizate it if you still need some help, i guess this one should work fine if not reply here, and fix the identation or it will give you those warnings.
Reply


Messages In This Thread
I'm mad of ZCMD - by Seven_of_Nine - 12.04.2011, 10:37
Re: I'm mad of ZCMD - by Calgon - 12.04.2011, 10:52
Re: I'm mad of ZCMD - by Seven_of_Nine - 12.04.2011, 11:13
Respuesta: I'm mad of ZCMD - by kirk - 12.04.2011, 11:14
Re: I'm mad of ZCMD - by Rivera - 12.04.2011, 11:41
Re: I'm mad of ZCMD - by Seven_of_Nine - 12.04.2011, 12:04
Re: I'm mad of ZCMD - by Calgon - 12.04.2011, 12:08
Re: I'm mad of ZCMD - by Seven_of_Nine - 12.04.2011, 12:10
Respuesta: I'm mad of ZCMD - by kirk - 12.04.2011, 13:08
Re: I'm mad of ZCMD - by Seven_of_Nine - 12.04.2011, 13:10

Forum Jump:


Users browsing this thread: 2 Guest(s)