public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/ban", true) == 0)
{
if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "You aren't a RCON Admin.");
new b[256], idx;
b = strtok(cmdtext, idx);
new player = strval(b);
if(!strlen(b)) return SendClientMessage(playerid, 0xFFFFFFFF, "USE: /ban [playerid] [time/hours]");
b = strtok(cmdtext, idx);
new time = strval(b);
if(!strlen(b)) return SendClientMessage(playerid, 0xFFFFFFFF, "USE: /ban [playerid] [time/hours]");
if(!IsPlayerConnected(player) || player == INVALID_PLAYER_ID) return SendClientMessage(playerid, 0xFF0000FF, "Invalid ID.");
if(time < 1) return SendClientMessage(playerid, 0xFF0000FF, "Iime must be greater than 0.");
SendClientMessage(player, 0xFFFF00FF, "You was banned.");
GetPlayerName(player, b, 24);
format(b, 35, "/Bans/%s.txt", b);
if(!fexist(b)) { dini_Create(b); }
dini_IntSet(b, "BanTime", (gettime()+(time*3600)));
Kick(player);
SendClientMessage(playerid, 0xFFFF00FF, "Player banned successfully.");
return 1;
}
return 0;
}
public OnPlayerSpawn(playerid)
{
new str[35];
GetPlayerName(playerid, str, 24);
format(str, 35, "/Bans/%s.txt", str);
if(fexist(str))
{
if(dini_Int(str, "BanTime") < gettime())
{
SendClientMessage(playerid, 0xFF0000FF, "You are still banned.");
Kick(playerid);
}
}
return 1;
}
I fix fox ban now i can ban for hours,but one trouble.How to do that?public OnPlayerConnect(playerid)
{ new pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,sizeof(pName)); format(FB_tbDir,sizeof(FB_tbDir),FB_foxBanFile,pNa me); if(FB_dini_Exists(FB_tbDir)) { if(FB_dini_Int(FB_tbDir,"fbFB_Time")+FB_dini_Int(F B_tbDir,"fbDuration") > FB_Time()) { new string[96]; new sekki=(FB_dini_Int(FB_tbDir,"fbFB_Time")+FB_dini_I nt(FB_tbDir,"fbDuration"))-FB_Time(),minni=sekki/60; sekki=sekki-minni*60; format(string,sizeof(string),"You are timebanned from this server. Remaining time: %d minutes %d seconds",minni,sekki); SendClientMessage(playerid,0xADC7E7FF,string); Kick(playerid); } else { FB_dini_Remove(FB_tbDir); } } return CallLocalFunction("FB_OnPlayerConnect","i",playeri d); } There were remaining time be with hours like that: 01:59:12 is imposible to do that? |