Jump to content

chat


BettyBoop

Recommended Posts

Here you are, this is my simple script which I use it on my server.

logname = "chatlog.log"
function et_ClientCommand( num, cmd )
if cmd == "say" or cmd == "say_team" or cmd == "say_buddy" then
 if et.trap_Argc() > 1 then
  local msg  = ""
  local name = et.Q_CleanStr(et.gentity_get(num, "pers.netname"))
  for i = 1, et.trap_Argc() - 1 do
   msg = string.format("%s %s", msg, et.Q_CleanStr(et.trap_Argv( i )))
  end
  WriteToFile(logname, string.format("[%s]-[%s]: %s\n", os.date(), name, msg ))
 else
  local name = et.Q_CleanStr(et.gentity_get(num, "pers.netname"))
  local msg  = string.format("[%s]-[%s]: %s\n", os.date(), name, et.Q_CleanStr(et.trap_Argv(1)))
  WriteToFile(logname, msg)
 end
end
end
function WriteToFile( filename, str )
fd, len = et.trap_FS_FOpenFile( filename, et.FS_APPEND )
et.trap_FS_Write( str, string.len(str), fd )
et.trap_FS_FCloseFile( fd )
end

Link to comment
Share on other sites

  • Management
You don't need to have liblua5.1.so for this script. The Lua interpreter is ibuilt into the mod. If you do need to install external Lua libraries, then you also need to use the qagame that is found from the dynamic_lua folder. It allows loading the external dependencies properly.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...