I'm mad of ZCMD
#1

hey all!

I'm using this ZCMD and failed again.

Here's the code: http://pastebin.com/L2Y9tnqL

I tried things like putting return, replacing else {} with else return, making a new file and define again.
Can't find the problem!

Errors:
Код:
C:\Users\samp03csvr_win32\filterscripts\SCMD.pwn(295) : warning 217: loose indentation
C:\Users\samp03csvr_win32\filterscripts\SCMD.pwn(316) : warning 217: loose indentation
C:\Users\samp03csvr_win32\filterscripts\SCMD.pwn(320) : error 029: invalid expression, assumed zero
C:\Users\samp03csvr_win32\filterscripts\SCMD.pwn(320) : error 017: undefined symbol "cmd_ban"
C:\Users\samp03csvr_win32\filterscripts\SCMD.pwn(320) : error 029: invalid expression, assumed zero
C:\Users\samp03csvr_win32\filterscripts\SCMD.pwn(320) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#2

Use indentation/spacing properly, don't go overboard.

http://pastebin.com/B8dAKfYi
Reply
#3

Oh I didn't know it matters
http://pastebin.com/yJGJKBT0
Now what's the problem with that?
The second what doesn't want to work.
Reply
#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
#5

pawn Код:
CMD:ban(playerid, params[]) {
    new id, r[128];
    if(sscanf(params, "uz", id, r)) {
        if(IsPlayerAdmin(playerid)) {
            if(id != INVALID_PLAYER_ID) {
                new name[MAX_PLAYER_NAME], str[128];
                GetPlayerName(id, name, MAX_PLAYER_NAME);
                format(str, sizeof(str), "An Admin has banned %s. Reason: %s", name, r);
                SendClientMessageToAll(COLOR_LIGHTBLUE, str);
                BanEx(id, r);
            }
            else return SendClientMessage(playerid, COLOR_GREY, "Error: Player not found");
        }
        else return SendClientMessage(playerid, COLOR_BRIGHTRED, "You have no acces to this command");
    }
    else return SendClientMessage(playerid, COLOR_ORANGE, "Syntax Error: /kick [playerid/partofname] [reason (optional)]");
    return 1;
}
Use this... Many errors in your compile
Reply
#6

One more thing: why my command are always saying SERVER: Unknown Command?
I copied and tried all the scripts with ZCMD but it not works..
Reply
#7

Return 1 at the end of your commands.
Reply
#8

I copied your kick command and nothing.. (you had return 1; as I have..)
Reply
#9

Do it out of OnPlayerCommandText, not inside
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    return 0;
}
CMD:ban(playerid, params[])
{
   //Your command here
   return 1;
}
So just copy paste all under OnPlayerCommandText.
Reply
#10

Oh thx it has been solved and I've written /shout (by range,clientmsg) /ashout (by range,gametext) /announce (all,gametext) and now working on /kick and /ban
Thx for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)