22.04.2017, 09:00
[16:36:16] [debug] Run time error 4: "Array index out of bounds"
[16:36:16] [debug] Accessing element at negative index -22
[16:36:16] [debug] AMX backtrace:
[16:36:16] [debug] #0 00044898 in public OnPlayerWeaponShot (18, 0, 1, 13, 1047715840, 1053569024, 1046319104) from cnr.amx
[16:36:16] [debug] Accessing element at negative index -22
[16:36:16] [debug] AMX backtrace:
[16:36:16] [debug] #0 00044898 in public OnPlayerWeaponShot (18, 0, 1, 13, 1047715840, 1053569024, 1046319104) from cnr.amx
PHP код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
if(hittype == BULLET_HIT_TYPE_PLAYER)
{
if(!IsPlayerConnected(hitid))
return 1;
if(IsPlayerLeo(playerid))
{
if(!pData[playerid][Event])
{
if(IsPlayerLeo(hitid))
return GameTextForPlayer(playerid, "Don't shoot your teammates", 3000, 3), 0;
if(!GetPlayerWantedLevel(hitid))
return GameTextForPlayer(playerid, "Don't shoot innocent player", 3000, 3), 0;
}
}
}
if(hittype == BULLET_HIT_TYPE_VEHICLE)
{
if(IsPlayerLeo(playerid))
{
foreach(new i : Player)
{
if(IsPlayerInVehicle(i, hitid) && i != playerid && IsPlayerLeo(i) && !GetPlayerVehicleSeat(i))
return GameTextForPlayer(playerid, "Don't shoot your teammates vehicle", 3000, 3), 0;
}
}
else
{
foreach(new i : Player)
{
if(IsPlayerInVehicle(i, hitid) && i != playerid && IsPlayerLeo(i) && !GetPlayerVehicleSeat(i))
{
pData[playerid][PoliceCarShot]++;
if(pData[playerid][PoliceCarShot] == 5)
UpdatePlayerWantedLevel(playerid, 6);
break;
}
}
}
}
return 1;
}