Hello scripter,
use PtokaX 0.3.6.0 with RoboCop 10.0.23.
Include "ChatHistoryEntry.lua" makes under \scripts a "ChatHistory.dat" and list on entry in PN last 100 lines. Works great.
Now i want in mainchat by command like "wassup" or "!wassup" after closing PN a new history PN with 50 lines.
This script don't work :
--- HistoryIsSimple by Herodes v1
---- ---- ---- ---- ---- ---- ---- ---- ---- ----
-- very simple chat history script ..
--- !wazup shows the Chat History
tChatLines = {}
iMaxLines = 50
function ChatArrival(user, data)
data = string.sub( data, 1, -2)
if not string.find( data, "%b<>%s+[%!%?%+%%-%#]" ) then
local function resort(t) local r={}; for i,v in t do table.insert( r, v );end;return r;end;
if table.getn(tChatLines) > iMaxLines then
table.remove(tChatLines, 1);
end
table.insert( tChatLines, os.date("%x@%X").." [] "..data );
tChatLines = resort(tChatLines);
else
local s,e, cmd = string.find( data, "%b<>%s+[%!%?%+%%-%#](%S+)" )
if cmd == "wassup" then
local m = "\r\n\r\n========================\r\n"
for i,v in tChatLines do
m=m.." "..v.."\r\n"
end
m = m.."========================"
user:SendData( "ChatHistory", m)
end
end
end
On start : No syntax errors in script file lua/wassup.lua
After press wassup : Syntax G:\DC\PtokaX_0360\scripts\lua/wassup.lua:13: attempt to call a table value
or press !wassup : Syntax G:\DC\PtokaX_0360\scripts\lua/wassup.lua:23: attempt to call a table value
Can everybody help, please ? :'(
Nice Mutor, works ! THX
Little error inside.
The HistoryLines sorted by aktual to older, like
03/16/08@16:02:15
03/16/08@16:02:14
03/16/08@16:02:13
03/16/08@16:02:12
What chance to like
03/16/08@16:02:12
03/16/08@16:02:13
03/16/08@16:02:14
03/16/08@16:02:15
Thanks for helping, but no chances. :'(
UPS, yes, little mistake.
Now works great ! Many Thanks to you !!! :)