[HELP]Why do i get this ? [zcmd]
#1

Hey,

how come i get an error with this ? i don't get this error on my other script so im wondering why and what i have done cos i cant work it out

pawn Код:
CMD:ban(playerid,params[])
{
    new
        pID,
        reason[70]
        ;
    if(PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid,COLOR_YELLOW,"You Must Be An Admin To Use This Command");
    else if(IsPlayerConnected(pID)) SendClientMessage(playerid,COLOR_YELLOW,"This Player Is Not Connected!");
    else if(pID == playerid) = SendClientMessage(playerid,COLOR_YELLOW,"You Cannot Ban Yourself!");
    else if(sscanf(params, "uS(No Reason)[40]", pID, reason)) SendClientMessage(playerid,COLOR_YELLOW, "[USAGE]: /ban playerid reason");
    else
    {
    BanEx(pID,reason);
    Kick(pID);
    PlayerInfo[pID][pBanned] = 1;
    }
    return 1;
}
Reply
#2

What's the error?
Reply
#3

Код:
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(155) : error 029: invalid expression, assumed zero
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(156) : error 029: invalid expression, assumed zero
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(156) : warning 215: expression has no effect
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(156) : error 001: expected token: ";", but found "if"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
sorry for got to include
Reply
#4

Try this
pawn Код:
CMD:ban(playerid, params[])
{
    if(PInfo[playerid][pAdminLevel] < 3) return SendClientMessage(playerid,ORANGE,"You need to be level 3 to use this command!");

    new id,name[MAX_PLAYER_NAME],aname[MAX_PLAYER_NAME];
    if(sscanf(params, "u", id)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /ban <playerid/name>");
    if(!IsPlayerConnected(id)) return SendClientMessage(playerid,GREY,"Invalid ID");

    GetPlayerName(id,name,sizeof(name));
    GetPlayerName(playerid,aname,sizeof(aname));

    new str[80];
    format(str,sizeof(str),"%s has banned %s",aname,name);
    SendClientMessageToAll(ORANGE,str);
    Ban(id);
    return 1;
}
Reply
#5

Код:
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(149) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(149) : warning 215: expression has no effect
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(149) : error 001: expected token: ";", but found "]"
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(149) : error 029: invalid expression, assumed zero
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(149) : fatal error 107: too many error messages on one line

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


4 Errors.
same kind of errors for some reason
Reply
#6

Which is line 149?
Reply
#7

nope still errors -.-
pawn Код:
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(151) : error 028: invalid subscript (not an array or too many subscripts): "pInfo"
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(151) : warning 215: expression has no effect
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(151) : error 001: expected token: ";", but found "]"
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(151) : error 029: invalid expression, assumed zero
C:\Users\Admin\Desktop\SAMP\Midnight Drifts\gamemodes\login.pwn(151) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#8

Which is line 151?
Reply
#9

line 149 is the { and line 151 is the
pawn Код:
if(pInfo[playerid][pAdmin] < 3) return SendClientMessage(playerid,COLOR_YELLOW,"You need to be level 3 to use this command!");
Reply
#10

got the error's sorted it change [pInfo] to [PlayerInfo] Thanks for your help XD
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)