This is my code right now:
PHP Code:
/* Plugin made by OneMoreLevel */
/* Date Created, Tuesday, October 20th, 2009. */
/* Plugin name, Log player info */
#include <amxmodx>
#include <amxmisc>
#include <geoip>
#define PLUGIN "Log player Info"
#define VERSION "1.1"
#define AUTHOR "OneMoreLevel"
new const userlogs [] = "userlogs.txt"
new const text [] = ""
public plugin_init() {
register_plugin("Log Player Info", "1.1", "OneMoreLevel")
register_clcmd( "say /logs" , "check_userlogs");
register_clcmd( "say /clearlogs" , "clear_userlogs");
register_concmd( "amx_userlogs" , "check_userlogs")
register_concmd( "amx_clearlogs" , "clear_userlogs")
}
public client_connect (id) {
new name [2],ip[33],steamid[63],country[46]
if (is_user_connected(id)) // This is just to make sure.
get_user_name(id,name,1) // Lets get the user's name
get_user_ip(id, ip, 32) // Get his IP
get_user_authid(id, steamid, 62) // And his SteamID
geoip_country(ip, country, 45)
client_print(id, print_console, "Welcome %s, this server is using AMMXLogs", name) // Free advertising :D
write_file( userlogs, name, -1) // Lets write his name to teh userlogz.
write_file( userlogs, steamid,-1)
write_file( userlogs, ip, -1)
write_file( userlogs, country, -1)
write_file(userlogs,"End of user info ---------- End of user info")
}
public check_userlogs(id) {
if (is_user_admin(id))
show_motd(id, "userlogs.txt", "User logs (As of new round)")
else
client_print(id,print_chat,"[AMXXLogs] You have no access to that!")
client_print(id,print_console,"[AMXXLogs] You cannot access that.")
}
public clear_userlogs(id) {
if (get_user_flags( id ) & ADMIN_RCON)
delete_file ( userlogs )
else
client_print(id,print_chat, "[AMXXLogs] You have no access to delete server files!")
client_print(id,print_console, "[AMXXLogs] You do not have RCON access to the server files!")
write_file ( userlogs, text , 1 )
}
Although I have all the flags in users.ini(excluding the user flag), It still says in console that I cannot delete files. Is there anything wrong with what I did with the RCON thing?
EDIT: Also is there a way to read through a file to check if the STEAMID is already in there?
__________________