Hi,
I downloaded and tried this module.
--------------------------------------------------------------------------------------
-- ref_monitor.lua --
-- --
-- (c) 2006 brush -- webmaster@crimson-soldiers.org --
-- --
--------------------------------------------------------------------------------------
-- --
-- Referee Monitor --
-- --
-- This small script logs silently successful referee logins and also unsuccessful --
-- logins (maybe from unauthorized people). --
-- Successful logins also can be done with "stolen passwords", so now you are able --
-- to notice it by the players data (guid, ip, name, entered password, login time) --
-- The login actions will be logged into 2 files: --
-- "successful_logins.txt" -> contains verified and possibly hacked logins --
-- "hacks.txt" -> contains all failed logins --
-- --
--------------------------------------------------------------------------------------
DELIMITER = ";" -- set a delimiter char to make the list compatible for imports to EXCEL
SAFE_FILE = "successful_logins.txt" -- contains verified and possibly hacked logins
WEAK_FILE = "hacks.txt" -- "hacks.txt" -> contains all failed logins
function et_InitGame( levelTime, randomSeed, restart )
-- get the verified referee password from the server.cfg
referee_password = et.trap_Cvar_Get("refereePassword")
end
function et_ClientCommand( client, command )
entered_command = string.lower(et.trap_Argv(0))
entered_argument = et.trap_Argv(1)
if entered_command == "ref" then
if entered_argument == referee_password then
write_info( SAFE_FILE, client, entered_argument)
elseif entered_argument ~= referee_password then
write_info( WEAK_FILE, client, entered_argument)
end
return 0
end
function write_info(filename, client, tried_password)
local fd,len = et.trap_FS_FOpenFile( filename, et.FS_APPEND )
if (fd ~= nil and len ~= -1) then --check if file is created/access granted
info = string.upper(et.Info_ValueForKey( et.trap_GetUserinfo( client ), "cl_guid" ) )
info = info .. DELIMITER .. et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" )
info = info .. DELIMITER .. et.Q_CleanStr(et.Info_ValueForKey( et.trap_GetUserinfo( client ), "name" ) )
info = info .. DELIMITER .. tried_password
info = info .. DELIMITER .. os.date("%x %I:%M:%S%p")
info = info .. "
"
count = et.trap_FS_Write(info,string.len(info),fd)
if count ~= string.len(info) then
et.trap_FS_FCloseFile(fd)
return 0
end
et.trap_FS_FCloseFile(fd)
return 1
end
-- file couldn't be created / check the file permissions in folder /et/etpro
end
function et_Quit()
if fd then
et.trap_FS_FCloseFile(fd)
end
end
The txt files are made, but they are empty.
In the console.log I get the following error message:
Lua API: et_ClientCommand error running lua script: [string “lua/ref_monitor.lua”]:52: bad argument #1 to ‘trap_GetUserinfo’ (number expected, got nil)
In this line are some fault:
info = info .. DELIMITER .. et.Info_ValueForKey( et.trap_GetUserinfo( PlayerID ), "ip" )
If I move to comment this line the script works but missing the IP address.
Can somebody help me?