Let's assume that I'm in the first line, how to go to the second and the third line and read them using fgets() in the same function?
Code:
enum _:DATA
{
NAME[32],
STEAMID[35],
LAST_CONNECT[50]
}
public admin_cmd(id, level, cid)
{
if(!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
CheckFile()
//console_print(id, "# %s %-22.22s %-22.22s", "Name", "SteamId", "Last Connect Time")
server_print("# %-22.22s %-22.22s %s", "Name", "SteamId", "Last Connect Time")
new f = fopen(FILE, "r")
if(!f)
return console_print(id, "Couldn't open file")
new szLine[50], Data[DATA]
while(!feof(f))
{
fgets(f, szLine, charsmax(szLine))
if(!szLine[0] || szLine[0] == ';' || szLine[0] != '[')
continue;
replace(szLine, charsmax(szLine), "[", "")
replace(szLine, charsmax(szLine), "]", "")
replace(szLine, charsmax(szLine), "^n", "")
copy(Data[STEAMID], charsmax(Data[STEAMID]), szLine)
// Here i should get the name and last connection time
server_print("%d %-22.22s %-22.22s %s", ++i, Data[NAME], Data[STEAMID], Data[LAST_CONNECT])
}
fclose(f)
return PLUGIN_HANDLED
}