Jump to content

Help me !


3pher.za

Recommended Posts

Hi everyone

How can I create a marker that shows a picture when I click on it and has a button on that picture?

I want to create a transport system, and when the user clicks on it, this page will open and there will be a button on it, and when he clicks the button, it will enter somewhere else. !

Similar to this photo :

do.php?imgf=org-a3f37f0adad71.jpg

Thank you ... ??

Edited by Seza
Link to comment

Create your own panel with guiStaticImage or via guieditor

--Client

panel = guiCreateStaticImage( 20, 200, 100, 100, "imagename.png", false)
button1 = guiCreateStaticImage( 10, 20, 20, 20, "imagename.png", false, panel)
addEventHandler("onClientGUIClick", button1, transportToOne, false)

function showTransportPanels()
    if (not guiGetVisible(panel)) then
        guiSetVisible(panel, true)
        showCursor(true)
    end
end
addEvent("showTransportPanel", true)
addEventHandler("showTransportPanel", root, showTransportPanels)

function transportToOne(btn, st)
    if (btn ~= "left" or st ~= "up") then
        if (guiGetVisible(panel)) then
            guiSetVisible(panel, false)
            showCursor(false)
        end
        triggerServerEvent("transportPlayerTo", resourceRoot, 1)
    end
end

--Server

local playerMarker = createMarker(0, 0, 2, "cylinder", 5, 10, 244, 23, 200, root)

function handlePlayerMarker(hitElement, matchingDim)
	local elementType = getElementType(hitElement)
    if (elementType ~= "player" or not matchingDim or isPedInVehicle(hitElement)) then
        return false
    end
    triggerClientEvent(hitElement, "showTransportPanel", hitElement)
end
addEventHandler("onMarkerHit", playerMarker, handlePlayerMarker)

function transportPlayerTo(place)
    if (place == 1) then
        fadeCamera(client, false, 1)
        setElementPosition(client, x, y, z)
        setTimer(fadeCamera, 1000, 1, client, true)
    end
end
addEvent("transportPlayerTo", true)
addEventHandler("transportPlayerTo", resourceRoot, transportPlayerTo)

untested but you can figure it out by yourself

  • Like 1
Link to comment
1 minute ago, NeverGiveup said:

Create your own panel with guiStaticImage or via guieditor

--Client

panel = guiCreateStaticImage( 20, 200, 100, 100, "imagename.png", false)
button1 = guiCreateStaticImage( 10, 20, 20, 20, "imagename.png", false, panel)
addEventHandler("onClientGUIClick", button1, transportToOne, false)

function showTransportPanels()
    if (not guiGetVisible(panel)) then
        guiSetVisible(panel, true)
        showCursor(true)
    end
end
addEvent("showTransportPanel", true)
addEventHandler("showTransportPanel", root, showTransportPanels)

function transportToOne(btn, st)
    if (btn ~= "left" or st ~= "up") then
        if (guiGetVisible(panel)) then
            guiSetVisible(panel, false)
            showCursor(false)
        end
        triggerServerEvent("transportPlayerTo", resourceRoot, 1)
    end
end

--Server

local playerMarker = createMarker(0, 0, 2, "cylinder", 5, 10, 244, 23, 200, root)

function handlePlayerMarker(hitElement, matchingDim)
	local elementType = getElementType(hitElement)
    if (elementType ~= "player" or not matchingDim or isPedInVehicle(hitElement)) then
        return false
    end
    triggerClientEvent(hitElement, "showTransportPanel", hitElement)
end
addEventHandler("onMarkerHit", playerMarker, handlePlayerMarker)

function transportPlayerTo(place)
    if (place == 1) then
        fadeCamera(client, false, 1)
        setElementPosition(client, x, y, z)
        setTimer(fadeCamera, 1000, 1, client, true)
    end
end
addEvent("transportPlayerTo", true)
addEventHandler("transportPlayerTo", resourceRoot, transportPlayerTo)

untested but you can figure it out by yourself

I can not believe! You wrote perfectly for me! I just have to create the meta.xml!

You are very professional!

Thank you very much ! :)

❤️ ❤️ ❤️ ❤️ ❤️

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...