Seite 1 von 1

Playerstats mit LUA auslesen

Verfasst: 15. Nov 2004, 09:49
von Pjotr
Hab im Russenforum was gefunden. Man kann offenbar die Serverstatistiken in ein HTML File schreiben lassen. Klingt soweit ganz interessant :)

https://forum.lockon.ru/viewtopic.php?t=2239

Verfasst: 15. Nov 2004, 10:03
von JaBoG32_Laud
Jo, aber das Problem dabei ist, dass die Serverstatistiken häufig Fehlerhaft sind. :?

Verfasst: 17. Nov 2004, 16:20
von Chrissi
Noch eine kleine Ergänzung zu dem Thread:

Die Funktion LuaExportStart() in der Config/export/export.lua ist standardmäßig von Kommentar-Tags eingeschlossen.

[codew26]-- Uncomment this function to enable data export!
--[[
function LuaExportStart()
-- Works once just before mission start.

-- Make initializations of your files or connections here.
-- For example:
-- 1) File
-- local file = io.open("./Temp/Export.log", "w")
-- if file then
-- io.output(file)
-- end
-- 2) Socket
-- dofile "lua.lua"
-- socket = require("socket")
-- host = host or "localhost"
-- port = port or 8080
-- c = socket.try(socket.connect(host, port)) -- connect to the listener socket
-- c:setoption("tcp-nodelay",true) -- set immediate transmission mode

end
--]][/codew26]

Wie bereits in dem oben angebrachten Kommentar des Quelltexts erwähnt, muss man die Kommentar-Tags entfernen ("--[[" und "--]]"), um den Datenexport initialisieren/starten zu können. (Die Funktion io.open("./Temp/Export.log", "w") öffnet beispielsweise im Schreibmodus die Export.log Datei).


Wenn die Kommentare entfernt sind sieht das Ganze dann so aus und das Script von Jetfire sollte funktionieren ;)


[codew26]function LuaExportStart()
-- Works once just before mission start.

-- Make initializations of your files or connections here.
-- For example:
-- 1) File
-- local file = io.open("./Temp/Export.log", "w")
-- if file then
-- io.output(file)
-- end
-- 2) Socket
-- local path = "./luasocket.dll"
-- local f = assert(loadlib(path, "luaopen_socket"))
-- f()
-- local host = host or "localhost"
-- local port = port or 8080
-- if socket then
-- c, e = socket.connect(host, port) -- connect to the listener socket
-- end

end[/codew26]


Viel Spaß! :D