Код:
if(strcmp(cmd, "/ban", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pAdmin] >= 1)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /ban [playerid/numejucator] [days - 0 for permanent] [reason]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[128];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "{00FF00}Folosire:{FFFFFF} /ban [playerid/numejucator] [days - 0 for permanent] [reason]");
return 1;
}
if(PlayerInfo[giveplayerid][pAdmin] > 0 && PlayerInfo[playerid][pAdmin] < 6)
{
SendClientMessage(playerid, COLOR_WHITE, "{0066FF}AdmCmd: {FFFFFF}Nu poti bana admini!");
format(string, sizeof(string), "{0066FF}AdmCmd: {FF0000}%s {FFFFFF}a incercat sa il baneze pe {FF0000}%s {FFFFFF}cu motivul: %s", sendername, giveplayer, (result));
ABroadCast(COLOR_LIGHTRED, string, 1);
return 1;
}
if(PlayerInfo[giveplayerid][pAdmin] > 6)
{
SendClientMessage(playerid, COLOR_WHITE, "{0066FF}AdmCmd: {FFFFFF}Nu poti bana Fondatorii!");
format(string, sizeof(string), "{0066FF}AdmCmd: {FF0000}%s {FFFFFF}a incercat sa il baneze pe {FF0000}%s {FFFFFF}cu motivul: %s", sendername, giveplayer, (result));
ABroadCast(COLOR_LIGHTRED, string, 1);
return 1;
}
if(strmatch(giveplayer, "Jimmi")) return SendClientMessage(playerid, COLOR_WHITE, "{0066FF}Ban: {FFFFFF}Fraiere, e server-ul meu.");
new year, month,day;
getdate(year, month, day);
new hour, minute, second;
gettime(hour, minute, second);
format(string, sizeof(string), "Info: %s a primit ban de la %s, motiv: %s (%d-%d-%d)", giveplayer, sendername, (result),month,day,year);
BanLog(string);
format(string, sizeof(string), "{0066FF}Info: %s a primit ban de la %s, motiv: %s", giveplayer, sendername, (result));
SendClientMessageToAll(COLOR_LIGHTRED, string);
PlayerInfo[giveplayerid][pReg] = -999; Update(giveplayerid, pRegisteredx);
new playersip[256];
GetPlayerIp(giveplayerid,playersip,sizeof(playersip));
strmid(PlayerInfo[giveplayerid][pIP], playersip, 0, 100, 255);
Update(giveplayerid, pIPx);
new query[512];
format(query, sizeof(query) ,"INSERT INTO `banslog` (`BanID`,`user_banned`,`user_banned_ip`,`user_banner`,`ban_reason`,`ban_timestamp`,`ban_time`) VALUES ('','%s','%s','%s','%s',CURRENT_TIMESTAMP,'%d')",
giveplayer,
PlayerInfo[giveplayerid][pIP],
sendername,
result,
0);
mysql_query(query);
SendClientMessage(giveplayerid, COLOR_WHITE, "|__________________[BAN]__________________|");
format(string, sizeof(string), "Adminul care te-a banat : {FFFF00}%s",sendername);
SendClientMessage(giveplayerid, COLOR_GREY, string);
format(string, sizeof(string), "Motivul : {FFFF00}%s",(result));
SendClientMessage(giveplayerid, COLOR_GREY, string);
format(string, sizeof(string), "Ban : {FFFF00}Permanent");
SendClientMessage(giveplayerid, COLOR_GREY, string);
format(string, sizeof(string), "Data curenta : {FFFF00}%d-%d-%d",month,day,year);
SendClientMessage(giveplayerid, COLOR_GREY, string);
format(string, sizeof(string), "Data expirarii : {FFFF00}%d-%d-%d",month,day,year,hour, minute, second);
SendClientMessage(giveplayerid, COLOR_GREY, string);
format(string, sizeof(string), "Pentru unban intrati pe forumul nostru: WWW.Forummy.ro");
SendClientMessage(giveplayerid, COLOR_GREY, string);
SendClientMessage(giveplayerid, COLOR_WHITE, "|__________________________________________|");
kicktimer[giveplayerid] = SetTimerEx( "KickS",100, true, "d", giveplayerid );
return 1;
}
}
}
}
return 1;
}
You can use "NOW()" in MySQL and save the timestamp into your database. Learn how to use timestamps (conversion to seconds) and send a query NOW() - UNIXTIMESTAMP(..) > 5184000 (he's banned more than a day)
another thing u can do is using MySQL events system there's a thread about this somewhere on forums!
Once the player connects send a query and the statement I have mentioned above by using NOW() and unixtimestamp.