public DynBan(playerid,days,reason[])
{
new IP[16];
GetPlayerIp(playerid, IP, sizeof(IP));
new Query[200];
new BanTime = days * 86400;
new FinalBanTime = gettime() + BanTime;
format(Query,sizeof(Query),"INSERT INTO `bans` (`username`,`ip`,`reason`,`time`) VALUES ('%s','%s','%s','%i')",PlayerName(playerid),IP,reason,FinalBanTime);
mysql_query(Query);
new String[200];
format(String,sizeof(String),"You have been banned for %i days for %s!",days,reason);
SendClientMessage(playerid,COLOR_RED,String);
Kick(playerid);
return 1;
}
or you could make it so it will send the msg first and then by the time it gives the ban he might get the msg.
|
public DynBan(playerid,days,reason[])
{
new IP[16];
GetPlayerIp(playerid, IP, sizeof(IP));
new Query[200];
new BanTime = days * 86400;
new FinalBanTime = gettime() + BanTime;
format(Query,sizeof(Query),"INSERT INTO `bans` (`username`,`ip`,`reason`,`time`) VALUES ('%s','%s','%s','%i')",PlayerName(playerid),IP,reason,FinalBanTime);
mysql_query(query);
new String[200];
format(String,sizeof(String),"You have been banned for %i days for %s!",days,reason);
SendClientMessage(playerid,COLOR_RED,String);
KickPlayer(playerid);
return 1;
}
stock KickPlayer(playerid)
{
SetPVarInt(playerid, "PlayerKicked", 1);
SetTimerEx("KickTimer", 5, false, "i", playerid);
return 1;
}
forward KickTimer(playerid);
public KickTimer(playerid)
{
Kick(playerid);
return 1;
}