• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

RevScripts move character Database

alcapone

Member
Joined
Jan 13, 2021
Messages
247
Reaction score
19
Lua:
local inactiveMonthsTomoveCharacter = 1
 
local function executeDatabase(fromClause)
    local totalClear = 0
    local resultId = db.storeQuery("SELECT COUNT(*) AS `count` FROM ".. fromClause)
    if resultId ~= false then
        totalClear = result.getNumber(resultId, 'count')
        result.free(resultId)
        if totalClear > 0 then
            db.query("UPDATE FROM ".. fromClause)
        end
    end
    return totalClear
end

    
        
local function doCheckInactivePlayer()
    local timeStamp = os.time() - (86400 * (inactiveMonthsTomoveCharacter * 30))
    local fromClause = "`players` SET `account_id` = 2 WHERE `group_id` = 1 AND lastlogin <= ".. timeStamp
    return executeDatabase(fromClause)
end
 

function onStartup()


    local inactivePlayer = doCheckInactivePlayer()
    if inactivePlayer > 0 then
        print(">> ".. inactivePlayer .. "  inactive players.")
    end
 

end


I'm trying to make if the player is 'X' offline time the character is moved to account id 'Y'
 
Back
Top