How to read specific line from a file?
#1

Read #5 post in this thread....


Hello all, Im trying to read a specific line from file "interiors" (Grand Larceny file by Kye). Once you do /createhouse [Interior ID] It will search for Uniq Interior ID in that file and read other numbers like Xpos Ypos Zpos etc:
pawn Код:
CMD:createhouse(playerid, params[])
{
    new hinterior, hcost;
    if(sscanf(params, "dd", hinterior, hcost)) return scm(playerid, colorusage, "USAGE: /createhouse [Interior] [Price]");
    else if(pInfo[playerid][pAdmin] < 4) return SendClientMessage(playerid, colorgrey, "<!> You're not authorized to use that command.");
    else
    {
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(playerid, X, Y, Z);
            //   It should do it here... Read Interior, XPOS, YPOS etc from that line and put it into my variables

    }
    return 1;
}
example:

I write in /createhouse 127 [and price here], and command should read from line 127 and get info about Rosenberg's office in caligulas:
Quote:

126 6 442.1295 -52.4782 999.7167 177.9394 Secret Valley Diner ;
127 2 2182.2017 1628.5848 1043.8723 224.8601 Rosenberg's Office in Caligulas ;
128 6 748.4623 1438.2378 1102.9531 0.6069 Fanny Batter's Whore House ;
129 8 2807.3604 -1171.7048 1025.5703 193.7117 Colonel Furhberger's ;
130 9 366.0002 -9.4338 1001.8516 160.528 Cluckin' Bell ;

1st number "127" is Unique Interior id, second number is Interior ID, next 3 numbers are X,Y and Z cords, and last number is Facing Angle once you get in that interior.
Reply


Messages In This Thread
How to read specific line from INI file? - by Amel_PAtomAXx - 13.06.2014, 12:10
Re: How to read specific line from a file? - by Jefff - 13.06.2014, 12:19
Re: How to read specific line from a file? - by Amel_PAtomAXx - 13.06.2014, 12:30
Re: How to read specific line from a file? - by Threshold - 13.06.2014, 12:53
Re: How to read specific line from a file? - by Amel_PAtomAXx - 13.06.2014, 13:39
Re: How to read specific line from a file? - by Jefff - 13.06.2014, 14:27
Re: How to read specific line from a file? - by Amel_PAtomAXx - 13.06.2014, 14:36
Re: How to read specific line from a file? - by Amel_PAtomAXx - 13.06.2014, 16:01

Forum Jump:


Users browsing this thread: 1 Guest(s)