#1

Server is crashing. I have this in logs.

Logs:

Код:
[20:48:25] [debug] Run time error 4: "Array index out of bounds"
[20:48:25] [debug] AMX backtrace:
[20:48:25] [debug] #0 00092cb8 in public GivePlayerMoneyEx (65535, 2500) from CnR.amx
Code:

Код:
public GivePlayerMoneyEx(playerid,ammount)
{
	OldMoney[playerid] = GetPlayerMoney(playerid);
 	NewMoney[playerid] = ammount + OldMoney[playerid];
  	GivePlayerMoney(playerid,ammount);
   	return 1;
}
Reply
#2

I think some piece of code is sending an invalid player id to the function, which crashes it.

Quote:

[20:48:25] [debug] #0 00092cb8 in public GivePlayerMoneyEx (65535, 2500) from CnR.amx

Search for something that gives a player 2500 cash, either post that code here for further help or try to add a check if the playerid is INVALID_PLAYER_ID and then stop the code before it does anything.
Reply
#3

For more detailed reporting, you can #include crashdetect while compiling and also compile with the -d3 flag. Regardless, your issue is this:
Код:
(65535, 2500)
65535 is the definition for INVALID_PLAYER_ID, which is what is being passed to this function. Because OldMoney and NewMoney likely only go up to MAX_PLAYERS, this causes it to attempt to access data out of range.

First you need to figure out why it is being called with INVALID_PLAYER_ID, and secondly, you can add an IsPlayerConnected check (although that is a workaround and doesn't explain why it is being called in the first place) at the top of the function and stop further execution through returning 0 if not connected.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)