• 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!

OnLogin addMapMark is it safe performance point

Tbol

Well-Known Member
Joined
Apr 7, 2019
Messages
592
Reaction score
64
Hello wrote this simple script, at first i wanted to create it onStartup instead of onLogin because onLogin it loops on every login and i have quite a few onlogin scripts already so idk if its actually smart to use this code or not, or i can ignore it because it have equal to zero impact
LUA:
local minimapMarkers = {
    {x = 106, y = 174, z = 7, icon = 3, description = "Star Icon"},
    {x = 150, y = 120, z = 7, icon = MAPMARK_SWORD, description = "Sword Icon"},
    {x = 200, y = 130, z = 7, icon = MAPMARK_FLAG, description = "Flag Icon"},
    {x = 250, y = 140, z = 7, icon = MAPMARK_QUESTION, description = "Question Mark Icon"},
}

local function addMarkersToPlayer(player)
    for _, marker in ipairs(minimapMarkers) do
        local pos = Position(marker.x, marker.y, marker.z)
        player:addMapMark(pos, marker.icon, marker.description)
    end
end

function onLogin(player)
    addMarkersToPlayer(player)
    return true
end
 
Solution
1. You absolutely don't need to worry about performance costs being an issue from this script.
2. You wouldn't be able to do during startup anyways, as you need a player object to exist to be able to use its userdata.
1. You absolutely don't need to worry about performance costs being an issue from this script.
2. You wouldn't be able to do during startup anyways, as you need a player object to exist to be able to use its userdata.
 
Solution
Back
Top