loading coordinate from txt file
#1

so in gm i normaly added like this

Код:
new Float: RandomCP[][] =
{
	{-1312.9222,1041.6000,1038.2629},
	{-1303.1730,1035.1603,1038.1464}
};

but i have lots of coordinate . so i want to new Float: RandomCP[][] read from txt file . how to do it ?

Код:
    io=0;
    file=fopen("RandomCP.txt",io_read);
    while(ftw)
    {
        new string[200];
        fread(file, string);
        new  Float:x, Float:y, Float:z;
        sscanf(string, "fff", x, y, z);
        io++;
        fclose(file);
    }
i don know how new Float: RandomCP[][] can read it ?
Reply
#2

Unless you actually plan to alter and reload those values during runtime, there really isn't any use doing that. You could get away doing:
pawn Код:
new Float: RandomCP[][] =
{
    #include "../src/checkpoints.pwn"
};
Код:
// checkpoints.pwn
{-1312.9222,1041.6000,1038.2629},
{-1303.1730,1035.1603,1038.1464}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)