23.10.2016, 23:25
Ok i met a guy on a server and we became friends i asked him to make me a temp ban script and he did, but it has a few issues and i cant get in touch with him cause he is attending college, I dont know where he got this from but i even paid him cause it worked at first. But not there is a big issue when i ban a player for 1 day it wont expiry untill the next month, I have been looking around for a good temporay banning tutorial but i cant find any. If anyone know of a good temp ban system tutorial or a filterscript that i can use as a guide or if you have one in your script i can use i would be happy cause this one isnt doing anything good
pawn Код:
CMD:tempban(playerid,parmas[])
{
if(IsPlayerAdmin(playerid))
{
new tid,du,d,m,y,h,mi,s,bx,ca,res[280],ip[16];
if(sscanf(parmas,"uis",tid,du,res) || isnull(parmas))return SendClientMessage(playerid,red," Usage : /tempban [id] [duration(In Days)] [Reason]");
if(!IsPlayerConnected(tid))return SendClientMessage(playerid,red,"The Player you requested is not connected.");
if(du>30)return SendClientMessage(playerid,red,"30 days maximum.");
new banmt[300],banma[300],adminname[MAX_PLAYER_NAME],targetn[MAX_PLAYER_NAME];
getdate(y,m,d);
gettime(h,mi,s);
bx=d+du;
if(bx>30 && m==4 || m==6 || m==9 || m==11)
{ca=bx-30;m++; }
else if(bx>31 && m==1 || m==3 || m==5 || m==7 ||m==8 || m==10 || m==12)
{ca=bx-31;m++;}
else if(m==2 && bx>29 && y%4==0)
{ca=bx-29;m++;}
else if(m==2 && bx>28 && y%4!=0)
{ca=bx-28;m++;}
else ca=bx;
if(m==12 && bx>31)
{y++;}
GetPlayerIp(playerid,ip,16);
new INI:File = INI_Open(UserBanPath(tid));
INI_WriteInt(File,"Banexp",ca);
INI_WriteInt(File,"Banm",m);
INI_WriteInt(File,"Bany",y);
INI_WriteInt(File,"Banhour",h);
INI_WriteInt(File,"Banmin",mi);
INI_WriteString(File,"Reason",res);
INI_WriteString(File,"IP",ip);
INI_Close(File);
GetPlayerName(playerid,adminname,sizeof(adminname));
GetPlayerName(tid,targetn,sizeof(targetn));
format(banmt,sizeof(banmt),"Administrator %s has banned you for %i. day(s) [reason: %s]",adminname,du,res);
format(banma,sizeof(banma),"An Administrator has banned %s for %i day(s) [reason: %s]",targetn,du,res);
SendClientMessage(tid,yellow,banmt);
SendClientMessageToAll(yellow,banma);
SetTimerEx("KickPlayer",100,false,"i",tid);
CommandToAdmins(playerid,"tempban");
}
else SendClientMessage(playerid,red,"You are not authorized to use this command!.");
return 1;
}