Save - Load Objects - [FILES]
#1

In all good development of Awa-Map. I am working on a feature that you can save a map. And it will save it in a format that the server can load and apply to the server when a player comes and loads that map.

Can I please get some suggestions on how to do this?

You will get credits if you are the person who helped me get this feature working 100% - bug free
Reply
#2

Here's the grandlarc example with vehicles

pawn Code:
LoadStaticVehiclesFromFile(const filename[])
{
    new File:file_ptr;
    new line[256];
    new var_from_line[64];
    new vehicletype;
    new Float:SpawnX;
    new Float:SpawnY;
    new Float:SpawnZ;
    new Float:SpawnRot;
  new Color1, Color2;
    new index;
    new vehicles_loaded;

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

    vehicles_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;
        vehicletype = strval(var_from_line);
        if(vehicletype < 400 || vehicletype > 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;
        SpawnRot = floatstr(var_from_line);

        // Read Color1, Color2
        index = token_by_delim(line,var_from_line,',',index+1);
        if(index == (-1)) continue;
        Color1 = strval(var_from_line);

        index = token_by_delim(line,var_from_line,';',index+1);
        Color2 = strval(var_from_line);

        //printf("%d,%d,%f,%f,%f,%f,%d,%d",total_vehicles_from_files+vehicles_loaded+1,vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2);

        AddStaticVehicleEx(vehicletype,SpawnX,SpawnY,SpawnZ,SpawnRot,Color1,Color2,(30*60)); // respawn 30 minutes
        vehicles_loaded++;
    }

    fclose(file_ptr);
    printf("Loaded %d vehicles from: %s",vehicles_loaded,filename);
    return vehicles_loaded;
}
Reply
#3

Quote:
Originally Posted by {Awaran};
In all good development of Awa-Map. I am working on a feature that you can save a map. And it will save it in a format that the server can load and apply to the server when a player comes and loads that map.

Can I please get some suggestions on how to do this?

You will get credits if you are the person who helped me get this feature working 100% - bug free
get 100 % bug free?Sorry but it's not possible . Every game mode lacks somewhere.
Reply
#4

Any one know the lowest modelid and the highest modelid for objects?
Reply
#5

Quote:
Originally Posted by Seif_
Quote:
Originally Posted by {Awaran};
Any one know the lowest modelid and the highest modelid for objects?
Look through the MEd.
MEd? lol.
Reply
#6

Didn't help me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)