Ban Command
#5

Using "u" specifier in /banreason command is imposibble because banned players can't login into the game.
Try this, i already removed GetName() because name variable is a player name already.
And use cache_delete() to remove cache
Код:
CMD:banreason(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] <= 3) return 0;
    new name[24], query[128], string[128], reason[128];
    if(sscanf(params, "s[24]", name)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /banreason [Player Name]");
    format(query, sizeof(query), "SELECT `pReason` FROM `Users` WHERE `Name` = '%s'", name);
    new Cache:cquery;
    cquery = mysql_query(ServerMySQL, query);
    if(cache_num_rows())
    {
        cache_get_field_content(0, "pReason", reason);
        if(!strcmp(reason, "", false, 1))
        {
            format(string,sizeof(string), "[BAN REASON]: %s was banned for: %s", name, reason);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            format(amsg,sizeof(amsg), "[Admin Log]: %s is requesting ban information on %s", GetName(playerid), name);
            // Rest of code here
        }
        else
        {
            SendClientMessage(playerid, COLOR_RED, "Error: That player isn't banned.");
        }
    }
    cache_delete(cquery);
    return 1;
}
Reply


Messages In This Thread
Ban Command - by Tass007 - 24.09.2016, 08:06
Re: Ban Command - by X337 - 24.09.2016, 08:54
Re: Ban Command - by Konstantinos - 24.09.2016, 09:01
Re: Ban Command - by Tass007 - 24.09.2016, 09:23
Re: Ban Command - by X337 - 24.09.2016, 09:28
Re: Ban Command - by Tass007 - 24.09.2016, 09:34
Re: Ban Command - by X337 - 24.09.2016, 09:35
Re: Ban Command - by Tass007 - 24.09.2016, 09:40
Re: Ban Command - by X337 - 24.09.2016, 10:12
Re: Ban Command - by Tass007 - 24.09.2016, 11:00

Forum Jump:


Users browsing this thread: 1 Guest(s)