Tempban command problem
#2

Dear Logitech90,


If you wanna specify only days for tempbans, then the code could be alot more "slim", compared to what you posted. Though, i never ever tested or even compiled it, i still think, it'd look like the followings:

pawn Код:
CMD:tempban(playerid, params[])
{
    if(pInfo[playerid][Admin] >= 5)
    {
        new id, reason[128], aName[MAX_PLAYER_NAME], pName[MAX_PLAYER_NAME];
        new days, year, month, day, hour, minute;
       
        if(sscanf(params, "uis[250]", id, days, reason)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/tempban <playerid> <days> <reason>");
        if(!IsPlayerConnected(id)) return SendClientMessage(playerid, red, "Invalid player ID.");

        GetPlayerName(playerid, aName, sizeof(aName));
        GetPlayerName(id, pName, sizeof(pName));
        pInfo[id][TempBan] = (gettime() + (86400*days));
        getdate(year, month, day);
        gettime(hour, minute);
       
        new tBans[256], echo[256], banmsg[128];
        format(tBans, sizeof(tBans), "** %s (%d) has been temporarily banned by Admin %s (%d) for %d days | Reason: %s (%02d/%02d/%04d | %02d:%02d)", pName, id, aName, playerid, days, reason, day, month, year, hour, minute);
        format(echo, sizeof(echo), "0,4** %s (%d) has been temporarily banned by Admin %s (%d) for %d days | Reason: %s (%02d/%02d/%04d | %02d:%02d)", pName, id, aName, playerid, days, reason, day, month, year, hour, minute);
        format(banmsg, sizeof(banmsg), "Admin %s (%d) has temp banned you for %d days | Reason: %s", aName, playerid, days, reason);
       
        SendClientMessageToAll(pink, tBans);
        IRC_Say(gGroupID, IRC_CHANNEL, echo);
        IRC_Say(gGroupID, IRC_ACHANNEL, echo);
        SendClientMessage(id, pink, banmsg);
       
        KickTimer[id] = SetTimerEx("KickPlayer", 100, false, "d", id);
    }
    return 1;
}
As you can see, there's no need for any additional extra stocks for it also. Hope, it'll do the desired job for you.


Kind regards,
T101
Reply


Messages In This Thread
Tempban command problem - by Face9000 - 09.04.2013, 20:43
Re: Tempban command problem - by T101 - 10.04.2013, 02:49

Forum Jump:


Users browsing this thread: 1 Guest(s)