12.03.2017, 07:57
I get these error codes in server logs when a player dies. How can i fix it? I have no idea. Please help me.
Here is my OnPlayerDeath
Thank you
Код:
[17:23:51] [debug] Run time error 4: "Array index out of bounds" [17:23:51] [debug] Attempted to read/write array element at index 65535 in array of size 1000 [17:23:51] [debug] AMX backtrace: [17:23:51] [debug] #0 0003a854 in ?? (0, 65535, 255) from gamemode.amx [17:23:51] [debug] #1 00005794 in public OnPlayerDeath (0, 65535, 255) from gamemode.amx [17:23:51] [death] Potato died 255
Here is my OnPlayerDeath
Код:
public OnPlayerDeath(playerid, killerid, reason) { SendDeathMessage(killerid, playerid, reason); cVeh[playerid] = 0; if(H_PlayerUsingLoopingAnim[playerid]) { H_PlayerUsingLoopingAnim[playerid] = 0; } PlayerInfo[playerid][Spawned] = 0; PlayerInfo[playerid][Deaths]++; if(IsPlayerConnected(killerid) && killerid != INVALID_PLAYER_ID) { PlayerInfo[killerid][Kills]++; } #if defined ENABLE_SPEC for(new x=0; x<MAX_PLAYERS; x++) if(GetPlayerState(x) == PLAYER_STATE_SPECTATING && PlayerInfo[x][SpecID] == playerid) AdvanceSpectate(x); #endif if(GetPVarInt(playerid,"dmtime") == 1) { SetPlayerScore(killerid,GetPlayerScore(killerid)+1); GivePlayerMoney(killerid,1200); SetPlayerScore(playerid,GetPlayerScore(playerid)-1); GivePlayerMoney(killerid,-1200); GameTextForPlayer(playerid,"~r~-1 score~n~-$1200",5000,1); GameTextForPlayer(killerid,"~g~+1 score~n~+$1200",5000,1); } if(GetPVarInt(playerid,"InDeathMatch") == 1) { SetPlayerScore(killerid,GetPlayerScore(killerid)+1); GivePlayerMoney(killerid,1200); SetPlayerScore(playerid,GetPlayerScore(playerid)-1); GivePlayerMoney(killerid,-1200); GameTextForPlayer(playerid,"~r~-1 score~n~-$1200",5000,1); GameTextForPlayer(killerid,"~g~+1 score~n~+$1200",5000,1); } if(Minigamer_{playerid} == true) { if(inProgress > 1) { Iter_Remove(_Minigamer, playerid); Minigamer_{playerid} = false; if( Iter_Count(_Minigamer) < 2) { foreach(_Minigamer, i) MinigameWinner(i); } } else { SendClientMessage(playerid, LIME, "Your sign up for Don't Get Wet minigame has been cancelled."); Iter_Remove(_Minigamer, playerid); Minigamer_{playerid} = false; } } if(InvitedDuel[killerid] == true) { new Float:healthkiller; new namekiller[24],namedeather[24]; GetPlayerName(killerid, namekiller, 24); GetPlayerName(playerid, namedeather, 24); GetPlayerHealth(killerid,healthkiller); format(Dstring, sizeof(Dstring), "[DUEL]>> %s has won duel on %s [%0.0f off armour and health]",namekiller,namedeather,healthkiller); SendClientMessageToAll(0xF600F6AA, Dstring); PlayerDuelsWons[killerid]++; InvitedDuel[killerid] = false; InvitedDuel[playerid] = false; IdDuel[playerid] = playerid; IdDuel[killerid] = killerid; UsingArena = false; healthkiller = 0; SpawnPlayer(killerid); } return 1; }