Hi, I tried making a plugin that logs a player's steamid and name (I've done this before) but this time, I'm trying to make it so that if their name is already in the txt file, don't write it again. This is the code I have:
Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Logging"
#define VERSION "1.0"
#define AUTHOR "nikhilgupta345"
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_dictionary("steamids.txt")
register_logevent("round_start", 2, "1=Round_Start")
}
public round_start()
{
new players[32], player, num
new readfile[256]
new filewrite=fopen("addons/amxmodx/configs/logs.txt", "wt")
new fileread=fopen("addons/amxmodx/configs/logs.txt", "rt")
get_players(players, num)
for(new i;i<num;i++)
{
while(!feof(fileread))
{
fgets(fileread, readfile, charsmax(readfile))
new authid[32], name[32]
player=players[i]
get_user_name(player, name, 31)
get_user_authid(player, authid, 31)
if(!(containi(readfile, name)) || !(containi(readfile, authid)))
{
fprintf(filewrite, "%s-%s", name, authid)
client_print(0, print_chat, "[Dust2 Pub] %L", LANG_PLAYER, "NAME_LOGGED", name)
}
}
}
}
When I join my server and when the round starts, doesn't print anything to cleint, and when I check logs.txt (I made it myself, the plguin didn't make it), nothing is in it :/