08.06.2018, 02:55
I Was Trying To Use Temporary Ban Command Then Suddenly Server Crashed On This Command Can Someone Please Help Me To Fix Any Problem
Code Down Here :-
Thanks In Advance

Quote:
CMD:tempban (playerid, params[]) { new reason[26], giveid, str[150], days, banmsg[400]; if (PlayerInfo[playerid][Admin] < 1) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"You are not authorized to use this command!"); if (sscanf(params, "uis[26]", giveid, days, reason)) return SendClientMessage(playerid, 0x6FFF00FF, "{F07F1D}USAGE: {BBFF00}/tempban <ID> <Days> <Reason>"); if (giveid == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, ""RED"ERROR: "GREY"Invalid player ID!"); new expire=gettime()+(60*60*24*days); new INI:File = INI_Open(UserBanPath(giveid)); INI_WriteInt(File, "BanExpire", expire); INI_WriteInt(File, "BanPerm", 0); INI_WriteString(File, "BanAdmin", GetName(playerid)); INI_WriteString(File, "BanReason", reason); INI_Close(File); gTotalBans++; format(str, sizeof(str), ""STEELBLUE"- AS - Administrator {%06x}%s(%d) "STEELBLUE"has temporarily banned {%06x}%s(%d) "STEELBLUE"for: %s (%i days) [ban %d]", (GetPlayerColor(playerid) >>> ![]() ![]() SendClientMessageToAll(-1, str); new INI:FILE_SERVER_STATS = INI_Open(ServerStats); INI_SetTag(FILE_SERVER_STATS, "Server_Statistics"); INI_WriteInt(FILE_SERVER_STATS, "Total_Bans", gTotalBans); INI_Close(FILE_SERVER_STATS); new d,m,y,h,mi,s; TimestampToDate(expire,y,m,d,h,mi,s,0,0); format(banmsg, sizeof(banmsg), ""REDORANGE"You are banned from the server!\nBan Expire: "GREY"%i/%i/%i [DD/MM/YY] | %i:%i\n"REDORANGE"Admin who banned you: "GREY"%s\n"REDORANGE"Reason: "GREY"%s\n{F2DD3F}Were you banned unfairly or do you want to get unbanned? Make an unban appeal at "GREEN"www.sfstunt.co.nf{F2DD3F}!", d, m, y, h, mi, GetName(playerid), reason); ShowPlayerDialog(giveid, DIALOG_TEMPBAN, DIALOG_STYLE_MSGBOX, ""RED"You are banned!", banmsg, "OK", ""); SetTimerEx("KickPlayer", 500, false, "i", giveid); return 1; } |