/ban /unban
#1

I've been getting some errors while using this system.

pawn Код:
YCMD:ban(playerid, params[], help) {
    new playa;
    if(help) {
        SendClientMessage(playerid, X11_WHITE,"Bans a player");
        return 1;
    }
    new reason[128],msg[128];
    if (!sscanf(params, "us[128]", playa, reason))
    {
        if(!IsPlayerConnectEx(playa)) {
            SendClientMessage(playerid, X11_TOMATO_2 ,"User not found.");
            return 1;
        }
        if((~EAdminFlags:GetPVarInt(playerid, "AdminFlags") & EAdminFlags_CanBanAdmins) && EAdminFlags:GetPVarInt(playa, "AdminLevel") != EAdminFlags_None && playa != playerid) {
            format(msg, sizeof(msg), "%s attempted to ban %s",GetPlayerNameEx(playerid,ENameType_AccountName),GetPlayerNameEx(playa,ENameType_AccountName));
            ABroadcast(X11_TOMATO_2, msg, EAdminFlags_AdminManage);
            return 1;
        }
        format(msg,sizeof(msg),"[AMSG] %s has been banned by %s: %s",GetPlayerNameEx(playa,ENameType_AccountName),GetPlayerNameEx(playerid,ENameType_AccountName),reason);
        SendClientMessageToAll(X11_TOMATO_2,msg);
        BanPlayer(playa, reason, playerid, false);
    } else {
        SendClientMessage(playerid, X11_WHITE, "USAGE: /ban [playerid/name] [reason]");
    }
    return 1;
}
YCMD:unban(playerid, params[], help) {
    if(help) {
        SendClientMessage(playerid, X11_WHITE, "Unbans a player");
        return 1;
    }
    new name[(MAX_PLAYER_NAME*2)+1];
    query[0] = 0;//[256];
    if(!sscanf(params, "s[" #MAX_PLAYER_NAME "]", name)) {
        mysql_real_escape_string(name, name);
        format(query, sizeof(query), "DELETE FROM `bans` WHERE `accountid` = (SELECT `id` FROM `accounts` WHERE `username` = \"%s\")",name);
        mysql_function_query(g_mysql_handle, query, true, "BanDeleteCallback", "dds",playerid, 0, name);//664
    } else {
        SendClientMessage(playerid, X11_WHITE, "USAGE: /unban [accountname]");
    }
    return 1;
}
pawn Код:
(664) : error 001: expected token: ")", but found "-string-"
(664) : warning 215: expression has no effect
(664) : warning 215: expression has no effect
(664) : error 001: expected token: ";", but found ")"
(664) : error 029: invalid expression, assumed zero
(664) : fatal error 107: too many error messages on one line
Reply
#2

Which is line 664?
Reply
#3

FIxed.
Reply
#4

danny how to fixed those errors? i got the same thing like you
Код:
(664) : error 001: expected token: ")", but found "-string-"
(664) : warning 215: expression has no effect
(664) : warning 215: expression has no effect
(664) : error 001: expected token: ";", but found ")"
(664) : error 029: invalid expression, assumed zero
(664) : fatal error 107: too many error messages on one line
Reply
#5

"expected token: ";", but found ")"" means that in the line before (663) at the end of the line, you didn't put ";" simply
and if you put this ";" every errors goes off
Reply
#6

can you show me the code lorizz?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)