07.12.2014, 20:43
It' not loading The objects from the file, (just does not work)
please help me ?
please help me ?
PHP код:
stock LoadObjectsFromFile(const filename[])
{
new
File:file = fopen(filename, io_read);
if (!file) return 0;
TotalObjects = 0;
new
line[100],
modelid,
Float:Pos[6],
index,
var_from_line[128];
while (fread(file, line))
{
index = 0;
index = token_by_delim(line,var_from_line,',',index);
if(index == (-1)) continue;
Pos[0] = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Pos[1] = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Pos[2] = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Pos[3] = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Pos[4] = floatstr(var_from_line);
index = token_by_delim(line,var_from_line,',',index+1);
if(index == (-1)) continue;
Pos[5] = strval(var_from_line);
ActivityObject[TotalObjects] = CreateDynamicObject(modelid, Pos[0], Pos[1], Pos[2], Pos[3], Pos[4], Pos[5], ActivityInfo[ActivityNumber][a_VirtualWorld], ActivityInfo[ActivityNumber][a_Interior]);
TotalObjects++;
}
fclose(file);
return printf("Objects Loaded: %d", TotalObjects);
}