URGENT: Any loop causes the server to crash. -
Jack_Leslie - 13.04.2012
I have a major problem in my script, for some odd reason, any loop that is called causes the server to crash. I do not use foreach. I've never had this problem before and I have no idea why it's happening. Does anyone know any common causes for this type of thing? It's not a certain loop, but just any loop, crashes the server instantly so nothing has time to save causing in a rollback of information/
Re: URGENT: Any loop causes the server to crash. -
Mark™ - 13.04.2012
Use crashdetect plugin and debug the script, if necessary.
Re: URGENT: Any loop causes the server to crash. -
Ezay - 13.04.2012
Quote:
Use crashdetect plugin and debug the script, if necessary.
|
4char
Re: URGENT: Any loop causes the server to crash. -
Jack_Leslie - 13.04.2012
Okay thanks guys, I used crashdetect and it gave me some information. I'm not sure what it means though, hopefully you's or someone else can help me.
Quote:
[00:46:34] [debug] Run time error 4: "Array index out of bounds"
[00:46:34] [debug] Accessing element at index 71 past array upper bound 70
[00:46:34] [debug] Backtrace:
[00:46:34] [debug] #0 000e3350 in ?? () from subrp.amx
[00:46:34] [debug] #1 000bb040 in public Streamer_OnGameModeInit () from subrp.amx
[00:46:34] [debug] #2 native CallLocalFunction () from samp03svr
[00:46:34] [debug] #3 00000b64 in public OnGameModeInit () from subrp.amx
|
Re: URGENT: Any loop causes the server to crash. -
Lorenc_ - 13.04.2012
Compile in debug mode so that it prints the lines.
pawn.cfg:
"-d3 -r"
Re: URGENT: Any loop causes the server to crash. -
Jack_Leslie - 13.04.2012
Quote:
Originally Posted by Lorenc_
Compile in debug mode so that it prints the lines.
pawn.cfg:
"-d3 -r"
|
What do you mean?
Re: URGENT: Any loop causes the server to crash. -
iPLEOMAX - 13.04.2012
Under OnGameModeInit: Array index out of bounds
So, you have some loop that tries to use an invalid array index.
Now, show use ALL the "for" lines in that callback. (Just each of the for lines, you don't need to show their body scripts)
Re: URGENT: Any loop causes the server to crash. -
Jack_Leslie - 13.04.2012
Quote:
Originally Posted by iPLEOMAX
Under OnGameModeInit: Array index out of bounds
So, you have some loop that tries to use an invalid array index.
Now, show use ALL the "for" lines in that callback. (Just each of the for lines, you don't need to show their body scripts)
|
#1:
pawn Код:
for(new i = 0; i < MAX_VEHICLES; i++)
{
Gas[i] = 100;
}
#2:
pawn Код:
for(new i = 0; i <= sizeof(PedSkins)-1; i++)
{
AddPlayerClass(PedSkins[i][0],982.1890,-1624.2583,14.952,90,-1,-1,-1,-1,-1,-1);
}
#3:
pawn Код:
for(new h = 0; h < sizeof(FamilyInfo); h++)
{
FamilyInfo[h][PickupID] = CreatePickup(1210, 23, FamilyInfo[h][FamilySafePos][0], FamilyInfo[h][FamilySafePos][1], FamilyInfo[h][FamilySafePos][2]);
}
#4:
pawn Код:
for(new i = 0; i < 165; i++)
{
AddCar(i);
}
Re: URGENT: Any loop causes the server to crash. -
iPLEOMAX - 13.04.2012
#2: for(new i = 0; i
<= sizeof(PedSkins)-1; i++)
should be for(new i = 0; i
< sizeof(PedSkins); i++)
That's the best guess, but since you did sizeof(PedSkins)-1, it might not crash. But still you should print the sizes of each of your variable. and check if any of the loop is accessing invalid index.