Using this function:
function GetAccountMAC(Player)
local AccountName = GetActName(Player)
local String = "SELECT last_login_mac FROM AccountServer.dbo.account_login WHERE name = '"..AccountName.."'"
local Connect, CID = LuaSQL("connect", SQL.AccountServer.Host, SQL.AccountServer.User, SQL.AccountServer.Password)
if Connect == SQL_SUCCESS_WITH_INFO then
local Success, Query = LuaSQL("query", CID, String)
if Success == SQL_SUCCESS_WITH_INFO then
local Data = LuaSQL("fetch", CID, Query)
LuaSQL("freehandle", CID, Query)
LuaSQL("close", CID)
return Data["last_login_mac"]
end
end
end
Do this (using Chaos Argent as an example):
ChaosArgentMAC = ChaosArgentMAC or {}
function check_can_enter_garner2(Player, CopyMGR)
...
local PlayerMac = GetAccountMAC(Player)
ChaosArgentMAC[PlayerMac] = ChaosArgentMAC[PlayerMac] or false
if ChaosArgentMAC[PlayerMac] then
return 0
end
end
function after_enter_garner2(Player, MapCopy)
...
local PlayerMac = GetAccountMAC(Player)
ChaosArgentMAC[PlayerMac] = true
end
function before_leave_garner2(Player)
...
local PlayerMac = GetAccountMAC(Player)
ChaosArgentMAC[PlayerMac] = false
end
function map_copy_close_garner2(MapCopy)
...
ChaosArgentMAC = {}
end
Give that a try and let me know. Although it relies heavily on loading LuaSQL constantly when trying to enter, entering and leaving so I don't know what effects it may have on server stability when having a high player base. Also just in case, reset the variable after map closing so it's persistent.
Also, I don't know if the variable will be stored correctly, maybe you can convert it to a string so it stores without a problem? Don't know. Try the above, if any issues then convert the MAC address using "tostring" function on each "GetAccountMAC" call.