[help] load pikcups and objects from file
#1

i want load pickups from file in command, in taht way, in file:
"pickup %d %d %f %f %f" or "CreatePickup(...."
Reply
#2

I'm not sure it works. However, try it... it looks to me.

First, put this ontop of your GM.
pawn Код:
forward LoadPickUps();
Now, you can put this under forward LoadPickUps();
pawn Код:
enum puInfo
{
    puModel,
    puType,
    Float:puCoordX,
    Float:puCoordY,
    Float:puCoordZ,
    puVirtualW,
};
new PickUpInfo[MAX_PLAYERS][puInfo];
And now go to your scriptfiles, open a new text tile with the name pickups.txt
after that put this function where ever you want on your GM
pawn Код:
public LoadPickUps()
{
    new Coords[30][128];
    new string[256];
    new File: file = fopen("pickups.txt", io_read);
    if(file)
    {
        new idx;
        while (idx < sizeof(PickUpInfo))
        {
            fread(file, string);
            split(string, Coords, ',');
            PickUpInfo[idx][puModel] = floatstr(Coords[0]);
            PickUpInfo[idx][puType] = floatstr(Coords[1]);
            PickUpInfo[idx][puCoordX] = floatstr(Coords[2]);
            PickUpInfo[idx][puCoordY] = floatstr(Coords[3]);
            PickUpInfo[idx][puCoordZ] = floatstr(Coords[4]);
            PickUpInfo[idx][puVirtualW] = floatstr(Coords[5]);
            idx++;
        }
        fclose(file);
    }
    return 1;
}
after you did all this, go to your OnGameModeInit()
and put under it this:
pawn Код:
LoadPickUps();
then under it:
pawn Код:
for(new p = 0; p < sizeof(PickUpInfo); p++)
{
    CreatePickup(PickUpInfo[p][puModel], PickUpInfo[p][puType], PickUpInfo[p][puCoordX], HouseInfo[p][puCoordY], HouseInfo[p][puCoordZ], PickUpInfo[p][puVirtualW]);
}
now, go to your text file (pickups.txt)
and it works like that
1241, 2, 1503.3359, 1432.3585, 10.1191, -1
1242, 1, 1503.3359, 1432.3585, 10.1191, 0
1245, 3, 1503.3359, 1432.3585, 10.1191, 0

each one is pickup, you need to modify each one them,
Not tested, I guess it needs to work...

it looks good to me, test it and tell me, for help talk to me
Reply
#3

sorry for discussion reporter but i want know something, @Toreno did you know how to do that with dini ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)