SA-MP Forums Archive
Is this possible ? and how ? - 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: Is this possible ? and how ? (/showthread.php?tid=328011)



Is this possible ? and how ? - boelie - 23.03.2012

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;
    }



Re: Is this possible ? and how ? - boelie - 24.03.2012

Anyone ?..


Re: Is this possible ? and how ? - Vince - 24.03.2012

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