Help my server crash
#1

My server crash with this errors:

Quote:

[debug] Run time error 4: "Array index out of bounds"
[debug] Attempted to read/write array element at index 65535 in array of size 500
[debug] AMX backtrace:
[debug] #0 003ad888 in severTimers () at C:\Users\Nico\Desktop\NLRP\gamemodes\CiudadRP.pwn: 60941

and &

debug] #0 00000035 in INI_AddToBuffer (INI:file=52, name[]=@00000031 "", data[]=@02f09608 "-0000001806745041") at <unknown file>:0
[debug] #1 000154d8 in ?? (... <12 arguments>) at C:\Userws\Nico\Desktop\NLRP\pawno\include\YSI\y_in i.inc:1076
[debug] #2 00000035 in public OnDialogResponse () at <unknown file>:0


line:
Quote:

PlayerDrunkTime[i] += 1;

Reply
#2

Check if your index value 'i' is within the range or not equal to INVALID_PLAYER_ID.
Reply
#3

How would that be?

Quote:

stock IDMayor(exceptof = INVALID_PLAYER_ID)
{
new MaxID = 0;
for(new i = 0; i < MAX_PLAYERS; i++) if(IsPlayerConnected(i) && i != exceptof && i > MaxID) MaxID = i;
return MaxID;
}

Quote:

timer severTimers[1200]()

Reply
#4

Quote:
Originally Posted by Nicosm
Посмотреть сообщение
How would that be?
You don't need such a function since it's already provided - https://sampwiki.blast.hk/wiki/GetPlayerPoolSize

But that's not exactly where your array goes out of bounds. Compile with "-d3" flag and show us the exact code.
Reply
#5

Quote:
Originally Posted by Lordzy
Посмотреть сообщение
You don't need such a function since it's already provided - https://sampwiki.blast.hk/wiki/GetPlayerPoolSize

But that's not exactly where your array goes out of bounds. Compile with "-d3" flag and show us the exact code.
As you can see the lines of crash already printed that mean its already in third level debug mod, he only went to wrong function / line.

Try checking the line 60941 and see what's going on around there or simple post serverTimers function here.
Reply
#6

Quote:
Originally Posted by jlalt
Посмотреть сообщение
As you can see the lines of crash already printed that mean its already in third level debug mod, he only went to wrong function / line.

Try checking the line 60941 and see what's going on around there or simple post serverTimers function here.
My bad, thanks for pointing it out. I didn't care to read it all completely.
Reply
#7

Thanks all, this is code

Quote:

timer severTimers2[i]()
{
foreach(Player, i)
{
if(IsPlayerConnected(i) && gPlayerLogged{i} == 1)
{
if(GetPlayerPing(i) > MAX_PING)
{
new string[128];
format(string, sizeof(string), "[AdmWarning]: %s ha sido kikeado por tener %d de ping (maximo: 1500).", GetPlayerNameEx(i), GetPlayerPing(i) );
ABroadCast(COLOR_GENERAL, string, 2);
SendClientMessageEx(i, COLOR_GENERAL, "NLRP: {FFFFFF} {FFFFFF}Has sido expulsado del servidor, tu ping superу el mбximo.");
Kick(i);
}
if(Info[i][pJudgeJailType] != 0 && Info[i][pJudgeJailTime] > 0 && !Info[i][pBeingSentenced]) Info[i][pJudgeJailTime]--;
if(Info[i][pJudgeJailTime] <= 0 && Info[i][pJudgeJailType] != 0) Info[i][pJudgeJailType] = 0;
if(IsaRent[i] > 0)
{
if(RentTime[i] > 0)
{
RentTime[i]--;
}
if(RentTime[i] == 0)
{
RentTime[i] = 0;
if(IsaRent[i] == 1)
{
IsaRent[i] = 0;
new newcar = GetPlayerVehicleID(i);
if(IsARentCar(newcar))
{
SetVehicleToRespawn(HireKey[i]);
TogglePlayerControllable(i, 1);
}
}
}
}
if(CommandSpamUnmute[i] == 0){ CommandSpamTimes[i] = 0;}
if(Info[i][pADTime] != 0){Info[i][pADTime]--;}
if(Info[i][pServiceTime] != 0) { Info[i][pServiceTime]--; }
if(Info[i][pSavedTime] != 0) { Info[i][pSavedTime]--; }
if(NewbieTimer[i] > 0) { NewbieTimer[i]--; }
if(VIPTimer[i] > 0){ VIPTimer[i]--; }
if(Info[i][pDPTime] != -1){
Info[i][pDPTime]--;
if(Info[i][pDPTime] == 0){
Info[i][pDPHours] = 0;
Info[i][pRHours] = 0;
Info[i][pDPTime] = -1;
Info[i][pPTR] +=1;
SendClientMessageEx(i, COLOR_GREEN,"* Se terminу tu tiempo, no pudiste mantener el beneficio de Usuario Dedicado, intentalo de nuevo!");
}
}
if(GetPlayerCash(i) != GetPlayerMoney(i))
{
ResetMoneyBar(i);
UpdateMoneyBar(i,GetPVarInt(i, "Cash"));
}
if(Info[i][pTriageTime] != 0)
{
Info[i][pTriageTime]--;
}
if(Info[i][pTempVIP] >= 1)
{
Info[i][pTempVIP]--;
}
if(Info[i][pTempVIP] <= 0 && Info[i][pBuddyInvited] == 1)
{
Info[i][pTempVIP] = 0;
Info[i][pBuddyInvited] = 0;
Info[i][pVIP] = 0;
SendClientMessageEx(i, COLOR_VIP, "INFO: {FFFFFF}Tu VIP Temporal ha expirado.");
SetPlayerToTeamColor(i);
}
if(Info[i][pRMuted] > 1)
{
if(Info[i][pRMutedTime] > 0)
{
Info[i][pRMutedTime]--;
}
else
{
Info[i][pRMuted] = 0;
}
}
if(Info[i][pJailed] > 0)
{
if(Info[i][pJailTime] > 0)
{
Info[i][pJailTime]--;
new text[128];
switch(Info[i][pJailed])
{
case 1, 4: format(text, sizeof(text), "~n~~n~~n~~n~~n~~n~~n~ ~r~Jail OOC!~n~~w~%d segundos (%i minutos) restantes", Info[i][pJailTime], Info[i][pJailTime]/60);
}
GameTextForPlayer(i, text, 2000, 3);
}
if(Info[i][pJailTime] <= 0)
{
Info[i][pJailTime] = 0;
switch(Info[i][pJailed])
{
case 2:{
SetPosEx(i,938.0041,-1467.7502,13.3365,0,0,0);
Info[i][pWantedLevel] = 0;
SetPlayerWantedLevel(i, Info[i][pWantedLevel]);
}
case 3:{
SetPlayerInterior(i, 0);
Info[i][pInt] = 0;
SetPlayerVirtualWorld(i, 0);
Info[i][pVW] = 0;
SetPlayerPos(i,343.1081,-1521.4404,33.2985);
}
case 1,4:{
SetPlayerInterior(i, 0);
Info[i][pInt] = 0;
SetPosEx(i,1552.8286,-1674.9845,16.1953,0,0,0);
}
case 5:{
SetPlayerInterior(i, 0);
Info[i][pInt] = 0;
SetPlayerVirtualWorld(i, 0);
Info[i][pVW] = 0;
SetPlayerPos(i,130.0132,1945.5618,19.3507);
}
case 6:{
SetPlayerInterior(i, 0);
Info[i][pInt] = 0;
SetPlayerVirtualWorld(i, 0);
Info[i][pVW] = 0;
SetPlayerPos(i,725.8815,-1438.3231,13.5391);
}
case 1000:{
SetPlayerInterior(i, 0);
Info[i][pInt] = 0;
SetPosEx(i,1552.8286,-1674.9845,16.1953,0,0,0);
}
}
Info[i][pJailed] = 0;
PhoneOnline[i] = 0;
SendClientMessageEx(i, COLOR_GREEN,"Has pagado tu condena.");
GameTextForPlayer(i, "~g~Eres Libre~n~~w~Se mejor persona.", 5000, 1);
SetPlayerSkin(i, Info[i][pChar]);
SetPlayerToTeamColor(i);
}
}
if(Info[i][pWantedLevel] > 0)
{
SetPlayerWantedLevel(i, Info[i][pWantedLevel]);
}
if(UsedFind[i] >= 1){
UsedFind[i] -= 1;
}
if(JustReported[i] > 0){
JustReported[i]--;
}
if(JustDuda[i] > 0){
JustDuda[i]--;
}
if(JustAfk[i] > 0){
JustAfk[i]--;
}
if(tarmalimit[i] > 0){
tarmalimit[i]--;
}
if(Info[i][pGiftTime] != 0){
Info[i][pGiftTime]--;
}
if(PlayerTazeTime[i] >= 1){
PlayerTazeTime[i] += 1;
if(PlayerTazeTime[i] == 15){PlayerTazeTime[i] = 0;}
}
if(MechanicCallTime[i] > 0)
{
if(MechanicCallTime[i] == 300) { MechanicCallTime[i] = 0; DisablePlayerCheckpoint(i); PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0); GameTextForPlayer(i, "~r~Checkpoint eliminado!", 2500, 1); }
else
{
new string[5];
format(string, sizeof(string), "%d", 30 - MechanicCallTime[i]);
GameTextForPlayer(i, string, 1500, 6);
MechanicCallTime[i] += 1;
}
}
if(MedicCallTime[i] > 0)
{
if(MedicCallTime[i] == 45) { MedicCallTime[i] = 0; DisablePlayerCheckpoint(i); PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0); GameTextForPlayer(i, "~r~Checkpoint eliminado!", 2500, 1); }
else
{
new string[5];
format(string, sizeof(string), "%d", 45 - MedicCallTime[i]);
new Float:X,Float:Y,Float:Z;
GetPlayerPos(MedicAccepted[i], X, Y, Z);
SetPlayerCheckpoint(i, X, Y, Z, 5);
GameTextForPlayer(i, string, 1500, 6);
MedicCallTime[i] += 1;
}
}
if(GetPlayerState(i) == PLAYER_STATE_ONFOOT) for(new h = 0; h < sizeof(fINFO); h++)
{
if(IsPlayerInRangeOfPoint(i, 2.0, fINFO[h][FamilySafe][0], fINFO[h][FamilySafe][1], fINFO[h][FamilySafe][2]))
{
if(fINFO[h][FamilyUSafe] == 1)
{
GameTextForPlayer(i, "~y~Caja Fuerte~w~~n~Escribe ~r~/ayudasafe~w~ para mas informacion", 5000, 3);
}
}
}
if(EMSCallTime[i] > 0)
{
if(EMSAccepted[i] < 999)
{
if(IsPlayerConnected(EMSAccepted[i]))
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(EMSAccepted[i], X, Y, Z);
SetPlayerCheckpoint(i, X, Y, Z, 5);
}
}
}
if(Info[i][pEstado] == 1){
if(PlayerCuffedTime[i] <= 0){
//Frozen[i] = 0;
SetPVarInt(i, "IsFrozen", 0);
TogglePlayerControllable(i, 1);
Info[i][pEstado] = 0;
SetPVarInt(i, "PlayerCuffed", 0);
PlayerCuffedTime[i] = 0;
PlayerTazeTime[i] = 1;
ClearAnimations(i);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(i, X, Y, Z);
SetPlayerPos(i, X, Y, Z);
}
else{
PlayerCuffedTime[i] -= 1;
}
}
if(Info[i][pEstado] == 2){
if(PlayerCuffedTime[i] <= 0){
new Float:X, Float:Y, Float:Z;
GetPlayerPos(i, X, Y, Z);
new copinrange;
foreach(Player, j){
if(IsPlayerInRangeOfPoint(j, 30, X, Y, Z) && IsACop(j)){copinrange = 1;}
}
if(copinrange == 0)
{
//Frozen[i] = 0;
SetPVarInt(i, "IsFrozen", 0);
GameTextForPlayer(i, "~r~Rompiste las esposas eres libre!", 2500, 3);
TogglePlayerControllable(i, 1);
Info[i][pEstado] = 0;
DeletePVar(i, "PlayerCuffed");
PlayerCuffedTime[i] = 0;
}
else{PlayerCuffedTime[i] = 60;}
}
else{PlayerCuffedTime[i] -= 1;}
}
if(PlayerDrunk[i] > 9)
{
if(PlayerDrunkTime[i] > 20)
{
ApplyAnimation(i,"PED", "WALK_DRUNK",6.0,0,1,0,0,PlayerDrunk[i]*1000);
SetPlayerDrunkLevel(i, PlayerDrunk[i]*1000);
PlayerDrunk[i] -= 1;
PlayerDrunkTime[i] = 0;
}
PlayerDrunkTime[i] += 1;
}
if(PlayerDrunk[i] < 10 && PlayerDrunk[i] > 0)
{
if(PlayerDrunkTime[i] > 30)
{
PlayerDrunk[i] -= 1;
PlayerDrunkTime[i] = 0;
}
PlayerDrunkTime[i] += 1;
}
}
}
}

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)