You are not logged in.
Pages: 1
Hello guys,
I am searching for a working LUA script called pmspec.lua.
I've found 2 files on the etpub forums but there seem to be
problems with those scripts as I restart my server for loading them.
Btw is there also a script for adding banners on custom places?
Thanks in advance,
The Doc
Offline
--
-- pmspec.lua by s1a
-- http://www.ai-jo.com
--
-- This mod allow admins that have the shrubbot flag "4" to see
-- all clients private messages, fireteam chat and team chat
-- Those admins have to use the commands /pmspec, /ftspec or /stspec.
-- That will trigger their habitility to see the chats.
-- The setting is conserved as long as the admin stay on the server.
--
-------------------------------------------------------------------------------------
-------------------------------CONFIG START------------------------------------------
--#client# is replaced by the client that used the command
--#message# is replaced by the message that the client said
--#recipient# is replaced by the target of the private message command
--Put the message "" to disable that particular message. Example : (SAYTEAM_MSG = "")
SAYTEAM_MSG = "^4sayteam^7: #client#^7: ^3#message#"
SAYBUDDY_MSG = "^3saybuddy^7: #client#^7: ^3#message#"
PRIVMSG_MSG = "^1privmsg^7: #client# ^3-> ^7#recipient#^7: ^3#message#"
--Print only to spectators(1) or always (0)
SPECSONLY = 1
-------------------------------CONFIG END -------------------------------------------
------------(DON'T CHANGE ANYTHING BELOW THIS UNLESS YOU KNOW WHAT YOU DO)-----------
-------------------------------------------------------------------------------------
MODNAME = "pmspec.lua"
MODVERSION = "1.0.3"
wannaSpecTable = {}
function et_InitGame(leveltime, randomseed, restart)
et.RegisterModname(string.format("%s %s", MODNAME, MODVERSION))
for i=1,et.trap_Cvar_Get("sv_maxclients"),1 do
wannaSpecTable[i] = {}
for j=1,3,1 do
wannaSpecTable[i][j] = 0
end
end
local fd, len = et.trap_FS_FOpenFile("pmspec.dat", et.FS_READ)
if len ~= -1 then
local filestr = et.trap_FS_Read(fd, len)
for line in string.gfind(filestr, "[^\r\n]+") do
id, st1, st2, st3 = string.match(line, "(%d),(%d),(%d),(%d)")
wannaSpecTable[tonumber(id)] = {tonumber(st1), tonumber(st2), tonumber(st3)}
end
end
et.trap_FS_FCloseFile(fd)
end
function et_Quit()
local fd, len = et.trap_FS_FOpenFile("pmspec.dat", et.FS_WRITE)
local toWrite
for i=1,et.trap_Cvar_Get("sv_maxclients"),1 do
toWrite = tostring(i) .. "," .. tostring(wannaSpecTable[i][1]) .. "," .. tostring(wannaSpecTable[i][2]) .. "," .. tostring(wannaSpecTable[i][3])
et.trap_FS_Write(toWrite, string.len(toWrite), fd)
end
et.trap_FS_FCloseFile(fd)
end
function et_ClientCommand(clientNum, command)
command = string.lower(command)
if (et.trap_Cvar_Get("g_tyranny") == "1") then
if (command == "stspec") and (et.G_shrubbot_permission(clientNum, "4") == 1) then
wannaSpecTable[clientNum+1][1] = invertValue(wannaSpecTable[clientNum+1][1])
et.trap_SendServerCommand(clientNum, "print \"stspec changed to ".. tostring(wannaSpecTable[clientNum+1][1]) .."^7\n\"")
return 1
elseif (command == "ftspec") and (et.G_shrubbot_permission(clientNum, "4") == 1) then
wannaSpecTable[clientNum+1][2] = invertValue(wannaSpecTable[clientNum+1][2])
et.trap_SendServerCommand(clientNum, "print \"ftspec changed to ".. tostring(wannaSpecTable[clientNum+1][2]) .."^7\n\"")
return 1
elseif (command == "pmspec") and (et.G_shrubbot_permission(clientNum, "4") == 1) then
wannaSpecTable[clientNum+1][3] = invertValue(wannaSpecTable[clientNum+1][3])
et.trap_SendServerCommand(clientNum, "print \"pmspec changed to ".. tostring(wannaSpecTable[clientNum+1][3]) .."^7\n\"")
return 1
elseif (command == "say_team") and (SAYTEAM_MSG ~= "") then
local name = et.Info_ValueForKey(et.trap_GetUserinfo(clientNum), "name" )
local toShow = string.gsub(SAYTEAM_MSG, "#client#", name)
toShow = string.gsub(toShow, "#message#", et.ConcatArgs(1))
printToAdmins(toShow,1)
elseif (command == "say_buddy") and (SAYBUDDY_MSG ~= "") then
local name = et.Info_ValueForKey(et.trap_GetUserinfo(clientNum), "name" )
local toShow = string.gsub(SAYBUDDY_MSG, "#client#", name)
toShow = string.gsub(toShow, "#message#", et.ConcatArgs(1))
printToAdmins(toShow,2)
elseif (command == "m") and (PRIVMSG_MSG ~= "") then
local name = et.Info_ValueForKey(et.trap_GetUserinfo(clientNum), "name" )
local firstSpace = string.find(et.ConcatArgs(1), "%s")
local recipient = string.sub(et.ConcatArgs(1), 1, firstSpace - 1)
local message = string.sub(et.ConcatArgs(1), firstSpace + 1)
local toShow = string.gsub(PRIVMSG_MSG, "#client#", name)
toShow = string.gsub(toShow, "#recipient#", recipient)
toShow = string.gsub(toShow, "#message#", message)
printToAdmins(toShow,3)
end
end
return 0
end
function et_ClientDisconnect(clientNum)
for j=1,3,1 do
wannaSpecTable[clientNum+1][j] = 0
end
end
function invertValue(value)
if (value == 0) then
return 1
end
return 0
end
function printToAdmins(text, sayType)
for i=0,et.trap_Cvar_Get("sv_maxclients")-1,1 do
if (et.gentity_get(i,"inuse") == 1) then
if (et.G_shrubbot_permission(i, "4") == 1) and ((SPECSONLY == 0) or (et.gentity_get(i, "sess.sessionTeam") == 3)) and (wannaSpecTable[i+1][sayType] == 1) then
et.trap_SendServerCommand(i, "print \"".. text .."^7\n\"")
end
end
end
end
function ConsolePrintf(...)
et.G_Print(string.format("%s: %s\n", MODNAME, string.format(unpack(arg))))
end
Offline
Thanks mate!
I've added it and when I issue /lua_status it says the script is being loaded.
But now i've a problem when I try for example /pmspec (I have flag 4 granted) there comes:
unknow cmd pmspec
Some help please
But it does write a .DAT file in my mod folder
Offline
There's a built-in "pmspec" feature in N!tmod.
It is controlled by the "pmspec" shrubbot flag.
If you or your level has this flag, then you will always be able to read pm's while in spectator team (No need to use the /pmspec command)
Offline
Pages: 1