02.02.2016, 11:06
Hallo Guys I have problem with "Array index out of bounds" I don't know how to repair this problem.
My Server_log:
And to my public function:
public OnPlayerTakeDamage
public TimerCoSekunde
Please help me with this a problem. I give REP ++
My Server_log:
PHP Code:
[12:59:30] [debug] Run time error 4: "Array index out of bounds"
[12:59:30] [debug] Accessing element at negative index -1
[12:59:30] [debug] AMX backtrace:
[12:59:30] [debug] #0 00025cc8 in ?? (0) from gamemode.amx
[12:59:30] [debug] #1 0004cb28 in public OnPlayerTakeDamage (0, 65535, 1079194420, 54, 3) from gamemode.amx
[12:59:30] [debug] Run time error 4: "Array index out of bounds"
[12:59:30] [debug] Accessing element at negative index -1
[12:59:30] [debug] AMX backtrace:
[12:59:30] [debug] #0 00025cc8 in ?? (0) from gamemode.amx
[12:59:30] [debug] #1 000f5790 in public TimerCoSekunde () from gamemode.amx
[12:59:31] [debug] Run time error 4: "Array index out of bounds"
[12:59:31] [debug] Accessing element at negative index -1
[12:59:31] [debug] AMX backtrace:
[12:59:31] [debug] #0 00025cc8 in ?? (0) from gamemode.amx
[12:59:31] [debug] #1 000f5790 in public TimerCoSekunde () from gamemode.amx
[12:59:32] [cmdl][adm] Ryan Conin: /bw
[12:59:32] [debug] Run time error 4: "Array index out of bounds"
[12:59:32] [debug] Accessing element at negative index -1
[12:59:32] [debug] AMX backtrace:
[12:59:32] [debug] #0 00025cc8 in ?? (0) from gamemode.amx
[12:59:32] [debug] #1 000f5790 in public TimerCoSekunde () from gamemode.amx
[12:59:34] [debug] Run time error 4: "Array index out of bounds"
[12:59:34] [debug] Accessing element at negative index -1
[12:59:34] [debug] AMX backtrace:
[12:59:34] [debug] #0 00025cc8 in ?? (0) from gamemode.amx
[12:59:34] [debug] #1 000f5790 in public TimerCoSekunde () from gamemode.amx
[12:59:35] [debug] Run time error 4: "Array index out of bounds"
[12:59:35] [debug] Accessing element at negative index -1
[12:59:35] [debug] AMX backtrace:
[12:59:35] [debug] #0 00025cc8 in ?? (0) from gamemode.amx
[12:59:35] [debug] #1 000f5790 in public TimerCoSekunde () from gamemode.amx
public OnPlayerTakeDamage
PHP Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
new Float:armouranimka;
GetPlayerArmour(playerid, armouranimka);
if(amount>=0)
{
if(Zalogowany[playerid]==true)
{
Update3DTextLabelText(pNick[playerid], CLR_RED, pName(playerid));
SetTimerEx("TextDraw", 4000, 0, "u", playerid);
}
}
if(IsPlayerConnected(playerid) && PlayerInfo[playerid][pBW]>= 1)
{
dDodajHP(playerid,amount);
return 1;
}
new Float:health;
GetPlayerHealth(playerid,health);
if(weaponid==0&&PlayerInfo[issuerid][pGodziny]<2)
{
dDodajHP(playerid,amount);
format(String, sizeof(String), "~w~Nie zrobisz krzywdy ~r~%s~w~, poniewaz nie masz przegranych 2 godzin.",Nick(playerid));
InfoBox(issuerid,String,4000);
format(String, sizeof(String), "~r~%s~w~ nie zrobi Ci krzywdy, poniewaz jego postac nie ma 2 godzin online.",Nick(issuerid));
InfoBox(playerid,String,4000);//TD
return 1;
}
//Obrażenia
if(weaponid==1){dDodajHP(playerid,-2);}
if(weaponid==2){dDodajHP(playerid,-10);}
if(weaponid==3){dDodajHP(playerid,-15);}
if(weaponid==4){dDodajHP(playerid,-20);}
if(weaponid==5){dDodajHP(playerid,-15);}
if(weaponid==6){dDodajHP(playerid,-10);}
if(weaponid==7){dDodajHP(playerid,-10);}
if(weaponid==8){dDodajHP(playerid,-25);}
if(weaponid==22){dDodajHP(playerid,-17);}
if(weaponid==23){dDodajHP(playerid,-15);}
if(weaponid==24){dDodajHP(playerid,-25);}
if(weaponid==25){dDodajHP(playerid,-35);}
if(weaponid==26){dDodajHP(playerid,-30);}
if(weaponid==27){dDodajHP(playerid,-30);}
if(weaponid==28){dDodajHP(playerid,-13);}
if(weaponid==29){dDodajHP(playerid,-18);}
if(weaponid==30){dDodajHP(playerid,-25);}
if(weaponid==31){dDodajHP(playerid,-22);}
if(weaponid==32){dDodajHP(playerid,-13);}
if(weaponid==33){dDodajHP(playerid,-45);}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3100&&PlayerInfo[issuerid][pSila] <= 3199){dDodajHP(playerid,-1);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3200&&PlayerInfo[issuerid][pSila] <= 3299){dDodajHP(playerid,-2);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3300&&PlayerInfo[issuerid][pSila] <= 3399){dDodajHP(playerid,-4);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3400&&PlayerInfo[issuerid][pSila] <= 3499){dDodajHP(playerid,-6);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3500&&PlayerInfo[issuerid][pSila] <= 3599){dDodajHP(playerid,-7);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3600&&PlayerInfo[issuerid][pSila] <= 3699){dDodajHP(playerid,-8);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3700&&PlayerInfo[issuerid][pSila] <= 3799){dDodajHP(playerid,-11);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3800&&PlayerInfo[issuerid][pSila] <= 3899){dDodajHP(playerid,-14);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 3900&&PlayerInfo[issuerid][pSila] <= 3999){dDodajHP(playerid,-17);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4000&&PlayerInfo[issuerid][pSila] <= 4099){dDodajHP(playerid,-19);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4100&&PlayerInfo[issuerid][pSila] <= 4199){dDodajHP(playerid,-19);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4200&&PlayerInfo[issuerid][pSila] <= 4299){dDodajHP(playerid,-20);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4300&&PlayerInfo[issuerid][pSila] <= 4399){dDodajHP(playerid,-21);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4400&&PlayerInfo[issuerid][pSila] <= 4499){dDodajHP(playerid,-22);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4500&&PlayerInfo[issuerid][pSila] <= 4599){dDodajHP(playerid,-23);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4600&&PlayerInfo[issuerid][pSila] <= 4699){dDodajHP(playerid,-24);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4700&&PlayerInfo[issuerid][pSila] <= 4799){dDodajHP(playerid,-25);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4800&&PlayerInfo[issuerid][pSila] <= 4899){dDodajHP(playerid,-26);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 4900&&PlayerInfo[issuerid][pSila] <= 4999){dDodajHP(playerid,-27);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5000&&PlayerInfo[issuerid][pSila] <= 5099){dDodajHP(playerid,-28);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5100&&PlayerInfo[issuerid][pSila] <= 5199){dDodajHP(playerid,-29);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5200&&PlayerInfo[issuerid][pSila] <= 5299){dDodajHP(playerid,-30);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5300&&PlayerInfo[issuerid][pSila] <= 5399){dDodajHP(playerid,-31);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5400&&PlayerInfo[issuerid][pSila] <= 5499){dDodajHP(playerid,-32);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5500&&PlayerInfo[issuerid][pSila] <= 5599){dDodajHP(playerid,-32);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5600&&PlayerInfo[issuerid][pSila] <= 5699){dDodajHP(playerid,-33);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5700&&PlayerInfo[issuerid][pSila] <= 5799){dDodajHP(playerid,-34);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5800&&PlayerInfo[issuerid][pSila] <= 5899){dDodajHP(playerid,-35);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 5900&&PlayerInfo[issuerid][pSila] <= 5999){dDodajHP(playerid,-36);}}
if(weaponid==0){if(PlayerInfo[issuerid][pSila] >= 6000){dDodajHP(playerid,-37);}}
if(weaponid == 23)
{
if(Zalogowany[playerid])
{
if(GrupaTypPracownik(issuerid, 0)==-1) return 1;
dDodajHP(playerid,amount);
if(GetPVarInt(playerid, "AnimkaPostrzal") == 1) return 1;
if(!OdlegloscGracze(10.0, playerid, issuerid)) return 1;
SetTimerEx("tazer",20000, 0, "d", playerid);
PlayerPlaySound(playerid, 1190, 0.0, 0.0, 0.0);
SetTimerEx("TextDraw", 1500, 0, "u", playerid);
Unfreeze(playerid,20);
ApplyAnimation(playerid,"ped","KO_shot_stom",4.1,0,0,0,1,0);
format(String, sizeof(String), "~y~~h~Sparalizowales %s", NickA(playerid));
GameInfo(issuerid,String,5);
return 1;
}
}
if(weaponid >=20&&weaponid <=33)
{
if(issuerid != INVALID_PLAYER_ID && bodypart==BODY_PART_HEAD)
{
if(!OdlegloscGracze(35.0, playerid, issuerid)) return 1;
if(GetPVarInt(playerid, "AnimkaPostrzalGlowa") == 1) return 1;
ApplyAnimation(playerid,"ped","KO_shot_stom",4.1,0,0,0,1,0);
SetPVarInt(playerid, "AnimkaPostrzalGlowa", 1);
SetPVarInt(playerid, "AnimkaPostrzal", 1);
TextDrawShowForPlayer(playerid, Krew);
SetTimerEx("Postrzal", 40000, 0, "u", playerid);
SetTimerEx("TextDraw", 4000, 0, "u", playerid);
format(String, sizeof(String),"%s otrzymał pocisk w głowe z broni palnej. Z okolic głowy można dostrzec silne krwawienie.",NickA(playerid));
WyswietlText(playerid,KOLOR_DO,10.0,String);
//TextInfoDrzwi(playerid,"Twoj /opis ulegl ~r~zmianie ~w~- od teraz wyswietli sie tam informacja, ze ~r~otrzymales ~w~obrazenia w glowe.",9000);
return 1;
}
}
if(weaponid >=20&&weaponid <=33)
{
if(armouranimka <=19)
{
if(!OdlegloscGracze(20.0, playerid, issuerid)) return 1;
if(GetPVarInt(playerid, "AnimkaPostrzal") == 1) return 1;
if(GetPVarInt(playerid, "AnimkaPostrzalGlowa") == 1) return 1;
ApplyAnimation(playerid, "CRACK", "crckidle1",4.1,0,0,0,1,0);
SetPVarInt(playerid, "AnimkaPostrzal", 1);
TextDrawShowForPlayer(playerid, Krew);
SetTimerEx("Postrzal", 20000, 0, "u", playerid);
SetTimerEx("TextDraw", 4000, 0, "u", playerid);
return 1;
}else{
if(armouranimka >=19)
{
switch(random(2)+1)
{
case 1:
{
if(!OdlegloscGracze(20.0, playerid, issuerid)) return 1;
if(GetPVarInt(playerid, "AnimkaPostrzal") == 1) return 1;
ApplyAnimation(playerid, "CRACK", "crckidle1",4.1,0,0,0,1,0);
SetPVarInt(playerid, "AnimkaPostrzal", 1);
TextDrawShowForPlayer(playerid, Krew);
SetTimerEx("Postrzal", 20000, 0, "u", playerid);
SetTimerEx("TextDraw", 4000, 0, "u", playerid);
return 1;
}
case 2:
{
return TextInfoDrzwi(playerid,"Pocisk nie przebil kamizelki!",4500);
}
}
}
}
}
return 1;
}
PHP Code:
public TimerCoSekunde()
{
new h,m,s,Float:HP;
gettime(h,m,s);
Data();
if(h == 1 && m == 0 && s == 0)
{
format(String, sizeof(String), "[ Sesja %02d:%02d:%02d ] Maks. graczy: %02d/%d | Aktualna ilosc graczy: %02d/%d | Ilosc logowan: %d",Dzien,Miesiac,Rok,DayPlayers,MAX_PLAYERS, GraczeOnline(),MAX_PLAYERS, DayLogin);
SerwerLog(String);
DayLogin = 0;
DayPlayers = 0;
}
/////////////////////////////////////////////////
foreach(Player, i)
/////////////////////////////////////////////////////
if(h == 4 && m == 0)
{
SerwerLog("Godzina 4:00 - Restart maszyny.");
SetTimer("WykonajGMX",3000,false);
GameTextForAll("~w~Godzina ~r~4~n~~w~Restart ~r~serwera",4000,6);
}
for(new nr = 1; nr < LIMIT_POJAZDOW; nr++){
if(SamochodInfo[nr][sAktywny]==true&&VehSpawn[nr]==1)
{
GetVehicleDamageStatus(nr,SamochodInfo[nr][sUszkodzenia],SamochodInfo[nr][sUszkodzenia2],SamochodInfo[nr][sUszkodzenia3],SamochodInfo[nr][sUszkodzenia4]);
GetVehicleHealth(nr, HP);
SamochodInfo[nr][sHP]=HP;
ZapiszPojazd(nr);
}
}
if(m==0&&s==0)
{
format(String, sizeof(String), "** W oddali słychać bicie dzwonуw w ratuszu %d razy. **",h);
SendClientMessageToAll(KOLOR_DO, String);
for(new nr = 0; nr < LIMIT_OBIEKTOW; nr++)
{
if(BramaInfo[nr][bAktywny]==true && BramaInfo[nr][bObiekt] == 19473 && BramaInfo[nr][bN1] == 1)
{
BramaInfo[nr][bN2]++;
if(BramaInfo[nr][bN2] == 24)
{
DodajProdukt(9999,"Marihuana (1g)", "-", 6, 2, 0, 0, 5, 45, 21);
BramaInfo[nr][bN2]=0;
}
}
}
}
TextDrawSetString(Datowy, "~r~WindCity~w~ "wersja"");
TextDrawShowForAll(Datowy);
foreach(Player, i)
{
/*new string[64];
if(GetPVarInt(i, "Sluzba")==1)
{
format(string, sizeof(string), "Duty: %s", GrupaNazwa(i, 1));
TextDrawSetString(TextdrawDuty[i], string);
}
if(GetPVarInt(i, "Sluzba")==2)
{
format(string, sizeof(string), "Duty: %s", GrupaNazwa(i, 2));
TextDrawSetString(TextdrawDuty[i], string);
}
if(GetPVarInt(i, "Sluzba")==3)
{
format(string, sizeof(string), "Duty: %s", GrupaNazwa(i, 3));
TextDrawSetString(TextdrawDuty[i], string);
}*/
new vehicleid=GetPlayerVehicleID(i);
new vehid=GetPlayerVehicleID(i);
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
SetPlayerScore(i,Global[i][gGS]);
GetVehicleHealth(vehicleid, HP);
if(IsPlayerInAnyVehicle(i)&&GetPlayerState(i)==PLAYER_STATE_DRIVER){
Okupuje[i]=vehid;
Okupowany[vehid]=i;
}
//Ograniczenia(i);
if(Zalogowany[i]==true)
{
Update3DTextLabelText(pNick[i], CLR_NICK, pName(i));
}
for(new nr = 1; nr < LIMIT_POJAZDOW; nr++){
if(Okupowany[vehid]!=MAX_PLAYERS&&Okupuje[i]!=vehid)
{
Okupowany[vehid]=0;
}
if(engine==1&&HP<300)
{
SetVehicleHealth(vehicleid, 275.0);
}
}
if(PlayerInfo[i][pStamina]>100)
{
PlayerInfo[i][pStamina]=100;
}
if(GetPVarInt(i, "kondycja") > 20)
{
SetPVarInt(i, "kondycja", 0);
PlayerInfo[i][pKondycja]+=1;
}
// Anty Cheat System
// Anty money hack
// if(GetPlayerMoney(i)!=dKasa[i])
// {
// AC_BS_SetPlayerMoney(i);
// AC_BS_GivePlayerMoney(i,dKasa[i]);
// }
// Anty dodawanie HP
// Naliczanie przebiegu
if(GetPlayerState(i)==PLAYER_STATE_DRIVER)
{
VehID=GetPlayerVehicleID(i);
if(GetVehicleModel(VehID)==481||GetVehicleModel(VehID)==509||GetVehicleModel(VehID)==510) return TextDrawHideForPlayer(i, Licznik[i]);
if(engine)
{
if(GetPlayerSpeed(i) > 30){ VPrzebieg[VehID]+=0.012;}
GetVehiclePos(VehID,dOstatniX[i],dOstatniY[i],dOstatniZ[i]);
TextDrawHideForPlayer(i, Licznik[i]);
}
}
// Kajdanki - przyciąganie gracza
/*
// Przyspieszenie przy wylacoznym silniku
GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
if(IsPlayerInAnyVehicle(i) && !engine && GetPlayerSpeed(i)>=55)
{
format(String, sizeof(String),"Przyspieszenie przy wylaczonym silniku(%d km/h)(1h)",NickA(i),GetPlayerSpeed(i));
Kara(0,i,-1,"Przyspieszenie przy wylaczonym silniku",0);
return 1;
}*/
if(GetPVarInt(i, "grzyby")==1)
{
new Float:X, Float:Y, Float:Z, Float:Angle;
GetPlayerPos(i, X, Y, Z);
GetPlayerFacingAngle(i, Angle);
MovePlayerObject(i, halucynka1, X-4, Y, Z+1.5, 5, 0, 0, Angle+90);
halucynka2 = CreatePlayerObject(i, 18683, X-5, Y-3, Z+1.5, 0, 0, 0, 0);
dDodajHP(i,1);
}
if(GetPVarInt(i, "haj")==1)
{
SetPlayerDrunkLevel (i, 2200);
}
if(GetPVarInt(i, "koka")==1)
{
SetPlayerDrunkLevel (i, 2200);
}
if(GetPVarInt(i, "koka")>=5&&PlayerInfo[i][pUzaleznienie]<30 || GetPVarInt(i, "koka")>=15)
{
SetPVarInt(i, "koka", 0);
format(String, sizeof(String), "%s",Nick(i));
StworzZwloki(i,String);
format(String, sizeof(String),"** %s upada na ziemię po zażyciu narkotyku. U leżącego nie można wyczuć już funkcji życiowych. **",NickA(i));
WyswietlText(i,KOLOR_DO,12.0,String);
PlayerInfo[i][pKonto]=3;
ZapiszKonto(i);
SetTimerEx("Kara1", 1000, false, "i", i);
return 1;
}
if(GetPVarInt(i, "koka")>=3&&PlayerInfo[i][pUzaleznienie]<10)
{
SetPVarInt(i, "koka", 0);
ApplyAnimation(i,"CRACK","crckdeth2", 4.1, 0, 1, 1, 1, 0);
format(String, sizeof(String), "* %s upada nagle na ziemie zasłabiając.",NickA(i));
WyswietlText(i,KOLOR_JA,10.0,String);
PlayerInfo[i][pBW]=2;
TextInfoDrzwi(i, "~w~Twoja postac zaslabla.~n~Powodem bylo przedawkowanie ~y~kokainy~w~.~n~", 4500);
return 1;
}
if(GetPlayerWeapon(i)==26)
{
ResetPlayerWeapons(i);
}
if(wyciski[i] >49)
{
Info(i,"Trenining zakończony sukcesem.\nOtrzymujesz 10 punktow sily! Aby wstać z ławeczki wpisz /as.");
PlayerInfo[i][pSila]+=10;
ZapiszKonto(i);
SetTimerEx("LuxuriaOff",1, 0, "d", i);
wyciski[i]=0;
for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
{
TextDrawHideForPlayer(playerid, Doors[playerid]);
TextDrawHideForPlayer(playerid, Luxuria[playerid]);
}
Cwiczy[i]=0;
SetPVarInt(i, "mozesilke", 0);
RemovePlayerAttachedObject(i,6);
}
if(SluzbaADM[i]==1){
SluzbaBIZ[i]=0;
SluzbaORG[i]=0;
MaskaON[i]=0;
}
if(SluzbaBIZ[i]==1){
SluzbaADM[i]=0;
SluzbaORG[i]=0;
}
if(SluzbaORG[i]==1){
SluzbaADM[i]=0;
SluzbaBIZ[i]=0;
}
if(MaskaON[i]==1){
SluzbaADM[i]=0;
}
if(Global[i][gAJ]>0){
AC_BS_SetPlayerVirtualWorld(i, PlayerInfo[i][pUID]+150);
}
AFK[i]++;
if(GetVehicleModel(vehicleid)==481||GetVehicleModel(vehicleid)==509||GetVehicleModel(vehicleid)==510){
SetVehicleParamsEx(vehicleid,1,lights,alarm,doors,bonnet,boot,objective);
}
if(IsPlayerInAnyVehicle(i))
{
if(engine==1&&HP<325)
{
OstatniStatus[vehicleid]=325.0;
SamochodInfo[vehicleid][sHP]=325.0;
SetVehicleHealth(vehicleid, 325.0);
TextInfoDrzwi(i,"Silnik w pojezdzie gasnie ze wzgledu na zly stan pojazdu.",4500);
SetVehicleParamsEx(vehicleid,0,lights,alarm,doors,bonnet,boot,objective);
}
}
}
return 1;
}