Command - 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: Command (
/showthread.php?tid=472634)
Command -
Andrei04072 - 29.10.2013
Hello, I want a command to write something in the game and I'm getting a file from a server that I wrote rescue server.'
ex (/text [description] and save file.txt in folder.)
Thank you
Re: Command -
David (Sabljak) - 29.10.2013
Create .txt file in scriptfiles folder and make him call something.txt
make command
Код:
CMD:text(playerid, params[])
{
new yourtext[128];
if(sscanf(params,"s[128]",yourtext)) return SCM(playerid,-1, "Use: /text [description]");
new File:lFile = fopen("something.txt", io_append),
LogString[128];
format(LogString, sizeof(LogString),"%s \r\n", yourtext);
fwrite(lFile, LogString);
fclose(lFile);
return 1;
}
i think it will work
Re: Command -
Konstantinos - 29.10.2013
pawn Код:
// ..
new File:lFile = fopen("something.txt", io_append),
// ..
if(lFile)
{
write(lFile, LogString);
fclose(lFile);
}
// ..
You must check if the file was opened successfully to write to/close it because you're going to have problems with crashes.