how to save text in chat with Dini ?
#1

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
Reply
#2

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);
}
Reply
#3

Thanks a lot it works
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)