Help : How to read from file - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help : How to read from file (
/showthread.php?tid=89043)
Help : How to read from file -
Dj_maryo1993 - 30.07.2009
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.
Re: Help : How to read from file -
James_Alex - 30.07.2009
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
Re: Help : How to read from file -
Dj_maryo1993 - 30.07.2009
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 ?
Re: Help : How to read from file -
James_Alex - 30.07.2009
try trhe dini include
Re: Help : How to read from file -
Dj_maryo1993 - 30.07.2009
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)
Re: Help : How to read from file -
James_Alex - 30.07.2009
give me the script and i'll help u !
Re: Help : How to read from file -
Dj_maryo1993 - 30.07.2009
http://www.megaupload.com/?d=EDSISI7W
Anticipate thanx