06.09.2012, 15:19
Well, I'm working another include, GObject, It's gonna be basically loading objects from a file in scriptfiles.
Now here's the problem:
^^ That's my stock, And I'm doing this under OnGameModeInIt:
I've tried BOTH ways,
This is my Objects/Objects.txt :
7997,1989.07336426,-2852.01586914,0.00000000,0.00000000,0.00000000,0.0 0000000
7997,2120.59130859,-2842.74047852,0.00000000,0.00000000,0.00000000,180 .00000000
I've already tried the other way too
CreateObject(7997,1989.07336426,-2852.01586914,0.00000000,0.00000000,0.00000000,0.0 0000000);
And it does nothing, Nothing at all.
Now here's the problem:
pawn Код:
stock LoadObjectsFromFile(filename[])
{
new File:file = fopen(filename, io_read);
new string[120];
if (!file)
{
format(string, sizeof(string), "[GObject] COuldn't load objects from file '%s' ", filename);
printf(string);
return 0;
}
else
{
new line[128], count, modelid, Float:X, Float:Y, Float:Z,Float:rX, Float:rY, Float:rZ;
while (fread(file, line))
{
if (!sscanf(line, "iffffff", modelid, X, Y, Z, rX, rY, rZ))
{
CreateObject(modelid, X, Y, Z, rX, rY, rZ);
count++;
format(string, sizeof(string), "[GObjects] Loaded %d objects from file '%s'", count, filename);
printf(string);
fclose(file);
}
}
}
return 1;
}
pawn Код:
public OnGameModeInit()
{
// Don't use these lines if it's a filterscript
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
LoadObjectsFromFile("Objects/Objects.txt");
return 1;
}
This is my Objects/Objects.txt :
7997,1989.07336426,-2852.01586914,0.00000000,0.00000000,0.00000000,0.0 0000000
7997,2120.59130859,-2842.74047852,0.00000000,0.00000000,0.00000000,180 .00000000
I've already tried the other way too
CreateObject(7997,1989.07336426,-2852.01586914,0.00000000,0.00000000,0.00000000,0.0 0000000);
And it does nothing, Nothing at all.