[URGENT] Loading objects - not working
#1

I was told to use LoadStaticVehiclesFromFile and edit it to work with objects. It compiles but doesn't load my maps.

pawn Код:
stock LoadMap(filename[25+MAX_MAP_NAME])
{
    new File:file_ptr;
    new line[256];
    new var_from_line[64];
    new objecttype;
    new Float:SpawnX;
    new Float:SpawnY;
    new Float:SpawnZ;
    new Float:SpawnRotx;
    new Float:SpawnRoty;
    new Float:SpawnRotz;
    new index;
    new objects_loaded;

    file_ptr = fopen(filename,filemode:io_read);
    if(!file_ptr) return 0;

    objects_loaded = 0;

    while(fread(file_ptr,line,256) > 0)
    {
        index = 0;

        // Read type
        index = token_by_delim(line,var_from_line,',',index);
        if(index == (-1)) continue;
        objecttype = strval(var_from_line);
        /*if(objecttype < 400 || objecttype > 611)*/
        //continue;

        // Read X, Y, Z, Rotation
        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnX = floatstr(var_from_line);

        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnY = floatstr(var_from_line);

        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnZ = floatstr(var_from_line);

        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnRotx = floatstr(var_from_line);

        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnRoty = floatstr(var_from_line);

      index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        SpawnRotz = floatstr(var_from_line);

        Object[objects_loaded][Model] = objecttype;
        Object[objects_loaded][ox] = SpawnX;
        Object[objects_loaded][oy] = SpawnY;
        Object[objects_loaded][oz] = SpawnZ;
        Object[objects_loaded][rx] = SpawnRotx;
        Object[objects_loaded][ry] = SpawnRoty;
        Object[objects_loaded][rz] = SpawnRotz;
        CreateObject(objecttype,SpawnX,SpawnY,SpawnZ,SpawnRotx,SpawnRoty,SpawnRotz);
        printf("Object loaded: %d %f %f %f %f %f %d",objecttype,SpawnX,SpawnY,SpawnZ,SpawnRotx,SpawnRoty,SpawnRotz);
        objects_loaded++;
       
    }

    fclose(file_ptr);
    MapOpen = 1;
    return objects_loaded;
}
MapFile
pawn Код:
7371, -2020.00390625, 305.06219482422, 33.787109375, 0.000000, 0.000000, 341.13513183594
3475, -2016.0482177734, 319.31298828125, 36.141784667969, 0.000000, 0.000000, 0.000000
3475, -2016.0572509766, 324.97564697266, 36.141784667969, 0.000000, 0.000000, 0.000000
3475, -2016.1296386719, 330.11825561523, 36.198028564453, 0.000000, 0.000000, 0.000000
3475, -2059.7841796875, 198.41738891602, 36.208934783936, 0.000000, 0.000000, 73.759979248047
3475, -2065.4624023438, 199.27235412598, 36.230396270752, 0.000000, 0.000000, 89.636657714844
3475, -2070.8662109375, 197.84635925293, 36.211452484131, 0.000000, 0.000000, 119.40686035156
7371, -2075.9643554688, 184.34643554688, 33.834949493408, 0.000000, 0.000000, 347.0859375
7191, -2101.1481933594, 99.434417724609, 36.294990539551, 0.000000, 0.000000, 270.74011230469
7191, -2101.7346191406, 99.402687072754, 36.884784698486, 0.000000, 0.000000, 270.73608398438
7191, -2166.0366210938, 93.187728881836, 36.146553039551, 0.000000, 0.000000, 270.73608398438
7191, -2170.7880859375, 103.64715576172, 36.294990539551, 0.000000, 0.000000, 163.09631347656
7191, -2159.251953125, 209.27984619141, 36.146553039551, 0.000000, 0.000000, 177.03637695313
10245, -2156.2209472656, 228.83724975586, 40.679206848145, 0.000000, 0.000000, 135.51989746094
2960, -2157.0883789063, 249.81546020508, 45.852767944336, 0.000000, 0.000000, 87.684906005859
2960, -2157.0986328125, 249.74070739746, 46.280532836914, 0.000000, 0.000000, 87.681884765625
2960, -2157.1110839844, 249.65649414063, 46.704933166504, 0.000000, 0.000000, 87.681884765625
10245, -2155.9099121094, 214.11436462402, 32.6640625, 0.000000, 0.000000, 135.5163269043
7371, -2164.3139648438, 325.03704833984, 34.171875, 0.000000, 0.000000, 341.13098144531
7371, -2138.9006347656, 339.81506347656, 34.171875, 0.000000, 0.000000, 267.37121582031
3475, -2018.5228271484, 334.98629760742, 36.223030090332, 0.000000, 0.000000, 53.819976806641
3475, -2023.2406005859, 338.39987182617, 36.248031616211, 0.000000, 0.000000, 53.816528320313
3929, -2056.5024414063, 205.89646911621, 35.15966796875, 0.000000, 0.000000, 0.000000
744, -2057.2412109375, 196.25923156738, 33.398399353027, 0.000000, 0.000000, 0.000000
744, -2057.7517089844, 193.57696533203, 33.133075714111, 0.000000, 0.000000, 0.000000
Format : Modelid, X, Y, Z, rX, rY, rZ

Any help is appreciated.
Reply
#2

Please anyone?
Reply
#3

How about a streamer? I think it should work fine then, atleast it did for me.

Reply
#4

Did you read? This is for a map editor....
Reply
#5

How you mean for map editor? I don't see it anywhere :S

Reply
#6

Oh sorry, lol. Left that out in the first post. This is for my planned project 'Awa-Map'. It is a map editor and this is a key feature that unfortinately doesn't work. So I need desperate help with it.

Awaran -
Reply
#7

Please anyone?
Reply
#8

Okay this is annoying. Can someone atleast help me a little with this?

Reply
#9

most people dont make map editors unless there highly advanced in scripting that kind of script so you wont get much help
Reply
#10

Quote:
Originally Posted by FS}Nameless [LDR
]
most people dont make map editors unless there highly advanced in scripting that kind of script so you wont get much help
This is a 'project' to get me into more advanced scripting. So the "Advanced Scripters" of this forum do not want to help me? Lovely.

If anyone would like to help me, much appreciation is well deserved for you.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)