Is this possible ? and how ?
#1

Hello,

I saved vehicle coordinates in a .txt file and it looks like this;

444,2263.332275,-112.685447,27.088766,1.411218,0,0;Player

later if i go ingame the saved coordinates are capable of creating a vehicle at that location.
As you can see i also saved a name at the end of the file. Its from the one who placed it, in this case mine in debug.

now i want to know if its possible to just read a part of this line . the name of the player or the modelname of the car.
and how?

I tried this but it didnt work so far;

pawn Код:
if(strcmp("/readit",cmd,true)==0)
    {
        new string[156];
        new File:tryit = fopen("vehicles/trains.txt",io_read); // Open the file
        while(fread(tryit,string))
        {
            SendClientMessage(playerid,0xFFFFFF96,string); //-this one does work (whole line)
           
            if(strcmp(string,"Player", true) == 0)//this part doesnt
            {
                SendClientMessage(playerid,0xFFFFFF96,"it says player");
                printf("%s",string);
            }
        }
        fclose(tryit);
        return 1;
    }
Reply
#2

Anyone ?..
Reply
#3

strcmp obviously compares the whole string. You'll most likely need strfind.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)