using CreateObject function inside a loop
#4

I haven't used sscanf for more stuff than the usage on commands, but try something like this
pawn Код:
// --
    new i=0;
    new File:ftw=fopen("1.txt",io_read);
    while(ftw)
    {
        new string[200];
        fread(ftw, string);
        if(isnull(string)) return 1;
        new integ, Float:x, Float:y, Float:z, Float:rx, Float:ry, Float:rz;
        sscanf(string, "p<,>iffffff", integ, x, y, z, rx, ry, rz);
        //printf("test");
        printf("\nInteger=%d\nx=%f\ny=%f\nz=%f\nrx=%f\nry=%f\nrz=%f\n",integ,x,y,z,rx,ry,rz);
        CreateDynamicObject(integ,x,y,z,rx,ry,rz);
        i++;
        if(i==1) AddPlayerClass(150,x,y,z+4,5.4011,0,0,0,0,0,0);
    }
I'm not 100 percent sure about the increasement of the i before the if statement, I mean I am not sure if it works as you'd like to work. And make sure you write on the file like this.
pawn Код:
// An example of 1.txt
2000,5.0,5.0,5.0,5.0,5.0,5.0
Reply


Messages In This Thread
using CreateObject function inside a loop - by deffo - 28.12.2012, 12:05
Re: using CreateObject function inside a loop - by Konstantinos - 28.12.2012, 12:10
Re: using CreateObject function inside a loop - by deffo - 28.12.2012, 12:50
Re: using CreateObject function inside a loop - by Konstantinos - 28.12.2012, 13:05
Re: using CreateObject function inside a loop - by deffo - 28.12.2012, 13:31

Forum Jump:


Users browsing this thread: 1 Guest(s)