Jump to content

marker with gui


SoiiNoob

Recommended Posts

i wanna set a marker, when you are on it you can choose 3 types of bicycles (Bike, BMX, Mountain Bike) [with double click if you can]

here's a simple fail

-- GUI 
p1 = createMarker ( 2249.1606445313, -1262.4528808594, 23, "cylinder", 1, 0, 0, 255, 255 ) 
Boton1 = guiCreateButton(275,20,15,15,"x",false,cerrar) 
guiSetVisible(createSelectedVehicle, false) 
  
function cerrar() 
    guiSetVisible(cerrar, false) 
    showCursor(false) 
end 
  
function hit (player) 
    if player == getLocalPlayer() then 
        guiSetVisible(createSelectedVehicle, true) 
        showCursor(true) 
    end 
end 
  
addEventHandler( "onClientGUIClick", Boton1, cerrar ) 
addEventHandler( "onClientMarkerHit", p1, hit ) 
  
-- part of freeroam 
  
function createSelectedVehicle(leaf) 
    if not leaf then 
        leaf = getSelectedGridListLeaf(wndCreateVehicle, 'vehicles') 
        if not leaf then 
            return 
        end 
    end 
    server.giveMeVehicles(leaf.id) 
end 
  
  
  
wndCreateVehicle = { 
    'wnd', 
    text = 'Create vehicle', 
    width = 300, 
    controls = { 
        { 
            'lst', 
            id='vehicles', 
            width=280, 
            height=340, 
            columns={ 
                {text='Vehicle', attr='name'} 
            }, 
            rows={xml='vehicles.xml', attrs={'id', 'name'}}, 
            onitemdoubleclick=createSelectedVehicle 
        }, 
        {'btn', id='create', onclick=createSelectedVehicle}, 
        {'btn', id='close', closeswindow=true} 
    } 
} 
  
function createVehicleCommand(cmd, ...) 
    local vehID 
    local vehiclesToCreate = {} 
    local args = { ... } 
    for i,v in ipairs(args) do 
        vehID = tonumber(v) 
        if not vehID then 
            vehID = getVehicleModelFromName(v) 
        end 
        if vehID then 
            table.insert(vehiclesToCreate, math.floor(vehID)) 
        end 
    end 
    server.giveMeVehicles(vehiclesToCreate) 
end 
addCommandHandler('createvehicle', createVehicleCommand) 
addCommandHandler('cv', createVehicleCommand) 

Edit:

I wanna some like this

95483700.png

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