Save 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: Save File (
/showthread.php?tid=271777)
Save File -
Alex_Obando - 25.07.2011
Hello, I have an anti weapon hack, so when someone hacks itґll send the message to an admin, But what I need is to save the file somewhere on scriptfiles, Like WeaponHacks.
[ Alex_Obando minigun hack 25/7/11 ]
Re: Save File -
Shadoww5 - 25.07.2011
PHP код:
stock Save(str[])
{
new File:log = fopen("Log.txt", io_append);
format(str, 256, "%s\r\n", str);
fwrite(log, str);
fclose(log);
return 1;
}
Usage mode:
PHP код:
public OnPlayerDisconnect(playerid, reason)
{
new str[128], y, m, d;
getdate(y, m, d);
GetPlayerName(playerid, str, sizeof str);
format(str, sizeof str, "%s - %s - Date: %02d/%02d/%04d", str, reason, d, m, y);
Save(str);
return 1;
}
This will be written like this in the file Log.txt (if player name is Alex_Obando and reason was 1):
Код:
Alex_Obando - 1 - 25/07/2011