13.12.2016, 19:24
Hello i got issue so when i type command /ban id days reason server shutdown
server-log showing
Command
server-log showing
Код:
sscanf warning: Strings without a length are deprecated, please add a destination size. *** YSI Error: INI_Open could not find or create file /Bans/Test_Player.ini
Код:
CMD:ban(playerid,parmas[]) { if(pInfo[playerid][pAdminLevel] >= 3) { new tid,du,res[150],ppp[50]; if(sscanf(parmas,"uis",tid,du,res) || isnull(parmas))return SendClientMessage(playerid,-1,"{ff0000}Wrong Usage || Correct Usage : /ban id duration(In Days) Reason"); if(!IsPlayerConnected(tid))return SendClientMessage(playerid,-1,"{ff6666}The Player you requested is not connected."); new banmt[300],banma[300],adminname[MAX_PLAYER_NAME],targetn[MAX_PLAYER_NAME]; GetPlayerName(playerid,adminname,sizeof(adminname)); new exp=gettime()+(60*60*24*du); GetPlayerIp(tid,ppp,sizeof(ppp)); new INI:File = INI_Open(UserBanPath(tid)); INI_SetTag(File,"data"); INI_WriteInt(File,"Banexp",exp); INI_WriteInt(File,"BanPerm",0); INI_WriteString(File,"BanAdmin",adminname); INI_WriteString(File,"Reason",res); INI_WriteString(File,"IP",ppp); INI_Close(File); GetPlayerName(tid,targetn,sizeof(targetn)); new INI:iFile = INI_Open(UserIPPath(tid)); INI_SetTag(iFile,"data"); INI_WriteInt(iFile,"Banexp",exp); INI_WriteInt(iFile,"BanPerm",0); INI_WriteString(iFile,"BanPlayer",targetn); INI_WriteString(iFile,"BanAdmin",adminname); INI_WriteString(iFile,"Reason",res); INI_Close(iFile); new File:logg=fopen("BannedPlayers.txt",io_append); fwrite(logg, targetn); fwrite(logg,"\n"); fclose(logg); format(banmt,sizeof(banmt),"{ff0000}Admin %s has banned you for %i days due to %s",adminname,du,res); format(banma,sizeof(banma),"{ff0000}Admin %s has banned %s for %i days due to %s",adminname,targetn,du,res); SendClientMessage(tid,-1,banmt); SendClientMessageToAll(-1,banma); SetTimerEx("KickPlayer",100,false,"i",tid); } else SendClientMessage(playerid,-1,"{ff0000}You are not authorized to use this command."); return 1; }