axel364 Posted May 3, 2006 Posted May 3, 2006 Hello, I want to write a stats file. This code looks correct : void WritePlayerStats(char playername[MAX_TOKEN_CHARS], int kills, int deaths, int duelwins, int duelloss ) { FILE *playerstats; if ((playerstats = fopen("playerstats.txt","w+" )) == NULL) { trap_SendServerCommand( -1, va("print \"""^1Error!^7\"")); return; } else { fprintf(playerstats,"%s\n{\n%i\n%i\n%i\n%i\n}",playername,kills,deaths,duelwins,duelloss); fclose(playerstats); } } I want the mod writes player's stats in "playerstats.txt" for every players on the server, when a player enters, I want the mod looks for his name in playerstats.txt and store him in the file if he comes for the first time. The playerstats.txt looks like this : AxeL364 { 5 2 0 0 } And I want to be able to read my stats from the game... I really need to know how to find a "string" in a file. Thanks.
Emiel Regis Posted May 10, 2006 Posted May 10, 2006 I might not be right, but you should rather use 'trap_FS_FOpenFile' than 'fopen'...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.