if(PlayerInfo[killerid][pMember] == 17 || PlayerInfo[killerid][pLeader] == 17) { if( PlayerInfo[ playerid ][ pDatameta ] == 1) { GivePlayerMoney(killerid, PlayerInfo[ playerid ][ pHitmenCena ]); format( globalstring, sizeof( globalstring ), "{FFFFFF}Hitman %s je izvrsio svoju narudzbu %s i zaradio %d rsd.", ImeIgraca( killerid ), ImeIgraca( playerid ), PlayerInfo[ playerid ][ pHitmenCena ] ); OrgPoruka(BRT, globalstring ); format( string, sizeof( string ), "Ubijeni ste od strane HITMANA"); SCM(playerid, COLOR_LIGHTRED, string ); format( globalstring, sizeof( globalstring ), "|Hitman| %s je ubio: %s", ImeIgraca( killerid ), ImeIgraca( playerid ) ); PosaljiAdminima(COLOR_LIGHTRED, globalstring); PlayerInfo[ playerid ][ pHitmenCena ] = 0; HitmanInfo[ killerid ][ GoChase ] = 0; HitmanInfo[ playerid ][ GetChased ] = 0; HitmanInfo[ playerid ][ GotHit ] = 0; PlayerInfo[ playerid ][ pDatameta ] = 0; WantedLevel[playerid] = 0; } }
You MUST check whether 'killerid' is valid (not INVALID_PLAYER_ID) before using it in an array (or really anywhere), as it will cause the OnPlayerDeath script to crash (not the entire script). This is because INVALID_PLAYER_ID is defined as 65535, and if an array only has 'MAX_PLAYERS' elements, e.g. 500, you're trying to access an index that is above 499, which is out of bounds. |
if(killerid != INVALID_PLAYER_ID) { // code here }