Home Button Home Login Button Login Download Button Download Lua scripts list button Scripts list Lua documentation Button Lua scripting docs About FAQ Button FAQ

Player on screen alarm ignoring friends

Plays an alarm when you see player that is not in whitelist


local whitelist = {
    "FriendName1", 
    "FriendName2", 
    "FriendName3"
}

local function isInWhitelist(playerName)
    for _, name in ipairs(whitelist) do
        if playerName == name then
            return true
        end
    end
    return false
end

local function checkForPlayers()
    local players = getScreenPlayers()
    for _, player in ipairs(players) do
        local playerName = getCreatureName(player)
        if playerName and not isInWhitelist(playerName) then
            playSound("playerOnScreen.wav")
            break
        end
    end
end

autoRun(1000, checkForPlayers)
                    

Logout if any player on screen

Checks only players visible on screen


local function f()
    if #getScreenPlayers() > 1 then
        xlog()
        sleep(1000)
    end
end

autoRun(100, f)