SA-MP Forums Archive
how to save text in chat with Dini ? - 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: how to save text in chat with Dini ? (/showthread.php?tid=259752)



how to save text in chat with Dini ? - will-56 - 05.06.2011

Hello all I want to save the player's chat in a file with Dini.
I made this but it only save the last line

public OnPlayerText(playerid, text[])
{
new phraseDuJoueur[128], fichierLog[256], nomDuJoueur[MAX_PLAYER_NAME];
format(phraseDuJoueur, sizeof(phraseDuJoueur), "(%d): %s", playerid, text);
SendPlayerMessageToAll(playerid, phraseDuJoueur);
GetPlayerName(playerid, nomDuJoueur, sizeof(nomDuJoueur));
format(fichierLog, sizeof(fichierLog), "/Logs/tchat.ini");
if(!dini_Exists(fichierLog))
{
dini_Create(fichierLog);
dini_Set(fichierLog, nomDuJoueur, phraseDuJoueur);
}
else if(dini_Exists(fichierLog))
{
dini_Set(fichierLog, nomDuJoueur, phraseDuJoueur);
}
return 0;
}

Thanks to rode


Re: how to save text in chat with Dini ? - xRyder - 05.06.2011

You don't have to use Dini for those things...
Use this:
pawn Код:
stock ChatLog(string[])
{
    new ptext[255];
    format(ptext, sizeof(ptext), "%s\r\n", string);
    new File:chatFile;
    chatFile = fopen( "YourRandomFile", io_append);
    fwrite(chatFile, entry);
    fclose(chatFile);
}



Re : how to save text in chat with Dini ? - will-56 - 05.06.2011

Thanks a lot it works