Jump to content

[Question] How to disable the double-click map teleport


jaZz_KCS

Recommended Posts

Hello there!

I've got a quick question regarding the freeroam plugin and it's GUI.

I am working on a type of survival server and already successfully disabled all the functions I don't want players to have like giving themselves weapons, cars, warping, gravity, etc..

Besides disabling warping which allows you to warp to different players and disabling the map to be showed after login and death there's also this teleport function which when you open up the map via F1 menu lets you teleport anywhere you want by doing a double click.

I successfully disabled warping to other players, but how can I disable the double click warping feature? I don't want my players to be able to warp where they want to....

Thank you in advance.

Link to comment

Try these. Didn't find anything else related to it.

Client-side (fr_client.lua) (updatePlayerBlips) (line 708)

function updatePlayerBlips() 
    if not g_PlayerData then 
        return 
    end 
    local wnd = isWindowOpen(wndSpawnMap) and wndSpawnMap or wndSetPos 
    local mapControl = getControl(wnd, 'map') 
    for elem,player in pairs(g_PlayerData) do 
        if not player.gui.mapBlip then 
            player.gui.mapBlip = guiCreateStaticImage(0, 0, 9, 9, elem == g_Me and 'localplayerblip.png' or 'playerblip.png', false, mapControl) 
            player.gui.mapLabelShadow = guiCreateLabel(0, 0, 100, 14, player.name, false, mapControl) 
            local labelWidth = guiLabelGetTextExtent(player.gui.mapLabelShadow) 
            guiSetSize(player.gui.mapLabelShadow, labelWidth, 14, false) 
            guiSetFont(player.gui.mapLabelShadow, 'default-bold-small') 
            guiLabelSetColor(player.gui.mapLabelShadow, 255, 255, 255) 
            player.gui.mapLabel = guiCreateLabel(0, 0, labelWidth, 14, player.name, false, mapControl) 
            guiSetFont(player.gui.mapLabel, 'default-bold-small') 
            guiLabelSetColor(player.gui.mapLabel, 0, 0, 0) 
            --[[for i,name in ipairs({'mapBlip', 'mapLabelShadow'}) do 
                addEventHandler('onClientGUIDoubleClick', player.gui[name], 
                    function() 
                        server.warpMe(elem) 
                        closeWindow(wnd) 
                    end, 
                    false 
                ) 
            end]] 
        end 
        local x, y = getElementPosition(elem) 
        x = math.floor((x + 3000) * g_MapSide / 6000) - 4 
        y = math.floor((3000 - y) * g_MapSide / 6000) - 4 
        guiSetPosition(player.gui.mapBlip, x, y, false) 
        guiSetPosition(player.gui.mapLabelShadow, x + 14, y - 4, false) 
        guiSetPosition(player.gui.mapLabel, x + 13, y - 5, false) 
    end 
end 

Client-side (fr_client.lua) (spawnMapDoubleClick) (line 854)

--[[function spawnMapDoubleClick(relX, relY) 
    setPlayerPosition(relX*6000 - 3000, 3000 - relY*6000, 0) 
    closeWindow(wndSpawnMap) 
end]] 

Link to comment
Replaced the lines with the ones you mentioned. Sadly, double-click map teleportation still works.

I hope you didn't remove the --[[ ]] tags, because they are supposed to be there. In my eyes I can't see anything else than those two areas, which cause the player to be teleported.

Link to comment

Hmm, perhaps this should prevent any unwanted errors or perhaps fixes it.

Client-side (fr_client.lua) (setPosClick) (line 639)

--[[function setPosClick() 
    setPlayerPosition(getControlNumbers(wndSetPos, {'x', 'y', 'z'})) 
    closeWindow(wndSetPos) 
end]] 

Client-side (fr_client.lua) (wndSetPos) (line 763)

wndSetPos = { 
    'wnd', 
    text = 'Set position', 
    width = g_MapSide + 20, 
    controls = { 
        {'img', id='map', src='map.png', width=g_MapSide, height=g_MapSide, onclick=fillInPosition--[[, ondoubleclick=setPosClick]]}, 
        {'txt', id='x', text='', width=60}, 
        {'txt', id='y', text='', width=60}, 
        {'txt', id='z', text='', width=60}, 
        --[[{'btn', id='ok', onclick=setPosClick},]] 
        {'btn', id='cancel', closeswindow=true}, 
        {'lbl', text='Right click on map to close'} 
    }, 
    oncreate = setPosInit, 
    onclose = closePositionWindow 
} 

Client-side (fr_client.lua) (wndSpawnMap) (line 872)

wndSpawnMap = { 
    'wnd', 
    text = 'Select spawn position', 
    width = g_MapSide + 20, 
    controls = { 
        {'img', id='map', src='map.png', width=g_MapSide, height=g_MapSide--[[, ondoubleclick=spawnMapDoubleClick]]}, 
        --{'lbl', text='Welcome to freeroam. Double click a location on the map to spawn.', width=g_MapSide-60, align='center'}, 
        {'btn', id='close', closeswindow=true} 
    }, 
    oncreate = warpMapInit, 
    onclose = closeSpawnMap 
} 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...