Help with a stock. - 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: Help with a stock. (
/showthread.php?tid=376472)
Help with a stock. -
xRandomGuy - 10.09.2012
Hi guys, I am pretty much noob at scripting so if you find something really stupid, that's the reason. I really did want to solve this by myself but after two hours I decided to just give up and ask for help. So here I am.
I am using a file management plugin called 'dFile' and I tried to create a stock which will open a specific user file, read a specific line, save and close the file and return the line. I didn't get an error but I do have one warning and the stock doesn't seem to work also;
PHP код:
warning 215: expression has no effect
PHP код:
stock GetInfo(targetid, string)
{
new variable[128];
format(variable, 128, "%s.ini", GetName(targetid));
new message[256];
dfile_Open(variable);
message = dfile_ReadString("%s"), string; // The line which gives me the warning.
dfile_SaveFile();
dfile_CloseFile();
return message;
}
Any help is appreciated!
Re: Help with a stock. -
ReneG - 10.09.2012
I have never seen "dFile", but I think this is what's wrong.
pawn Код:
message = dfile_ReadString("%s", string); // The line which gives me the warning.
Re: Help with a stock. -
xRandomGuy - 10.09.2012
Tried that but it gave me two warnings instead;
Код:
warning 203: symbol is never used: "string"
Код:
warning 202: number of arguments does not match definition
Re: Help with a stock. -
mamorunl - 10.09.2012
As I haven't used dFile either (never seen it by the way!) I'd say it works the same as the mysql functions and that the 'string' variable just is the variable where the string gets put into. Just like GetPlayerPos() works (it saves the x, y, z into a variable).
Please post the native here to be sure of this
Re: Help with a stock. -
yanir3 - 11.09.2012
Код:
message = dfile_ReadString("%s");