problem teleport to a position reading from file with io_read
#1

Hello,

I thought i'd make a simple command to teleport to a position i saved earlyer in a file.
The position it saved works perfect..however the loading/teleport doesnt teleport me.

It says 'invalid line' instead of setting my position

pawn Код:
if(!strcmp(cmdtext, "/gopos", true))
    {
        if(fexist("mypos.txt"))
        {
            new File:IFile = fopen("mypos.txt", io_read), str[128];

            while(fread(IFile, str))
            {
                if(str[0] == '#') continue;

                new Float:X, Float:Y, Float:Z;
                if(sscanf(str, "fff",X, Y, Z))
                {
                    printf("(i) Invalid Line: %s", str);
                }
                else
                {
                    SetPlayerPos(playerid, X, Y, Z);
                }
            }

            fclose(IFile);
        }
        return 1;
    }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)