CMD:tempban(playerid,params[])
{
if(IsPlayerAdmin(playerid) || pInfo[playerid][Admin] >= 1)
{
new id,reason[50],time;
new hourb, minb, secb;
gettime(hourb,minb,secb);
new yearb, monthb, dayb;
getdate(yearb,monthb,dayb);
if(sscanf(params,"us[50]i",id,reason,time)) return SendClientMessage(playerid,-1,"Usage : /tempban (id) (reason) (time)");
pInfo[id][BanTime] = gettime();
pInfo[id][BanDay] = 60*60*24* time;
pInfo[id][Banned] = 1;
new INI:File = INI_Open(UserPath(id));
INI_SetTag(File,"data");
INI_WriteString(File,"BanReason",reason);
INI_WriteString(File,"Banby",GetName(playerid));
INI_Close(File);
new message[128];
format(message, sizeof(message), "[AdmCmd]:{FF6347}%s has been Temporarily Banned from the server. | Reason: %s || Time: %d Day(s)", GetName(id), reason, time);
SendClientMessageToAll(red, message);
SendClientMessage(id,red,"=====================================================");
SendClientMessage(id,red,"{FF6347}You have been Banned from Caribbean Mafia Warz.");
format(message, sizeof(message),"Your Name: %s - Your IP: %s",GetName(playerid), pIP);
SendClientMessage(id,-1,message);
format(message, sizeof(message),"Banned by: %s ", GetName(playerid));
SendClientMessage(id,-1,message);
format(message, sizeof(message),"Banned Reason: %s ", reason);
SendClientMessage(id,-1,message);
format(message, sizeof(message),"Unban in %d Day(s)",time );
SendClientMessage(id,-1,message);
format(message, sizeof(message),"Date: %d/%d/%d || Time: %d:%d:%d",dayb,monthb,yearb,hourb,minb,secb );
SendClientMessage(id,-1,message);
SendClientMessage(id,red,"{FF6347}Visit our forums at: "SERVER_FORUMS" - ScreenShot is required for an appeal.");
SendClientMessage(id,red,"=====================================================");
SendClientMessage(id,red,"{FF6347}Server Administrators has been notified.");
SetTimerEx("BanPlayer",200,false,"ud", id,2);
}
else return ShowMessage(playerid, error, 1);
return 1;
}
/*
I've seen in the past INI_Open crashing the server but in the old version (3.1) of it. For a detailed log about the crash, load crashdetect: https://github.com/Zeex/samp-plugin-...etect/releases
Compile with debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info Next time it will crash, post your server log. On another hand, updating to the latest version of YSI (https://github.com/Misiur/YSI-Includes) is a good idea. |
[22:42:05] [debug] Run time error 4: "Array index out of bounds"
[22:42:05] [debug] Attempted to read/write array element at index 1000 in array of size 1000
[22:42:05] [debug] AMX backtrace:
[22:42:05] [debug] #0 0005ce9c in public Checker () from ODA.amx
[22:40:02] [debug] AMX backtrace:
[22:40:02] [debug] #0 00000038 in public OnPlayerDisconnect () from ODA.amx
[22:40:02] [debug] #1 native Kick () from samp-server.exe
[22:40:02] [debug] #2 000698ac in public BanPlayer (0, 2) from ODA.amx
SetTimerEx("BanPlayer",200,false,"ud", id,2);
for (new i = 0; i <= MAX_PLAYERS; i++)
I can see the mistake now.
Код:
SetTimerEx("BanPlayer",200,false,"ud", id,2); Код:
for (new i = 0; i <= MAX_PLAYERS; i++) PS: You didn't compile with debug info though, that would give the exact line and would be easier to track down. |
for (new i = 0; i <= MAX_PLAYERS; i++)
{
new eveh = GetPlayerVehicleID(i);
if(PlayerTemp[i][isevent] == 1 && eveh != EventCars[i] || PlayerTemp[i][isevent] == 3 && eveh != EventCars[i])// line with the error
{
[debug] AMX backtrace:
[22:27:09] [debug] #0 00000030 in public OnPlayerDisconnect () at <unknown file>:0
[22:27:09] [debug] #1 native Kick () from samp-server.exe
[22:27:09] [debug] #2 00081560 in public KickPlayer (playerid=0) at ./comps/callbacks.pwn:3016
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
public KickPlayer(playerid)
{
Kick(playerid);// this is line 3016
return 1;
}
for (new i = 0; i <= MAX_PLAYERS; i++)
for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++)
There are better alternatives than looping 1000 times. The correct way would be i < MAX_PLAYERS and not i <= MAX_PLAYERS. However, you can replace:
pawn Код:
pawn Код:
--- I assume you pass "u" as format specifier again in SetTimeEx for KickPlayer. Find it/these parts and replace with "d" or "i". |
[01:45:50] [debug] Run time error 6: "Invalid instruction"
[01:45:50] [debug] Unknown opcode 0x1062ebe at address 0x00000039
[01:45:50] [debug] AMX backtrace:
[01:45:50] [debug] #0 00000039 in public OnPlayerDisconnect () at <unknown file>:0
[01:45:50] [debug] #1 native Kick () from samp-server.exe
[01:45:50] [debug] #2 00081580 in public KickPlayer (playerid=0) at ./comps/callbacks.pwn:3016
public KickPlayer(playerid)
{
Kick(playerid);// this is line 3016
return 1;
}
SetTimerEx("KickPlayer",200,false,"d", id,2);
SetTimerEx("KickPlayer",200,false,"d", id);