I made a simple plugin that creates a log that looks like this:
(I removed the actual steamids)
My real log now has 742 unique users
.
Code:
1 STEAM_0:1:11111 Ma$termind
2 STEAM_0:0:11111 hagen
3 STEAM_0:1:11111 The Federal Offender
4 STEAM_0:1:11111 Luis Rios
5 STEAM_0:1:11111 Zach' Triad' Bowman
6 STEAM_0:1:11111 Adolfus
7 STEAM_0:1:11111 sprayer
8 STEAM_0:1:11111 HABIB
9 STEAM_0:1:11111 Hellucard
10 STEAM_0:0:11111 Fillipeano
11 STEAM_0:0:11111 Jeff From accounting
12 STEAM_0:1:11111 jalop
13 STEAM_0:1:11111 nomel
However, I want to add a counter after the player's name, showing how many times the user has connected to my server. I've tried many variations of strbreak and parse, and I could not get the number to increase by 1 every time the user connected. It would just stay at 1.
Here's the code without the parse/strbreak or any variable to hold the number of times the user has connected. I'd like to know how to do this properly
Code:
#include <amxmodx>
#include <amxmisc>
#include <file>
new szFile[32] = "addons/amxmodx/users_list.txt"
public plugin_init() {
register_plugin("Steam n Nick Logger","1.0","stupok69")
}
public client_authorized(id)
{
check_name(id)
return PLUGIN_CONTINUE
}
public check_name(id)
{
new pAuth[33], pName[33], Len, szText[101]
get_user_authid(id, pAuth, 32)
if(containi(pAuth,"BOT") != -1)
return PLUGIN_CONTINUE
get_user_name(id, pName, 32)
for(new i=0;i<file_size(szFile, 1);i++)
{
format(szText, 20, "")
read_file(szFile, i, szText, 23, Len)
if (containi(szText, pAuth) != -1)
{
return PLUGIN_CONTINUE
}
}
format( szText , 100 , "%d %s %s",file_size(szFile, 1),pAuth,pName)
write_file(szFile, szText ,-1)
return PLUGIN_CONTINUE
}