Server Crashed After Using Tempban
#1

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 :-
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) >>> , GetName(playerid), playerid, (GetPlayerColor(giveid) >>> , GetName(giveid), giveid, reason, days, gTotalBans);
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;
}

Thanks In Advance
Reply
#2

Bump! Someone Please Help
Reply
#3

What are those
PHP код:
>>> 
after
PHP код:
GetPlayerColor 
Reply
#4

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
What are those
PHP код:
>>> 
after
PHP код:
GetPlayerColor 
>>> is the logical right shift (bit-shifting)

The crash comes from TimestampToDate function. Read its thread and you will notice more users had the same problem. Some may have posted a solution.

A better advise is to use a plugin which provides more features: https://sampforum.blast.hk/showthread.php?tid=654663
The respective function is TimeFormat to convert timestamp to human-readable form.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)