02.04.2012, 16:56
When I say not working, it's for the hours. It will not add on to the time stamp, basically what happens is that when I /tban 2 hours for the player, it kicks them etc and when they connect back, it says you'll be unbanned on like 5 minutes after.
pawn Код:
CMD:tban(playerid, params[])
{
if(LoggedIn[playerid] == 0) return SendClientMessage(playerid, COLOUR_GREY, "You must be logged in to use this command.");
new reason[128], giveplayerid, string[256],hours1,days;
if(AdminLevel[playerid] < 1) return SendClientMessage(playerid, COLOUR_GREY, "You are not authorized to use this command.");
if(sscanf(params, "uD(0)D(0)s[128]", giveplayerid,hours1,days, reason)) return SendClientMessage(playerid, COLOUR_GREY, "Usage: /tban [player id] [hours] [days] [reason]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, COLOUR_GREY, "That player is not connected.");
if(days < 0 || days > 7) return SendClientMessage(playerid, COLOUR_GREY, "Day's must be between 1 and 10.");
if(hours1 < 0 || hours1 > 23) return SendClientMessage(playerid, COLOUR_GREY, "Hour's must be between 1 and 23.");
if(hours1 >= 1 && days >= 1) return SendClientMessage(playerid, COLOUR_GREY, "You can only select either Hours OR Days - Not both.");
PlayerSQLID[giveplayerid] = MySQL_GetValue(PlayerSQLID[giveplayerid], "id", "accounts");
if(days > 0)
{
BanTime[giveplayerid]= gettime() + 86400 * days;
MySQL_SetInteger(PlayerSQLID[giveplayerid], "BanTime" , BanTime[giveplayerid], "accounts");
format(string, sizeof(string), "Admin %s Banned %s until %s - %d Day(s) [Reason: %s]", GetNameEx(playerid), GetNameEx(giveplayerid),date(BanTime[giveplayerid],4), days, reason);
SendClientMessageToAll(COLOUR_REALRED, string);
format(string,sizeof(string), "You have been {FF0000}BANNED{FFFFFF} from Bone County Roleplay until {FF0000}%s", date(BanTime[giveplayerid],4));
SendClientMessage(giveplayerid, COLOUR_WHITE, string);
format(string, sizeof(string),"Reason: {FF0000}%s", reason);
SendClientMessage(giveplayerid, COLOUR_WHITE, string);
SendClientMessage(giveplayerid, COLOUR_REALRED, "{FFFFFF}PLEASE DO {FF0000}NOT{FFFFFF} POST A {FF0000}BAN APPEAL {FFFFFF}as this is a Temporary Ban.");
}
if(hours1 > 0)
{
BanTime[giveplayerid]= gettime() + 3600 * hours1;
MySQL_SetInteger(PlayerSQLID[giveplayerid], "BanTime" , BanTime[giveplayerid], "accounts");
format(string, sizeof(string), "Admin %s Banned %s for %d Hour(s) [Reason: %s]", GetNameEx(playerid), GetNameEx(giveplayerid), hours1, reason);
SendClientMessageToAll(COLOUR_REALRED, string);
format(string,sizeof(string), "You have been {FF0000}BANNED{FFFFFF} from Bone County Roleplay for {FF0000}%d{FFFFFF} Hours.", hours1);
SendClientMessage(giveplayerid, COLOUR_WHITE, string);
format(string, sizeof(string),"Reason: {FF0000}%s", reason);
SendClientMessage(giveplayerid, COLOUR_WHITE, string);
SendClientMessage(giveplayerid, COLOUR_REALRED, "{FFFFFF}PLEASE DO {FF0000}NOT{FFFFFF} POST A {FF0000}BAN APPEAL {FFFFFF}as this is a Temporary Ban.");
}
MySQL_SetInteger(PlayerSQLID[giveplayerid], "Banned" , 1, "accounts");
Kick(giveplayerid);
return 1;
}