/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


Messages In This Thread
/ban /unban - by dannyk0ed - 30.06.2012, 06:52
Re: /ban /unban - by DBan - 30.06.2012, 07:20
Re: /ban /unban - by dannyk0ed - 30.06.2012, 07:25
Re: /ban /unban - by pln102 - 14.10.2012, 18:48
Re: /ban /unban - by lorizz - 14.10.2012, 20:30
Re: /ban /unban - by pln102 - 15.10.2012, 00:09

Forum Jump:


Users browsing this thread: 1 Guest(s)