Andreas. Posted August 15, 2012 Share Posted August 15, 2012 I want the result to be: Position: xvalue, yvalue, zvalue Money: lol the current result: Money: lol2381.0546875-2175.641601562522.9655265808118 LUA code used: function log(account, message) if not (fileExists("logs/"..account)) then log = fileCreate("logs/"..account) else log = fileOpen("logs/"..account) end fileWrite(log, "\n"..message) fileClose(log) end addEvent("log", true) addEventHandler("log", root, log) function testlog(client) local playerAccount = getPlayerAccount(client) local accName = getAccountName ( playerAccount ) local x, y, z = getElementPosition(client) triggerEvent("log", client, accName, "Position: "..x..y..z) triggerEvent("log", client, accName, "Money: lol") end addCommandHandler("log", testlog) Link to comment
TAPL Posted August 15, 2012 Share Posted August 15, 2012 triggerEvent("log", client, accName, "Position: "..x..", "..y..", "..z) Link to comment
Andreas. Posted August 15, 2012 Author Share Posted August 15, 2012 triggerEvent("log", client, accName, "Position: "..x..", "..y..", "..z) You don't get it. Link to comment
TAPL Posted August 15, 2012 Share Posted August 15, 2012 Try this function log(account, message) if not (fileExists("logs/"..account)) then log = fileCreate("logs/"..account) else log = fileOpen("logs/"..account) end if fileGetSize(log) == 0 then fileWrite(log,message) else fileSetPos(log,fileGetSize(log)) fileWrite(log,"\r\n",message) end fileClose(log) end addEvent("log", true) addEventHandler("log", root, log) function testlog(client) local playerAccount = getPlayerAccount(client) local accName = getAccountName ( playerAccount ) local x, y, z = getElementPosition(client) triggerEvent("log", client, accName, "Position: "..x..", "..y..", "..z) triggerEvent("log", client, accName, "Money: lol") end addCommandHandler("log", testlog) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now