Jump to content

gui problem


abdalbaset

Recommended Posts

i have problem the gui not showing ,and nothing in the debug

client

  
    Wnd1= guiCreateWindow ( 0.2, 0.2, 0.25, 0.5, "Free Vehicles", true ) 
    buttonv = guiCreateButton ( 0.5, 0.8, 0.45, 0.15, "Close", true, Wnd1 ) 
    button1v = guiCreateButton ( 0.01, 0.8, 0.45, 0.15, "Accept", true, Wnd1 ) 
    label = guiCreateLabel ( 0.1, 0.1, 0.9, 0.1, "get free vehicle", true, Wnd1 ) 
    showCursor(false) 
    guiSetVisible( Wnd1, false ) 
    guiWindowSetSizable( Wnd1, false ) 
    guiWindowSetMovable( Wnd1, false ) 
      
        vehicles = 
                { 
                 
                 {"buffalo", 402}, 
                {"cheetah",415}, 
                {"Turismo",451}, 
                 {"Bullet",541}, 
                  
                } 
          
        grid = guiCreateGridList(0.01, 0.2, 0.99, 0.5, true, Wnd1) 
        guiGridListAddColumn(grid, "Vehicles", 0.85) 
          
        for i,veh in ipairs(vehicles) do 
             row = guiGridListAddRow(grid) 
             -- 
             guiGridListSetItemText(grid, row, 1, tostring(veh[1]), false, false) 
             guiGridListSetItemData(grid, row, 1, tostring(veh[2])) 
        end 
          
    function useP() 
        local row, col = guiGridListGetSelectedItem(grid)   
        if (row and col and row ~= -1 and col ~= -1) then 
            local model = tonumber(guiGridListGetItemData(grid, row, 1)) 
            if model ~= "" then 
                triggerServerEvent("CreVehicePv", localPlayer, model) 
                guiSetVisible(Wnd1,false) 
            showCursor(false) 
            end 
        end 
    end 
    addEventHandler("onClientGUIClick", button1v, useP, false) 
      
    function close() 
        if (source == buttonv) then 
            guiSetVisible(Wnd1,false) 
            showCursor(false) 
        end 
    end 
    addEventHandler("onClientGUIClick", buttonv, close) 
        
    function showGUIpv() 
        guiSetVisible(Wnd1,true) 
        showCursor(true) 
    end 
    addEvent("showGUIpv",true) 
    addEventHandler("showGUIpv", getRootElement(), showGUIpv) 
  

server

    markerpv3 = createMarker(1183.86,-1316.69,13.5742, "cylinder", 2, 250, 0, 255, 255 ) 
      
  
     
    local vehicles = {} 
      
    function spawnVehp(id) 
        local x, y, z = getElementPosition(source) 
        if isElement(vehicles[source]) then destroyElement(vehicles[source]) end 
        vehicles[source] = createVehicle(id, x + 2, y, z) 
        warpPedIntoVehicle(source, vehicles[source]) 
    end 
    addEvent("CreVehicePv",true) 
    addEventHandler("CreVehicePv", root, spawnVehp) 
      
    addEventHandler("onPlayerQuit", root, 
    function() 
         if isElement(vehicles[source]) then 
              destroyElement(vehicles[source]) 
              vehicles[source] = nil 
         end 
    end) 
  
function showGUIpv(hitPlayer) 
    if hitPlayer and getElementType(hitPlayer) == "player" then 
       
    end 
end  
addEventHandler("onMarkerHit",markerpv3,showGUIpv) 
  

meta


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