loading coordinate from txt file - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: loading coordinate from txt file (
/showthread.php?tid=509944)
loading coordinate from txt file -
carl0o0s - 28.04.2014
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 ?
Re: loading coordinate from txt file -
Vince - 28.04.2014
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}