18.04.2014, 00:23
Hello dear samp members.. I need your help once again.. So here is my problem.
ERROR:
Code:
I think error is over here:
ERROR:
pawn Код:
[01:31:56] [debug] AMX backtrace:
[01:31:56] [debug] #0 000426f8 in public GlobalTimer () from bhas.amx
[01:31:57] [debug] Run time error 4: "Array index out of bounds"
pawn Код:
forward GlobalTimer();
public GlobalTimer()
{
new Year, Month, Day,string[64];
getdate(Year, Month, Day);
for(new id = 0; id <= MAX_HOUSE;id++)
{
format(string,64,House_File,id);
if(House[id][DayEnter]+MAX_DAYS <= Day && House[id][On_Sell] == 0)
{
if(fexist(string))
{
//If month have 31 days
if(House[id][MonthEnter] == 1 || House[id][MonthEnter] == 3 || House[id][MonthEnter] == 5 || House[id][MonthEnter] == 7 || House[id][MonthEnter] == 8 || House[id][MonthEnter] == 10 || House[id][MonthEnter] == 12)
{
if(House[id][DayEnter]+MAX_DAYS > 31)
{
new newday = (31-House[id][DayEnter]);
new newday1 = MAX_DAYS-newday;
if(newday1 != Day) return 1;
}
}
//If month have 30 days
if(House[id][MonthEnter] == 4 || House[id][MonthEnter] == 6 || House[id][MonthEnter] == 9 || House[id][MonthEnter] == 11)
{
if(House[id][DayEnter]+MAX_DAYS > 30)
{
new newday = (30-House[id][DayEnter]);
new newday1 = MAX_DAYS-newday;
if(newday1 != Day) return 1;
}
}
//If month have 29 days
if(House[id][MonthEnter] == 2)
{
if(House[id][DayEnter]+MAX_DAYS > 29)
{
new newday = (29-House[id][DayEnter]);
new newday1 = MAX_DAYS-newday;
if(newday1 != Day) return 1;
}
}
ResetPlayerHouseID(House[id][Owner]);
House[id][On_Sell] = 1;
format(House[id][Owner],48,"Apartment");
CheckHouse(id);
DestroyDynamicPickup(House[id][PickupU]);
House[id][PickupU] = CreateDynamicPickup(1273, 23, House[id][EnterX],House[id][EnterY],House[id][EnterZ],-1,-1,-1,100.0);
DestroyDynamicMapIcon(House[id][Icon]);
House[id][Icon] = CreateDynamicMapIcon(House[id][EnterX],House[id][EnterY],House[id][EnterZ], 31, 0, -1, -1, -1, 100.0);
format(string,sizeof(string),"{29CC3F}Owner: "COL_WHITE"Apartment\n{29CC3F}House Name: "COL_WHITE"%s\n{29CC3F}Price: "COL_WHITE"%d\n{29CC3F}Level: "COL_WHITE"%d\n{29CC3F}Address: "COL_WHITE"%s\n (/buyhouse)",House[id][HouseName],House[id][Price],House[id][Level],House[id][Address]);
UpdateDynamic3DTextLabelText(House[id][DLabel],-1,string);
printf("House ID %d has been unowned",id);
}
}
}
foreach(Player, i)
{
//===Bills===
if(PlayerInfo[i][Houseid] != 999)
{
PlayerInfo[i][Sec]++;
if(PlayerInfo[i][Sec] >= 60) {PlayerInfo[i][Sec] = 0; PlayerInfo[i][Min]++;}
if(PlayerInfo[i][Min] == 60)
{
PlayerInfo[i][Min] = 0;
new money = randomEx(50,150);
SendFormatMSG(i,-1,"You pay for house bills {13AD32}$%d",money);
GivePlayerMoney(i,-money);
}
}
//Phone
if(Calling[i] > 0)
{
Calling[i]--;
if(Calling[i] == 0) {SCM(i,-1,"There is no answer.");}
}
if(PlayerInfo[i][RobHouse] > 0) PlayerInfo[i][RobHouse]--;
}
return 1;
}
pawn Код:
stock ResetPlayerHouseID(playerid)
{
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"PlayerData");
INI_WriteInt(File, "HouseID", 999);
INI_Close(File);
}
Before it was:
stock ResetPlayerHouseID(name[])