14.01.2016, 19:26
Hey guys, i need help with my ban system.
I made this thanks to some tutorials, and it is ban command for days.
Код:
CMD:timeban(playerid,parmas[]) { if(PlayerInfo[playerid][pAdmin] == 0) return SendClientMessage(playerid, -1, "[ ! ] Nemбte dostateиnб admin prбva !"); else if(PlayerInfo[playerid][pAdmin] == 1) { new tid,du,d,m,y,h,mi,s,bx,ca,res[150]; if(sscanf(parmas,"uis",tid,du,res) || isnull(parmas))return SendClientMessage(playerid,-1,"{ffffff}[ ! ] Pouћitн: /timeban [ ID ] [ POИET HODIN ] [ DЩVOD ]"); if(!IsPlayerConnected(tid))return SendClientMessage(playerid,-1,"{ffffff}[ ! ] Hrби nenн pшipojenэ"); 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(m==12 && bx>31) {y++;} 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; 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_Close(File); GetPlayerName(playerid,adminname,sizeof(adminname)); GetPlayerName(tid,targetn,sizeof(targetn)); format(banma,sizeof(banma),"{ff0000}Administrбtor %s zabanoval hrбиe %s na %d Hodin [ Dщvod: %s ]",adminname,targetn,du,res); format(banmt,sizeof(banmt),"{ffffff}Myslнљ si, ћe ban, kterэ si dostal byl neoprбvnмnэ, nebo chceљ unban? Poћбdej si o nмj na {00FF00}game-force.eu/sub/forum/",adminname,du,res); ShowPlayerDialog(playerid, 49789764, DIALOG_STYLE_MSGBOX, "Ban", banmt, "Ok", ""); SendClientMessageToAll(-1,banma); SetTimerEx("KickPlayer",100,false,"i",tid); } return 1;}