18.06.2011, 15:37
I have tested that followin function crashes and it doesn't load succesfully.
Problem is that I just can't figure why that crashes!
So I need help with that.
Problem is that I just can't figure why that crashes!
So I need help with that.
pawn Код:
#define CORE_FOLDERS_FILESYSTEM ".ini"
#define CORE_FOLDER "kierolagm"
#define SETTING_FOLDER "settings"
#define SUB_FILE_jails "jails"
#define MAX_JAILS 99 // Max jails
#define FILESTRING_SIZE 276 // Filestring size
enum cellInfo
{
jalid,
jobject,
Float:cX,
Float:cY,
Float:cZ,
jairange,
Float:dooropenX,
Float:dooropenY,
Float:dooropenZ,
Float:doorcloseX,
Float:doorcloseY,
Float:doorcloseZ,
jailarea[65],
jailint,
jailobj
};
new pfile[225];
new celInfo[MAX_JAILS][cellInfo];
stock LoadAllJails()
{
new SplitDiv[14][MAX_JAILS];
new filestring[FILESTRING_SIZE];
format(pfile, sizeof(pfile), "%s/%s/%s%s", CORE_FOLDER, SETTING_FOLDER, SUB_FILE_jails, CORE_FOLDERS_FILESYSTEM);
new File: file = fopen(pfile, io_read);
for(new jailid = 0; jailid < MAX_JAILS; jailid++)
{
fread(file, filestring);
split(filestring, SplitDiv, ',');
celInfo[jailid][jalid] = strval(SplitDiv[0]);
celInfo[jailid][jobject] = strval(SplitDiv[1]);
celInfo[jailid][cX] = strval(SplitDiv[2]);
celInfo[jailid][cY] = strval(SplitDiv[3]);
celInfo[jailid][cZ] = strval(SplitDiv[4]);
celInfo[jailid][jairange] = strval(SplitDiv[5]);
celInfo[jailid][dooropenX] = strval(SplitDiv[6]);
celInfo[jailid][dooropenY] = strval(SplitDiv[7]);
celInfo[jailid][dooropenZ] = strval(SplitDiv[8]);
celInfo[jailid][doorcloseX] = strval(SplitDiv[9]);
celInfo[jailid][doorcloseY] = strval(SplitDiv[10]);
celInfo[jailid][doorcloseZ] = strval(SplitDiv[11]);
strmid(celInfo[jailid][jailarea], SplitDiv[12], 0, strlen(SplitDiv[12]), 255);
celInfo[jailid][jailint] = strval(SplitDiv[13]);
celInfo[jailid][jailobj] = CreateDynamicObject(celInfo[jailid][jobject], celInfo[jailid][doorcloseX], celInfo[jailid][doorcloseY], celInfo[jailid][doorcloseZ], 0.0000, 0.0000, 0.0000);
}
fclose(file);
}