[debug] Run time error 4: "Array index out of bounds" [debug] Attempted to read/write array element at index 65535 in array of size 201 [debug] AMX backtrace: [debug] #0 001de764 in ?? (65535, 1) from TestSrv.amx [debug] #1 0003496c in ?? (0, 65535, 54, 1126498304, 3) from TestSrv.amx [debug] #2 00032f00 in public OnPlayerTakeDamage (0, 65535, 1126498304, 54, 3) from TestSrv.amx [debug] Run time error 4: "Array index out of bounds" [debug] Attempted to read/write array element at index 65535 in array of size 201 [debug] AMX backtrace: [debug] #0 0024c8b0 in public OnPlayerDeath (0, 65535, 54) from TestSrv.amx [death] Ryan_Brasco died 54 [debug] Run time error 4: "Array index out of bounds" [debug] Attempted to read/write array element at index 65535 in array of size 201 [debug] AMX backtrace: [debug] #0 001de764 in ?? (65535, 1) from TestSrv.amx [debug] #1 0003496c in ?? (0, 65535, 54, 1079194420, 3) from TestSrv.amx [debug] #2 00032f00 in public OnPlayerTakeDamage (0, 65535, 1079194420, 54, 3) from TestSrv.amx
fpublic OnPlayerDeath(playerid, killerid, reason) { if(LastDamagerDamage[playerid] > (UnixTime - LAST_SHOOT_FOR_KILLER)) { killerid = LastDamager[playerid]; reason = LastDamagerType[playerid]; } if(RoncsDerby[playerid][rdVersenyez] || RoncsDerby[playerid][rKiesett] > UnixTime) return RoncsDerbiKieses(playerid); if(AdminDuty[playerid] == 1 || ScripterDuty[playerid] == 1) { //Meghalt[playerid] = true; KorhazIdo[playerid] = NINCS; return 1; } if(GetPVarInt(playerid,"roped") == 1) { for(new destr2=0;destr2<=ropelength;destr2++) { DestroyObject(r0pes[playerid][destr2]); } SetPVarInt(playerid,"roped",0); DisablePlayerCheckpoint(playerid); } if(Kikepzoben[playerid]) { KorhazIdo[playerid] = NINCS; WeaponArm(playerid); return 1; } if(Paintballozik[playerid]) { KorhazIdo[playerid] = NINCS; if(killerid != INVALID_PLAYER_ID) { PaintballOlesek[killerid] ++; if(PaintballOlesek[killerid] > PaintballInfo[PBTerem[playerid]][pbNyertesOles]) { PaintballInfo[PBTerem[playerid]][pbNyertes] = killerid; PaintballInfo[PBTerem[playerid]][pbNyertesOles] = PaintballOlesek[killerid]; PaintballInfo[PBTerem[playerid]][pbNyertesFegyver] = WeaponArmed(killerid); } PaintballInfo[PBTerem[playerid]][pbNyertesOles] = PaintballOlesek[PaintballInfo[PBTerem[playerid]][pbNyertes]]; foreach(Jatekosok, i) { if(Paintballozik[i] && PBTerem[i] == PBTerem[playerid]) SendFormatMessage(i, COLOR_YELLOW, "[Paintball] %s vezet %d цlйssel.", ICPlayerName(PaintballInfo[PBTerem[i]][pbNyertes]),PaintballInfo[PBTerem[i]][pbNyertesOles]); } } return 1; } if(Halal[playerid]) return 1; else Halal[playerid] = true; /*if(!Paintballozik[playerid] && ScripterDuty[playerid] != 1 && AdminDuty[playerid] != 1 && !Kikepzoben[playerid] && !Admin(playerid,1338) && killerid != INVALID_PLAYER_ID && !Harcol[playerid] && !PlayerInfo[playerid][pJailed]) { new osszskill= 0; for(new x = 0; x <= 10; x++) osszskill += PlayerInfo[playerid][pFegyverSkillek][x]; new levonas; switch(osszskill) { case 0..500: levonas = 15; case 501..2000: levonas = 30; case 2001..3000: levonas = 45; case 3001..4000: levonas = 60; case 4001..5000: levonas = 75; case 5001..6000: levonas = 90; case 6001..7000: levonas = 120; case 7001..8000: levonas = 150; case 8001..9000: levonas = 180; case 9001..10000: levonas = 240; case 10001..11000: levonas = 270; default: levonas = 300; } for(new x = 0; x <= 10; x++) if(PlayerInfo[playerid][pFegyverSkillek][x] > 300) PlayerInfo[playerid][pFegyverSkillek][x] -=levonas; }*/ // Skill levonбs new name2[MAX_PLAYER_NAME]; if(killerid != INVALID_PLAYER_ID) GetPlayerName(killerid, name2, sizeof(name2)); else name2 = "-"; new Float:pos[3], penz = GetMoney(playerid); GetPlayerPos(playerid, ArrExt(pos)); if(reason >= 0 && reason <= 47 || reason == 51 || reason == 16 || reason == 38) { if(PlayerInfo[playerid][pLevel] < 4) format(_tmpString, 128, "%s megцlte %s-t (KEZDŐT!) ezzel: %s - Pйnz: %dFt - Pos: %.0f, %.0f, %.0f", name2, PlayerName(playerid), aWeaponNames[reason], penz, ArrExt(pos)); else format(_tmpString, 128, "%s megцlte %s-t ezzel: %s - Pйnz: %dFt - Pos: %.0f, %.0f, %.0f", name2, PlayerName(playerid), aWeaponNames[reason], penz, ArrExt(pos)); new killer = PlayerInfo[killerid][pHitmanNev]; if(HitmanDuty[killerid] > 0) format(_tmpString, 128, "%s megцlte %s-t ezzel: %s - Pйnz: %dFt - Pos: %.0f, %.0f, %.0f", killer, PlayerName(playerid), aWeaponNames[reason], penz, ArrExt(pos)); else format(_tmpString, 128, "%s megцlte %s-t ezzel: %s - Pйnz: %dFt - Pos: %.0f, %.0f, %.0f", name2, PlayerName(playerid), aWeaponNames[reason], penz, ArrExt(pos)); KillLog(_tmpString, 1); foreach(Jatekosok, i) { if(togkill[i] && PlayerInfo[i][pAdmin] > 0) SendClientMessage(i, COLOR_GREY, _tmpString); } if(!AdminDuty[killerid] && !Harcol[killerid] && !Paintballozik[killerid] && !Kikepzoben[killerid] && !Halal[killerid]) { PlayerInfo[killerid][pOlesIdo] +=K_OLES_IDO; tformat(128, "%s plusz kуrhбz jail ideje %d mбsodpercre nőtt (+"#K_OLES_IDO"mp)", PlayerName(killerid), PlayerInfo[killerid][pOlesIdo]); KillLog(_tmpString, 0); } Olesek[killerid]++; if(Olesek[killerid] == 1 && !IsHitman(killerid) && HitmanDuty[killerid] != 1) { if(GetPlayerVirtualWorld(playerid) == 0) SetPlayerCriminal(killerid,255, "Elsőfokъ Gyilkos"); } if(Olesek[killerid] > 1 && !IsHitman(killerid) && HitmanDuty[killerid] != 1) { if(GetPlayerVirtualWorld(playerid) == 0) SetPlayerCriminal(killerid,255, "Tцbbszцrцs gyilkos"); } /*for(new i = 0; i<=10; i++) { if(PlayerInfo[playerid][pFegyverSkillek][i] >= 215) { PlayerInfo[playerid][pFegyverSkillek][i] -= 15; SendFormatMessage(playerid,COLOR_YELLOW,"Mivel meghaltбl a(z) %d. fegyverskill csцkkent 15 йrtйket! Jelenlegi йrtйke:%d",i,PlayerInfo[playerid][pFegyverSkillek][i]); } }*/ } else if(reason >= 49 && reason <= 54 && reason != 52) { new killer = GetClosestPlayer(playerid); new oka[32]; if(reason == 49) oka = "Autу"; else if(reason == 50) oka = "Helikopter"; else if(reason == 51) oka = "Robbanбs"; else if(reason == 53) oka = "Megfulladt"; else if(reason == 54) oka = "Leesett"; PlayerInfo[playerid][pEllatva] = false; if(reason != 54 && reason != 53 && reason != 51) format(_tmpString, 128, "%s meghalt (%s), oka: %s | Lehet, hogy %s цlte meg, mert a kцzelben volt - Pйnz: %dFt - Pos: %.0f, %.0f, %.0f", PlayerName(playerid), name2, oka, PlayerName(killer), penz, ArrExt(pos)); else format(_tmpString, 128, "%s meghalt (%s), oka: %s - Pйnz: %dFt - Pos: %.0f, %.0f, %.0f", PlayerName(playerid), name2, oka, penz, ArrExt(pos)); KillLog(_tmpString, 0); foreach(Jatekosok, i) { if(PlayerInfo[i][pAdmin] > 0 && togkill[i] || IsScripter(i)) SendClientMessage(i, COLOR_GREY, _tmpString); } if(killerid != INVALID_PLAYER_ID) SetPlayerCriminal(killerid,255, "Cserbenhagyбs"); } if(reason == 38) { if(IsPlayerConnected(killerid)) { format(_tmpString, 128, "FIGYELMEZTETЙS: [%d]%s minigunnal цlt meg valakit!", killerid, PlayerName(killerid)); ABroadCast(COLOR_YELLOW,_tmpString,1); KorhazIdo[playerid] = NINCS; } } // tйrfigyelő - цlйs if(killerid != INVALID_PLAYER_ID && !PLAYER_MARKER_IS_HIDDEN(killerid) && !PlayerMarker[killerid][mHidden] && !IsACop(killerid) && (PLAYER_MARKER_WEAPONS_KILL(killerid) || (WeaponArmed(killerid) == WEAPON_SNIPER || WeaponArmed(killerid) == WEAPON_RIFLE) && GetDistanceBetweenPlayers(killerid, playerid) <= PLAYER_MARKER_RIFLE_DISTANCE) ) { switch(PlayerMarker[killerid][mType]) { case PLAYER_MARKER_KILL: MarkerAction(killerid, PLAYER_MARKER_SET, PLAYER_MARKER_MKILL); case PLAYER_MARKER_MKILL: { if((PlayerMarker[killerid][mTime] + PLAYER_MARKER_TIME_MKILL) > PLAYER_MARKER_MTIME_MKILL) PlayerMarker[killerid][mTime] = PLAYER_MARKER_MTIME_MKILL; else PlayerMarker[killerid][mTime] += PLAYER_MARKER_TIME_MKILL; } default: MarkerAction(killerid, PLAYER_MARKER_SET, PLAYER_MARKER_KILL); } } new sloti = -1; for(; ++sloti < MAX_PLAYER_ATTACHED_OBJECTS;) //tцrli az цsszes testre csatolhatу objectet { if(IsPlayerAttachedObjectSlotUsed(playerid, sloti)) RemovePlayerAttachedObject(playerid, sloti); } RemoveAllDynamic3DTextLabel(playerid); ClearPlayerCrime(playerid); ClearAnimations(playerid); StopAudioStreamForPlayer(playerid); SetHealth(playerid, MAXHP); if(PInfo(playerid,Elajult)) { Animban[playerid] = 0; PInfo(playerid,Elajult) = false; Feketeseg(playerid, false); Leutve[playerid] = false; UnFreeze(playerid); } if(PajzsNala[playerid] == true) PajzsTorles(playerid); if(Paintballnevezve[playerid]) { Paintballnevezve[playerid] = false; PaintballInfo[PBTerem[playerid]][pbNevezesek]--; PBTerem[playerid] = NINCS; } for(new l = 0; l < MaxLoter; l++) { if(LoterInfo[l][lHasznalva] == true && LoterInfo[l][lHasznalo] == playerid) LoterVege(playerid, l, LoterInfo[l][lFegyver]); } new caller = Mobile[playerid]; if(caller != 255 && caller < 255 && IsPlayerConnected(caller)) { SendClientMessage(caller, COLOR_GRAD2, " Megszakadt a vonal...."); CellTime[caller] = 0; Mobile[caller] = 255; } // Hitman kill if(PlayerInfo[playerid][pHeadValue] > 0 && PlayerInfo[killerid][pHitman] != 0) { new hitmanstring[200]; SendFormatMessageToAll(COLOR_YELLOW, " <<< A bйrgyilkos teljesнtette a megbнzу kйrйsйt - %s kinyнrva >>> ", PlayerName(playerid)); format(hitmanstring,128,"<< %s teljesнtette a megbнzбst >>", PlayerInfo[killerid][pHitmanNev]); SendMessage(SEND_MESSAGE_HITMAN, hitmanstring, COLOR_YELLOW); SendFormatMessage(killerid, COLOR_LIGHTBLUE, "A megbнzбst teljesнtetted. A cйg бtutalta a pйnzt a szбmlбdra. (%dFt)", PlayerInfo[playerid][pHeadValue]); PlayerInfo[killerid][pAccount] += PlayerInfo[playerid][pHeadValue]; PlayerInfo[playerid][pHeadValue] = 0; } // Hitman kill if(BViadal[killerid] && BViadal[playerid]) { new BV[256]; format(BV, sizeof(BV), "Viadal: %s kiesett, oka: meghalt", PlayerName(playerid)); SendMessage(SEND_MESSAGE_HITMAN, BV, COLOR_YELLOW); BVJatekosok--; BViadal[playerid] = 0; } if(!Paintballozik[playerid] && ScripterDuty[playerid] != 1 && AdminDuty[playerid] != 1 && !Kikepzoben[playerid]) { if(killerid != INVALID_PLAYER_ID) HullaLerak(playerid, ArrExt(pos), reason, GetPlayerVirtualWorld(playerid),PlayerName(killerid)); else HullaLerak(playerid, ArrExt(pos), reason, GetPlayerVirtualWorld(playerid)); DropAddWeapon(ArrExt(pos), GetPlayerWeapon(playerid), GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)); DropAddAmmo(ArrExt(pos), GetPlayerWeapon(playerid), GetPlayerAmmo(playerid), GetPlayerVirtualWorld(playerid), GetPlayerInterior(playerid)); } if(TilosOlni == 1 && !IsPlayerNPC(killerid) && !Harcol[killerid] && !Paintballozik[killerid] && !Kikepzoben[killerid]) { Msg(killerid, "Zerу tolerancia йrvйnyben van, йs mivel megszegted, 120 perc Ajail-t kaptбl!"); Jail(killerid, "+", 7200, "ajail", "Zero tolerancia"); } else if(IsAt(killerid, IsAt_Korhaz)) { ABroadCastFormat(COLOR_LIGHTRED, 1, "%s kуrhбz DMelt - Auto 20perc magбnzбrka", PlayerName(killerid)); Msg(killerid, "Tilos a kуrhбz DM!"); Jail(killerid, "+", 1200, "ajail2", "Kуrhбz DM"); } else if(PlayerInfo[killerid][pJailed] == 1 || PlayerInfo[killerid][pJailed] == 2 || PlayerInfo[killerid][pJailed] == 4 || PlayerInfo[killerid][pJailed] == 5 || PlayerInfo[killerid][pJailed] == 7) { ABroadCastFormat(COLOR_LIGHTRED, 1, "%s bцrtцn DMelt - Auto 30perc magбnzбrka", PlayerName(killerid)); Msg(killerid, "Tilos a bцrtцn DM!"); Jail(killerid, "+", 1800, "ajail2", "Bцrtцn DM"); } if(HarcVan && Harcol[playerid] && TeruletInfo[ HarcolTerulet[playerid] ][tHarc]) HarcKieses(playerid, "Sъlyosan megsйrьlt"); if(OnDuty[playerid] != 0) { OnDuty[playerid] = 1; Munkaruha(playerid, 1); } #if defined Clint_Activated KulsoFegyverFrissites(playerid, true); #endif if( GyemantNala[playerid] != NINCS) GyemantAkcio( GYEMANT_LERAK, playerid, GyemantNala[playerid] ); if(EhsegBar[playerid] != INVALID_BAR_ID) HideProgressBarForPlayer(playerid, EhsegBar[playerid]); if(VizeletBar[playerid] != INVALID_BAR_ID) HideProgressBarForPlayer(playerid, VizeletBar[playerid]); if(Visz[playerid] != NINCS) Visz[playerid] = NINCS; if(Rabol[playerid] == 1) Rabol[playerid] = 0; if(Zsebradio[playerid] > 0) Zsebradio[playerid] = 0; ScriptShoot[playerid] = false; LsBankban[playerid]=false; Ehseg[playerid] = 0.0; Vizelet[playerid] = 0.0; ov[playerid]=0; Crosscp[playerid]=0; RepulesEngedely[playerid]=0; Animbanemrakhato[playerid] = 1; Animban[playerid] = 0; PlayerInfo[playerid][pSpawned] = 0; PlayerInfo[playerid][pLocal] = NINCS; Favago[playerid] = 0; Mobile[playerid] = 255; CellTime[playerid] = 0; JatekosZsak[playerid] = NINCS; TozsdeJatekosZsak[playerid] = NINCS; Szajkendo[playerid] = 0; Maszk[playerid] = 0; Sisak[playerid] = 0; RendorPajzsIdo[playerid] = 0; killerid = INVALID_PLAYER_ID; if(!gPlayerLogged[playerid]) return BanEx(playerid, "DieBeforeLogin"); if(reason == 0 && !BelepveFake[killerid]) { SeeBan(killerid, 0, NINCS, "Fakekill", true, true); // utolsу paramйter az a kick, nem false kellett volna, hanem true return 1; } new lastdeath = (LastDeath[playerid] == 0 ? 30 : UnixTime - LastDeath[playerid]); LastDeath[playerid] = UnixTime; if(!ScriptShoot[playerid] && killerid != INVALID_PLAYER_ID && (Shooted[playerid][killerid] < (UnixTime - 10) || reason <= 42 && GetPlayerWeapon(killerid) != reason || lastdeath <= 3)) { seo_fakekillCount[playerid]++; seo_fakekillTime[playerid] += 3; new string[128]; format(string, sizeof(string), "<< Lehetsйges FakeKill: [%d]%s - reason: %d (%d) - shoot: %dmp - death: %dmp - %dx >>", playerid, Nev(playerid), reason, GetPlayerWeapon(killerid), Shooted[playerid][killerid], lastdeath); Log("Cheat", string); if(seo_fakekillCount[playerid] >= 2) { ABroadCast(COLOR_LIGHTRED, string, 1); if(seo_fakekillCount[playerid] >= 5) SeeBan(playerid, .oka = "Cheat (FK)", .szoveg = true); return 1; } } return 1; }
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart) { OnPlayerHit(playerid, issuerid, weaponid, amount, bodypart); return 1; }
stock OnPlayerHit(playerid, attacker, damageType, Float:amount, bodypart) { new bool:sikertelen = true; // prevent vehicle damage if(damageType == DAMAGE_VEHICLE) return 0; // anti vehicle flood /*if(damageType == DAMAGE_VEHICLE) { if(LastVehicleDamage[playerid] == UnixTime) return 0; else LastVehicleDamage[playerid] = UnixTime; }*/ //////////////////// // PREVENT DAMAGE // //////////////////// if(IsPlayerNPC(playerid) || Ajtozott[playerid] > 0 || AdminDuty[playerid] || Warozott[playerid] >= UnixTime || NoDamage[playerid] || SpawnVedelem[playerid] || PlayerVehicle[playerid] != NINCS && ArmoredVehicle[PlayerVehicle[playerid]] || attacker != INVALID_PLAYER_ID && ( NemMozoghat(attacker) || AdminDuty[attacker] ) ) return 0; ///////////////////// // DAMAGE MODIFIER // ///////////////////// new Float:damage; if(0 <= damageType < WEAPON_DAMAGE_TYPES) switch(CustomDamage[damageType][wType]) { case DAMAGE_DEFAULT, DAMAGE_NEUTRAL: damage = amount; case DAMAGE_OVERWRITE: damage = CustomDamage[damageType][wDamage]; case DAMAGE_MULTIPLIER: damage = amount * CustomDamage[damageType][wDamage]; //case DAMAGE_NULL, DAMAGE_NEUTRAL: // damage = 0; //default: // damage = 0; } /* /////////////////////// // BODYPART MODIFIER // /////////////////////// switch(bodypart) { ////////////// // HEADSHOT // ////////////// case BODY_PART_HEAD: { damage *= 2.0; } ////////////// // ARM SHOT // ////////////// case BODY_PART_LEFT_ARM, BODY_PART_RIGHT_ARM: damage *= 0.75; ////////////// // LEG SHOT // ////////////// case BODY_PART_LEFT_LEG, BODY_PART_RIGHT_LEG: { damage *= 0.75; } } //////////////////// // POST MODIFIERS // //////////////////// if(PlayerSkin[playerid] == 285 && Armour[playerid] >= 50.0) // swat damage *= 0.5;*/ if(PajzsNala[playerid] && PlayerSkin[playerid] == 285) damage *= 0.75; //////////////////// // PREVENT DAMAGE // //////////////////// //////////////////// if(damage <= 0.0) // return 0; // //////////////////// LogDamage(LOG_DAMAGE_TAKE, playerid, attacker, damageType, damage); if(22 <= damageType <= 38) { PlayerInfo[playerid][pLoves] = UnixTime + 120; PlayerInfo[playerid][pEllatva] = true; //Shooted[playerid][issuerid] = UnixTime; } //////////////// // TЙRFIGYELŐ // //////////////// if(attacker != INVALID_PLAYER_ID && 22 <= damageType <= 38 && !PLAYER_MARKER_IS_HIDDEN(attacker) && !PlayerMarker[attacker][mHidden] && !IsACop(attacker) && (PlayerInfo[attacker][pHitman] <= 0 && !HitmanDuty[attacker]) && PlayerMarker[attacker][mLastShoot] != UnixTime && (PLAYER_MARKER_WEAPONS_SHOOT(attacker) || (WeaponArmed(attacker) == WEAPON_RIFLE || WeaponArmed(attacker) == WEAPON_SNIPER) && GetDistanceBetweenPlayers(attacker, playerid) <= PLAYER_MARKER_RIFLE_DISTANCE) ) { PlayerMarker[attacker][mLastShoot] = UnixTime; switch(PlayerMarker[attacker][mType]) { case PLAYER_MARKER_SHOOT: { if((PlayerMarker[attacker][mTime] + PLAYER_MARKER_TIME_SHOOT) > PLAYER_MARKER_MTIME_SHOOT) PlayerMarker[attacker][mTime] = PLAYER_MARKER_MTIME_SHOOT; else PlayerMarker[attacker][mTime] += PLAYER_MARKER_TIME_SHOOT; } case PLAYER_MARKER_KILL: { if((PlayerMarker[attacker][mTime] + PLAYER_MARKER_TIME_KILL_SHOOT) > PLAYER_MARKER_MTIME_KILL) PlayerMarker[attacker][mTime] = PLAYER_MARKER_MTIME_KILL; else PlayerMarker[attacker][mTime] += PLAYER_MARKER_TIME_KILL_SHOOT; } case PLAYER_MARKER_MKILL: { if((PlayerMarker[attacker][mTime] + PLAYER_MARKER_TIME_MKILL_SHOOT) > PLAYER_MARKER_MTIME_MKILL) PlayerMarker[attacker][mTime] = PLAYER_MARKER_MTIME_MKILL; else PlayerMarker[attacker][mTime] += PLAYER_MARKER_TIME_MKILL_SHOOT; } default: { MarkerAction(attacker, PLAYER_MARKER_SET, PLAYER_MARKER_SHOOT); } } } new bool:kikerulve = (random(100)+1) <= Gyemantjai[playerid]; if(kikerulve) return !Msg(playerid, "[Gyйmбnt] Hбla az ьgyessйgednek, kikerьltйl egy talбlatot"); /////////////////////////////// // NEW TAZER SYSTEM BY PEDRO // /////////////////////////////// if(IsACop(attacker) && Tazer[attacker] && Sokkolt[attacker] == 0 && (WeaponArmed(attacker) == WEAPON_DEAGLE || WeaponArmed(attacker) == WEAPON_SILENCED) && OnDuty[attacker] && GetPlayerState(attacker) == PLAYER_STATE_ONFOOT) { new fail, chancetofail = random(100); switch(chancetofail) { case 0..35: fail = 1; default: fail = 0; } if(IsPlayerInWater(attacker) || IsPlayerInWater(playerid)) { Msg(attacker, "Vнzben lйvőt akarsz lesokkolni? Az бram agyonьt titeket!"); fail = 1; } if(GetDistanceBetweenPlayers(attacker, playerid) > 25.0 || IsPlayerNPC(playerid)) { Msg(attacker, "Nincs a kцzeledben senki, vagy odбig nem йr el a sokkolу feje!"); fail = 1; } if(fail) { SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Majdnem lesokkolt egy rendőr! Vigyбzz!"); SendClientMessage(attacker, COLOR_LIGHTBLUE, "* Nem tudtad lesokkolni a cйlszemйlyt!"); Cselekves(attacker, "lő a sokkolуval, de nem tudja lesokkolni a cйlszemйlyt", 1); GameTextForPlayer(playerid, "~r~Majdnem lesokkoltak!", 2500, 3); Sokkolt[attacker] = 5; return 1; } if(Rabol[playerid] == 1) Rabol[playerid] = 0; if(Tazer[playerid]) Tazer[playerid] = false; SendClientMessage(playerid, COLOR_LIGHTBLUE, "* Lesokkolt egy rendőr, йs 60 mбsodpercig megbйnultбl."); SendClientMessage(attacker, COLOR_LIGHTBLUE, "* Lesokkoltad 60 mбsodpercre."); Cselekves(attacker, "lő a sokkolуval, йs lesokkolja a cйlszemйlyt", 1); GameTextForPlayer(playerid, "~r~Sokkoltak", 2500, 3); Bilincs(playerid, 1); ApplyAnimation(playerid,"CRACK","crckdeth2",4.1,0,1,1,1,0); WeaponArm(playerid); Sokkolt[attacker] = 15; return 1; } ////////////////////////// // DEAL THE REAL DAMAGE // ////////////////////////// new Float: newhp = Health[playerid], Float: newarmour = Armour[playerid]; if(attacker != INVALID_PLAYER_ID) { newarmour -= damage; if(newarmour < 0) { newhp += newarmour; newarmour = 0; } } else newhp -= damage; if(!Animban[playerid] && !Paintballozik[playerid] && !Kikepzoben[playerid] && newhp < 15.0 && NextAvailableNoDamage[playerid] < UnixTime && bodypart != BODY_PART_HEAD) { NoDamage[playerid] = 3; newhp = 15.0; AnimbaRak(playerid); NextAvailableNoDamage[playerid] = UnixTime + 30; } if(damageType == DAMAGE_FALL && !Animban[playerid] && !Paintballozik[playerid] && !Kikepzoben[playerid] && NextAvailableNoDamage[playerid] < UnixTime && damage >= 15.0) { NoDamage[playerid] = 3; newhp -= 50.0; AnimbaRak(playerid); NextAvailableNoDamage[playerid] = UnixTime + 30; } SetPlayerHealth(playerid, newhp); SetPlayerArmour(playerid, newarmour); LastDamage[playerid] = UnixTime; if(attacker != INVALID_PLAYER_ID) { ScriptShoot[playerid] = true; Shooted[playerid][attacker] = UnixTime; LastDamager[playerid] = attacker; LastDamagerDamage[playerid] = UnixTime; LastDamagerType[playerid] = damageType; } if(PlayerSkin[playerid] == 285 && Armour[playerid] >= 100.0) return 0; //SWAT new talalat=random(100); switch(talalat) { case 0..60: sikertelen = true; default: sikertelen = false; } if(IsPlayerInAnyVehicle(playerid) && sikertelen == true) return 0; //Kocsiban fejlцvйs //////////// // SNIPER // //////////// if(damageType == 34 && Armour[playerid] <= 55.0 && !Paintballozik[playerid]) // sniper = 1 lцvйs anim { SendFormatMessage(playerid, COLOR_LIGHTRED, "Sйrьlйs: Sniperrel meglőttek, ezйrt sъlyosan megsйrьltйl (#%d)", PlayerInfo[attacker][pBID]); Msg(attacker, "Eltalбltad, ezйrt nem tud mozogni."); AnimbaRak(playerid, false); new sniplog[128]; format(sniplog, 128, "%s sniperrel meglőtte őt: %s", PlayerName(attacker), PlayerName(playerid)); Log("Kill", sniplog); PlayerInfo[playerid][pLoves] = UnixTime + 600; PlayerInfo[playerid][pEllatva] = true; } /////////// // RIFLE // /////////// else if(damageType == 33 && Armour[playerid] <= 30.0 && !Paintballozik[playerid]) // rifle = 2 lцvйs 10 mбsodpercen belьl = anim { if(RifleTalalat[playerid] > 0) { SendFormatMessage(playerid, COLOR_LIGHTRED, "Sйrьlйs: Tцbbszцr is meglőttek Riflevel, ezйrt sъlyosan megsйrьltйl (#%d)", PlayerInfo[attacker][pBID]); Msg(attacker, "Tцbbszцr is meglőtted Riflevel, ezйrt sъlyosan megsйrьlt."); AnimbaRak(playerid, false); new riflelog[128]; format(riflelog, 128, "%s riflevel animba lőtte őt őt: %s", PlayerName(attacker), PlayerName(playerid)); Log("Kill", riflelog); PlayerInfo[playerid][pLoves] = UnixTime+300; PlayerInfo[playerid][pEllatva] = true; } RifleTalalat[playerid] = 10; } else if(bodypart == BODY_PART_HEAD) { if(Paintballozik[playerid]) { NoDamage[playerid] = 5; if(damageType == 22) PlayerInfo[attacker][pFegyverSkillek][0] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, "A Colt45 skilled emelkedett "#PBSKILL_FEJ" ponttal"); if(damageType == 23) PlayerInfo[attacker][pFegyverSkillek][1] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, "A Silenced skilled emelkedett "#PBSKILL_FEJ" ponttal"); if(damageType == 24) PlayerInfo[attacker][pFegyverSkillek][2] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, "A Deagle skilled emelkedett "#PBSKILL_FEJ" ponttal"); if(damageType == 25) PlayerInfo[attacker][pFegyverSkillek][3] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, "A Shotgun skilled emelkedett "#PBSKILL_FEJ" ponttal"); if(damageType == 27) PlayerInfo[attacker][pFegyverSkillek][5] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, "A Combat skilled emelkedett "#PBSKILL_FEJ" ponttal"); if(damageType == 29) PlayerInfo[attacker][pFegyverSkillek][7] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, "Az MP5 skilled emelkedett "#PBSKILL_FEJ" ponttal"); if(damageType == 30) PlayerInfo[attacker][pFegyverSkillek][8] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, "Az AK47 skilled emelkedett "#PBSKILL_FEJ" ponttal"); if(damageType == 31) PlayerInfo[attacker][pFegyverSkillek][9] += PBSKILL_FEJ, SendClientMessage(attacker, COLOR_YELLOW, "Az M4 skilled emelkedett "#PBSKILL_FEJ" ponttal"); FegyverSkillFrissites(attacker); Msg(playerid, "Fejen lőttek, ezйrt kiestйl, hamarosan ъjraйledsz"); Msg(attacker, "Fejen lőtted, ezйrt kiesett"); new Float:hp; GetPlayerHealth(attacker, hp); SetPlayerHealth(attacker, hp+random(100)); PlayerPlaySound(attacker, 17802, 0.0, 0.0, 0.0); SetPlayerHealth(playerid, 0.0); return 0; } if(!Paintballozik[playerid] && !Kikepzoben[playerid] && !Halal[playerid]) { if(IsPlayerInAnyVehicle(playerid)) { if(sikertelen == false) { SendFormatMessage(playerid, COLOR_LIGHTRED, "ClassRPG: Fejen lőttek, ezйrt eszmйletedet vesztetted (#%d)", PlayerInfo[attacker][pBID]); Msg(attacker, "Jбrművцn keresztьl fejen lőtted, ezйrt eszmйletйt vesztette."); PlayerInfo[playerid][pEllatva] = false; } } else { SendFormatMessage(playerid, COLOR_LIGHTRED, "ClassRPG: Fejen lőttek, ezйrt eszmйletedet vesztetted (#%d)", PlayerInfo[attacker][pBID]); Msg(attacker, "Fejen lőtted, ezйrt eszmйletйt vesztette."); PlayerInfo[playerid][pEllatva] = false; /*PlayerInfo[attacker][pOlesIdo] += K_OLES_IDO; tformat(128, "%s plusz kуrhбz jail ideje %d mбsodpercre nőtt (+"#K_OLES_IDO"mp)", PlayerName(attacker), PlayerInfo[attacker][pOlesIdo]); KillLog(_tmpString, 0);*/ } } if(Harcol[playerid]) HarcKieses(playerid, "Fejen lőttйk"); else SetPlayerHealth(playerid, 0.0); tformat(128, "%s fejen lőtte őt: %s", PlayerName(attacker), PlayerName(playerid)); Log("Kill", _tmpString); } else if(bodypart == BODY_PART_LEFT_LEG || bodypart == BODY_PART_RIGHT_LEG) { if(Paintballozik[playerid]) { NoDamage[playerid] = 5; if(damageType == 22) PlayerInfo[attacker][pFegyverSkillek][0] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, "A Colt45 skilled emelkedett "#PBSKILL_LAB" ponttal"); if(damageType == 23) PlayerInfo[attacker][pFegyverSkillek][1] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, "A Silenced skilled emelkedett "#PBSKILL_LAB" ponttal"); if(damageType == 24) PlayerInfo[attacker][pFegyverSkillek][2] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, "A Deagle skilled emelkedett "#PBSKILL_LAB" ponttal"); if(damageType == 25) PlayerInfo[attacker][pFegyverSkillek][3] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, "A Shotgun skilled emelkedett "#PBSKILL_LAB" ponttal"); if(damageType == 27) PlayerInfo[attacker][pFegyverSkillek][5] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, "A Combat skilled emelkedett "#PBSKILL_LAB" ponttal"); if(damageType == 29) PlayerInfo[attacker][pFegyverSkillek][7] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, "Az MP5 skilled emelkedett "#PBSKILL_LAB" ponttal"); if(damageType == 30) PlayerInfo[attacker][pFegyverSkillek][8] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, "Az AK47 skilled emelkedett "#PBSKILL_LAB" ponttal"); if(damageType == 31) PlayerInfo[attacker][pFegyverSkillek][9] += PBSKILL_LAB, SendClientMessage(attacker, COLOR_YELLOW, "Az M4 skilled emelkedett "#PBSKILL_LAB" ponttal"); FegyverSkillFrissites(attacker); new Float:hp; GetPlayerHealth(attacker, hp); SetPlayerHealth(attacker, hp+random(50)); Msg(playerid,"Lбbon lőttek, ezйrt kiestйl, hamarosan ъjraйledsz"); Msg(attacker,"Lбbon lőtted, ezйrt kiesett"); SetHealth(playerid, 0.0); PlayerPlaySound(attacker, 17802, 0.0, 0.0, 0.0); PlayerInfo[playerid][pAnimbanvan] = 0; return 0; } LabTalalat[playerid] ++; if(LabTalalat[playerid] >= 2) { SendFormatMessage(playerid, COLOR_LIGHTRED, "ClassRPG: Lбbon lőttek, ezйrt sъlyosan megsebesьltйl (#%d)", PlayerInfo[attacker][pBID]); Msg(attacker, "Lбbon lőtted, ezйrt megsebesьlt."); AnimbaRak(playerid, false); PlayerInfo[playerid][pLoves] = UnixTime+300; PlayerInfo[playerid][pEllatva] = true; LabTalalat[playerid] = 0; tformat(128, "%s lбbon lőtte őt: %s", PlayerName(attacker), PlayerName(playerid)); Log("Kill", _tmpString); if(!AdminDuty[attacker] && !Harcol[attacker] && !Paintballozik[attacker] && !Kikepzoben[attacker] && !Halal[attacker] && !ScripterDuty[attacker]) { PlayerInfo[attacker][pOlesIdo] +=K_OLES_IDO; tformat(128, "%s plusz kуrhбz jail ideje %d mбsodpercre nőtt (+"#K_OLES_IDO"mp)", PlayerName(attacker), PlayerInfo[attacker][pOlesIdo]); KillLog(_tmpString, 0); } } //SendFormatMessage(playerid, COLOR_WHITE, "[Debug] Lбbon lőttek, ez a %d. lбbtalбlatod", LabTalalat[playerid]); //SendFormatMessage(attacker, COLOR_WHITE, "[Debug] Lбbon lőtted, ez a %d. lбbtalбlata", LabTalalat[playerid]); } return 1; }
killerid = LastDamager[playerid];
reason = LastDamagerType[playerid];
LastDamager[playerid] = killerid;
LastDamagerType[playerid] = reason;
You should always check if killerid or issuerid is a valid player. If it's not a valid player, killerid and issuerid will be INVALID_PLAYER_ID (which is 0xFFFF, or 65536 - hence the array index out of bounds error at index 65536).
|
[debug] Attempted to read/write array element at index 65535 in array of size 201 [debug] AMX backtrace: [debug] #0 00251640 in public OnPlayerDeathACT (0, 65535, 54) from ClassRPG.amx [debug] #1 0002c4f8 in public OnPlayerDeath (0, 65535, 54)
I read about this before I opened the thread, but where do I have to check it exactly in my code, if it's a "suicide", for example the death caused by falling, or burning etc?
@Sunehildeep I changed it, and now I get these errors as well: Код:
[debug] Attempted to read/write array element at index 65535 in array of size 201 [debug] AMX backtrace: [debug] #0 00251640 in public OnPlayerDeathACT (0, 65535, 54) from ClassRPG.amx [debug] #1 0002c4f8 in public OnPlayerDeath (0, 65535, 54) |
At the beginning of your callback, before putting your own code.
|
fpublic OnPlayerDeath(playerid, killerid, reason) { if(killerid != INVALID_PLAYER_ID){ //All of my codes here } }
Do you mean like this?:
Код:
fpublic OnPlayerDeath(playerid, killerid, reason) { if(killerid != INVALID_PLAYER_ID){ //All of my codes here } } |
public OnPlayerDeath(playerid, killerid, reason)
{
if(killerid == INVALID_PLAYER_ID)
return 1;
// Your code...
}