Help : How to read from file
#1

How do i read from an file ?
Please someone give me an example , i ned this for reading from account.
For example
pawn Код:
if (strcmp("/adpcj", cmdtext, true, 10) == 0)
    {
      if(PlayerInfo[playerid][AdminLevel] > 1)
        {
        new Float:ax, Float:ay, Float:az;
            GetPlayerPos(playerid, ax , ay , az);
            AddStaticVehicle(422 , ax , ay+3 , az , 0.0, 1, 1);
            SendClientMessage(playerid, COLOR_YELLOW, "PCJ addet");
            new pname[24], File:ftw=fopen("log.txt", io_append);
        GetPlayerName(playerid, pname, 24);
            format(string, 30, "Admin %s Addet an PCJ at x = %d , y = %d , z = %d",pname,ax,ay+3,az);
            fwrite(ftw, string);
            fclose(ftw);
        }
    }
    return 1;

}
It compiles fine , but when i try the command doesn't work , so , how do i read AdminLevel= x ? ( i'm intrested only in the x , x is an number )
This is not an GF script , it's an "blank" script.
Reply
#2

fread(the file, the value);
example
pawn Код:
new File:mF;
mF = fopen("thefile.txt", io_read);
new str[100];
while(fread(mF, str))
{
// bla bla...
}
now the str got the file value
Reply
#3

I did not undestant , is anywhay to make it simple like in the gf , where if (PlayerInfo[playerid][pAdmin] >= 1) will check if AdminLevel ( in file ) is >= than 1 ?
Reply
#4

try trhe dini include
Reply
#5

I tyed all the includes , none wrok , still the same , i give AdminLevel=2 at .ini , and it says "you are not an admin" ( addet a few modifications with else)
Reply
#6

give me the script and i'll help u !
Reply
#7

http://www.megaupload.com/?d=EDSISI7W

Anticipate thanx
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)