Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- HandleChat command.
- cmd.list['timeonline'] = function(role, param)
- local cha_name = GetChaDefaultName(role)
- BickerNotice(role, cha_name..", Total Online Time: "..ToClockFormat(GetAccountOnlineTime(role)))
- end
- -- LuaSQL Function to get account online time, note: this one below need do some changes if used in v1.38 gameserver.
- function GetAccountOnlineTime(role)
- local characterID,characterName,accountName = GetPlayerID(GetChaPlayer(role)),GetChaDefaultName(role),GetActName(role)
- local String = "SELECT total_live_time FROM "..SQL.AccDB..".dbo.account_login WHERE name = '"..accountName.."'"
- local Connect, ConnectID = LuaSql(SQL.Connect, SQL.Host, SQL.UID, SQL.PWD)
- if Connect == 1 then
- local Success, Query = LuaSql(SQL.Query, ConnectID, String)
- if Success == 1 then
- local Data = LuaSql(SQL.Fetch, ConnectID, Query)
- LuaSql(SQL.FreeHandle, ConnectID, Query)
- LuaSql(SQL.Close, ConnectID)
- return Data["total_live_time"]
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement