#RediSka
Ученик
Всем привет, подскажите, в чем ошибка?
Код:
[14:20:13] [debug] Run time error 4: "Array index out of bounds"
[14:20:13] [debug] Accessing element at index 65535 past array upper bound 99
[14:20:13] [debug] AMX backtrace:
[14:20:13] [debug] #0 002239ac in public OnPlayerWeaponShot (0, 24, 0, 65535, 1153465084, -992840646, 1083998208) from new.amx
[14:20:14] [debug] Run time error 4: "Array index out of bounds"
[14:20:14] [debug] Accessing element at index 65535 past array upper bound 99
[14:20:14] [debug] AMX backtrace:
[14:20:14] [debug] #0 002239ac in public OnPlayerWeaponShot (0, 24, 0, 65535, 1153471695, -992837104, 1083998208) from new.amx
[14:20:15] [debug] Run time error 4: "Array index out of bounds"
[14:20:15] [debug] Accessing element at index 65535 past array upper bound 99
[14:20:15] [debug] AMX backtrace:
[14:20:15] [debug] #0 002239ac in public OnPlayerWeaponShot (0, 24, 0, 65535, 1153472669, -992836722, 1083998208) from new.amx
[14:20:17] [debug] Run time error 4: "Array index out of bounds"
[14:20:17] [debug] Accessing element at index 243 past array upper bound 99
[14:20:17] [debug] AMX backtrace:
[14:20:17] [debug] #0 002239ac in public OnPlayerWeaponShot (0, 25, 2, 243, -1080561664, 1076758528, 1050839120) from new.amx
Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == 2 && hitid == 364 || hitid == 365 || hitid == 366 || hitid == 367) return 0;
new objecta = deer[0], killed_deer = GetPVarInt(playerid, !"killed_deer");
new objecta1 = deer[1];
new objecta2 = deer[2];
new objecta3 = deer[3];
new objecta4 = deer[4];
new objecta5 = deer[5];
new objecta6 = deer[6];
new objecta7 = deer[7];
new objecta8 = deer[8];
if(hittype == BULLET_HIT_TYPE_PLAYER_OBJECT && hitid == objecta || hitid == objecta1 || hitid == objecta2 || hitid == objecta3 || hitid == objecta4 || hitid == objecta5 || hitid == objecta6 || hitid == objecta7 || hitid == objecta8)
{
if(hitid == objecta)
{
DestroyPlayerObject(playerid, objecta);
}
if(hitid == objecta1)
{
DestroyPlayerObject(playerid, objecta1);
}
if(hitid == objecta2)
{
DestroyPlayerObject(playerid, objecta2);
}
if(hitid == objecta3)
{
DestroyPlayerObject(playerid, objecta3);
}
if(hitid == objecta4)
{
DestroyPlayerObject(playerid, objecta4);
}
if(hitid == objecta5)
{
DestroyPlayerObject(playerid, objecta5);
}
if(hitid == objecta6)
{
DestroyPlayerObject(playerid, objecta6);
}
if(hitid == objecta7)
{
DestroyPlayerObject(playerid, objecta7);
}
if(hitid == objecta8)
{
DestroyPlayerObject(playerid, objecta8);
}
SetPVarInt(playerid, !"killed_deer", killed_deer +1);
if(killed_deer == 10)
{
ShowPlayerDialog(playerid,D_NULL, DIALOG_STYLE_MSGBOX,!"",!"{AFAFAF}Âû óæå äîñòàòî÷íî ïîóáèâàëè îëåíåé,\
òåïåðü Âû ìîæåòå ïðîäàòü èõ òóøó íà ÷åðíîì ðûíêå (/gps)! ",!"Çàêðûòü",!"");
}
}
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
//Desync weapon IDs that don't fire bullets
if (weaponid < 22 || weaponid > 38) return 0;
//Desync shots with Z pos out of bounds
if(!(-20000.0 <= z <= 20000.0)) return 0;
if(hittype == BULLET_HIT_TYPE_NONE)
{
if(hitid != 65535) return 1;
}
else if(hittype == BULLET_HIT_TYPE_PLAYER)
{
if(BadFloat(fX) || BadFloat(fY) || BadFloat(fZ)) return 0;
if(hitid == INVALID_PLAYER_ID) return 0;
else if(IsAnDMZone(playerid))
{
if(GetPVarInt(playerid, "antidm") <= 2)
{
ShowPlayerDialog(playerid, 0, DIALOG_STYLE_MSGBOX, "", "{ff9900} çåë¸íîé çîíå íåëüçÿ äðàòüñÿ!\nÅñëè Âû ïðîäîëæèòå, òî áóäåòå êèêíóòû", "Çàêðûòü", "");
SetPVarInt(playerid,"antidm", GetPVarInt(playerid,"antidm") + 1);
return 0;
}
if(GetPVarInt(playerid, "antidm") == 3)
{
ResetPlayerWeapons(playerid);
SetPVarInt(playerid, "antidm", 0);
SKick(playerid,6745);
return 0;
}
}
}
if(!IsPlayerNPC(playerid)&&GetPVarInt(playerid,"FP_Protection")==1)
{
FP_Ammo_Reloading[playerid][0] = GetPlayerAmmo(playerid);
if(FP_Ammo_Reloading[playerid][0] == FP_Ammo_Reloading[playerid][1])
{
switch(GetPlayerWeapon(playerid))
{
case 0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,40,44,45,46:
{
FP_Ammo_Reloading[playerid][1] = FP_Ammo_Reloading[playerid][0];
FP_Player_Warns_Ammo_Reloading[playerid] = 0;
return 1;
}
}
FP_Player_Warns_Ammo_Reloading[playerid]++;
if(FP_Player_Warns_Ammo_Reloading[playerid] > 5)
{
new string[128];
format(string, 128, "[A] %s[%d] êèêíóò çà èñïîëüçîâàíèå áåñêîíå÷íûõ ïàòðîíîâ", GetName(playerid), playerid);
SendAdminMessage(0xff4f00ff, string);
Log("CheatLog",string);
SendClientMessage(playerid,COLOR_RED,"Âû áûëè êèêíóòû çà èñïîëüçîâàíèå áåñêîíå÷íûõ ïàòðîíîâ!");
Kick(playerid);
}
}
else
{
FP_Ammo_Reloading[playerid][1] = FP_Ammo_Reloading[playerid][0];
FP_Player_Warns_Ammo_Reloading[playerid] = 0;
}
}
if(weaponid != 38)
{
if((gettime() - shotTime[playerid]) < 1) shot[playerid] += 1;
else shot[playerid] = 0;
if(shot[playerid] > 10) Kick(playerid);
shotTime[playerid] = gettime();
}
if(IsPlayerAFK(hitid)) return 0;
new block = 0, Float:Pos[6]; // áëîêèðóåì ôåéê óðîí
GetPlayerLastShotVectors(playerid, Pos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5]);
if(hittype != 0 && Pos[0] != 0.0 && Pos[1] != 0.0 && Pos[2] != 0.0 && GetPVarInt(playerid, "LastTimeShot_Advanced") == GetTickCount() && floatcmp(Pos[0], GetPVarFloat(playerid, "LastShotPosX")) == 0 && floatcmp(Pos[1], GetPVarFloat(playerid, "LastShotPosY")) == 0 && floatcmp(Pos[2], GetPVarFloat(playerid, "LastShotPosZ")) == 0) block = 1;
SetPVarInt(playerid, "LastTimeShot_Advanced", GetTickCount());
SetPVarFloat(playerid, "LastShotPosX", Pos[0]);
SetPVarFloat(playerid, "LastShotPosY", Pos[1]);
SetPVarFloat(playerid, "LastShotPosZ", Pos[2]);
if(block == 1) return 0;
return 1;
}
