if(!fexist(DOORS_FILE))
{
print("NO DOOR FILE! CREATING A NEW ONE!");
fcreate(DOORS_FILE);
return 1;
}
else
{
for(new d=0;d<MAX_DOORS;d++)
{
new string[128];
format(string, sizeof(string),"Door_%d",d);
if(djIsSet(DOORS_FILE, string))
{
LoadDoor(d);
return 1;
}
return 1;
}
}
public LoadDoor(id)
{
new string2[128], name[128];
DestroyDynamicPickup(DoorInfo[id][dPp]);
format(string2, sizeof(string2),"Door_%d/ExteriorX", id); DoorInfo[id][dExteriorX] = djFloat(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/ExteriorY", id); DoorInfo[id][dExteriorY] = djFloat(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/ExteriorZ", id); DoorInfo[id][dExteriorZ] = djFloat(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/ExteriorInt", id); DoorInfo[id][dExteriorInt] = djInt(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/InteriorX", id); DoorInfo[id][dInteriorX] = djFloat(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/InteriorY", id); DoorInfo[id][dInteriorY] = djFloat(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/InteriorZ", id); DoorInfo[id][dInteriorZ] = djFloat(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/InteriorInt", id); DoorInfo[id][dInteriorInt] = djInt(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/Type", id); DoorInfo[id][dType] = djInt(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/Team", id); DoorInfo[id][dTeam] = djInt(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/Owned", id); DoorInfo[id][dOwned] = djInt(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/Owner", id); format(name, sizeof(name), "%s", dj(DOORS_FILE, string2)); DoorInfo[id][dOwner] = name;
format(string2, sizeof(string2),"Door_%d/Locked", id); DoorInfo[id][dLocked] = djInt(DOORS_FILE, string2);
format(string2, sizeof(string2),"Door_%d/Name", id); format(name, sizeof(name), "%s", dj(DOORS_FILE, string2)); DoorInfo[id][dName] = name;
Itter_Add(Doors, Iter_Count(Doors) + 1);
DoorInfo[id][dPp] = CreateDynamicPickup(1239, 2, DoorInfo[id][dExteriorX], DoorInfo[id][dExteriorY], DoorInfo[id][dExteriorZ], -1, DoorInfo[id][dExteriorInt], -1, 50.0);
if(DoorInfo[id][dType] == 1)
{
DoorInfo[id][dLocked] = 0;
return 1;
}
else if(DoorInfo[id][dType] == 2)
{
DoorInfo[id][dLocked] = 1;
return 1;
}
return 1;
}
if(!fexist(DOORS_FILE))
{
print("NO DOOR FILE! CREATING A NEW ONE!");
fcreate(DOORS_FILE);
return 1;
}
else
{
for(new d=0;d<MAX_DOORS;d++)
{
new string[128];
format(string, sizeof(string),"Door_%d",d);
if(djIsSet(DOORS_FILE, string))
{
LoadDoor(d);
return 1;
}
return 1;
}
}
Add printf("LINE NUMBER HERE");
Every few lines to find out at which line exactly it stops working. If you know that, you will see the problem easily most of the times. Things that can cause the callback to stop and do not crash the server can be wrong array indexes. You are using a lot of arrays in that function, might be worth to give it a look. |