Not exactly a help request but..
#1

I was wondering how can i make a tempban system .

You type /ban [id] [days] [reason] and he gets banned for the days you've put.
Now when he joins and he's still banned he will see how many days remain . (Not needed but).

Here's my ban cmd:
pawn Код:
CMD:ban(playerid, params[])
{
    if(PlayerInfo[playerid][pAdmin] < 1) return NOACCESS
    new targetid;
    new reason[128];
    if(sscanf(params, "us[128]", targetid, reason)) return SendClientMessage(playerid, -1, "USAGE: /ban [id] [reason]");
    if(!IsPlayerConnected(targetid) || targetid == INVALID_PLAYER_ID) return SendClientMessage(playerid, COLOR_RED, "The player is not connected.");
    new pName[MAX_PLAYER_NAME], targetname[MAX_PLAYER_NAME], day, month, year, hour, minute, second, string[150];
    new string2[300];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    GetPlayerName(playerid,targetname,MAX_PLAYER_NAME);
    getdate(day, month, year);
    gettime(hour, minute, second);
    format(string, sizeof(string), "[{FF0000}BAN{EEEEEE}]Administrator %s has banned %s for %s",pName,targetname,reason);
    SendClientMessageToAll(COLOR_WHITE,string);
    format(string, sizeof(string),"[{FF0000}BAN{EEEEEE}]Administrator %s has banned you for %s",pName,reason);
    SendClientMessage(targetid,COLOR_WHITE,string);
    SendClientMessage(targetid,COLOR_WHITE,"--------------------------------------");
    SendClientMessage(targetid, COLOR_RED, "Ban Information");
    format(string, sizeof(string), "Banned by: %s", pName);
    SendClientMessage(targetid, COLOR_RED, string);
    format(string, sizeof(string), "Banned for: %s", reason);
    SendClientMessage(targetid, COLOR_RED, string);
    format(string, sizeof(string), "Ban date: %d/%d/%d at %d:%d:%d.", day, month, year, hour, minute, second);
    SendClientMessage(targetid, COLOR_RED, string);
    SendClientMessage(targetid, COLOR_WHITE,"Please press the F8 button to take a screenshot to use it on your appeal");
    SendClientMessage(targetid,COLOR_WHITE,"--------------------------------------");
    new IP[22];
    GetPlayerIp(playerid, IP, sizeof(IP));
    PlayerInfo[targetid][pBanned] = 1;
    strcpy(PlayerInfo[playerid][pBannedName],targetname,MAX_PLAYER_NAME);
    strcpy(PlayerInfo[playerid][BannedIP],IP);
    strcpy(PlayerInfo[targetid][pBannedBy], pName, MAX_PLAYER_NAME);
    strcpy(PlayerInfo[targetid][pBannedFor], reason, sizeof (reason));
    format(string2,sizeof(string2), "Administrator %s has banned %s for %s(Date: %d/%d/%d at %d:%d:%d)\n",pName,targetname,reason,day,month,year,hour,minute,second);
    printf(string2);
    new File:log;
    log = fopen("logs/bans.txt", io_append);
    fwrite(log, string2);
    fclose(log);
    SetTimerEx("KickPlayer", 150, false, "i", targetid);
    new cmdstring[44];
    format(cmdstring, sizeof(cmdstring), "banip %s", PlayerInfo[playerid][BannedIP]);
    SendRconCommand(cmdstring);
    return 1;
}
If you can help , i will appriciate it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)