ban command problem
#1

I got 2 problems with this command. First:



Check "duration of ban" message. Is supposed to show the duration in days of the ban, not the whole time.

Second problem, when i ban someone the command doesn't execute the query to add ban details in the "Bans" table:

pawn Код:
CMD:ban(playerid, params[])
{
    new reason[200], Reason[200], targetid, Days, Query[450], String[200];
    if(PlayerInfo[playerid][Admin] >= 2)
    {
    if(sscanf(params, "uiS[200]", targetid, Days, reason)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/ban (playerid) (days) (reason - optional)");
    {
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED, "Player offline/invalid.");
    {
    if(strlen(reason) > 200) return SendClientMessage(playerid, COLOR_RED, "Type a 'ban reason' within 200 characters.");
    {
    PlayerInfo[targetid][Banned] = 1;
    new aName[24];
    GetPlayerName(playerid,aName,24);
    new pName[24];
    GetPlayerName(targetid,pName,24);
    new CTS = (gettime() + (86400*Days));
    mysql_real_escape_string(reason, Reason);
    new IP[16];
    GetPlayerIp(targetid, IP, sizeof(IP));
    format(Query, sizeof(Query), "INSERT INTO `Bans` (Username, Admin, IP, Reason, Days, Banned, Time) VALUES ('%s', '%s', '%s', '%s', '%d', 1, '%s')", pName, aName, IP, Reason, (CTS+gettime()), InsertTimeStamp());
    mysql_function_query(mysqlc, Query, false, "", "");
   
    format(String, sizeof(String), "[BAN] ** %s (%d) has been banned by %s (%d): %s.", pName, targetid, aName, playerid, Reason);
    SendClientMessageToAll(pink, String);
   
    new echo[200];
    format(echo, sizeof(echo), "0,4[BAN] ** %s (%d) has been banned by %s (%d): %s.",pName, targetid, aName, playerid, Reason);
    IRC_GroupSay(gGroupID, IRC_CHANNEL, echo);
   
    PlayerInfo[playerid][PlayersBanned] ++;
   
    new stats[128];
    format(stats, sizeof(stats), "UPDATE ServerStats SET TotalAdminBans = TotalAdminBans + 1");
    mysql_function_query(mysqlc, stats, false, "", "");
   
    SetPlayerPos(targetid,193.5177,176.2223,1003.0234);
    SetPlayerInterior(targetid,3);
   
    //Ban Message
    new metin[128];
    format(metin, sizeof(metin), "* {FF0000}You have been banned from the server *");
    SCM(targetid, -1, metin);
    format(metin, sizeof(metin), "* Admin: {FF0000}%s (%d)", aName, playerid);
    SCM(targetid, -1, metin);
    format(metin, sizeof(metin), "* Date and Time: {FF0000}%s",InsertTimeStamp());
    SCM(targetid, -1, metin);
    format(metin, sizeof(metin), "* Reason: {FF0000}%s", Reason);
    SCM(targetid, -1, metin);
    format(metin, sizeof(metin), "* Duration of ban: {FF0000}%s Days", (CTS+gettime()));
    SCM(targetid, -1, metin);
    format(metin, sizeof(metin), "* If you have been banned wrongfully, visit our forums http://www.bwhsamp.com and appeal at this ban");
    SCM(targetid, -1, metin);
    SCM(targetid,0xFF0000FF, "* You can screen this ban message (F8) and post it on forum. *");

    BanTimer[targetid] = SetTimerEx("BanPlayer",200,false,"d",targetid);
    //
    }
    }
    }
    }
    return 1;
}
Reply


Messages In This Thread
ban command problem - by Face9000 - 05.02.2014, 10:15
Re: ban command problem - by Konstantinos - 05.02.2014, 10:28
Re: ban command problem - by Face9000 - 05.02.2014, 10:32
Re: ban command problem - by RajatPawar - 05.02.2014, 10:36
Re: ban command problem - by Konstantinos - 05.02.2014, 10:39
Re: ban command problem - by Face9000 - 05.02.2014, 10:48
Re: ban command problem - by CuervO - 05.02.2014, 11:32
Re: ban command problem - by Face9000 - 05.02.2014, 18:04

Forum Jump:


Users browsing this thread: 1 Guest(s)