Jump to content

Resgatar Carro Para um Local


Recommended Posts

estou tentando colocar uma função para que o carro vá para um local em 'Resgatar'

 

Button_VS_Warp_s = guiCreateStaticImage(381, 98, 166, 25, "images/button_standard.png", false, Window_VS)
Button_VS_Warp_o = guiCreateStaticImage(381, 98, 166, 25, "images/button_mouse.png", false, Window_VS)
Button_VS_Warp = guiCreateLabel(381, 98, 166, 25, "Resgatar", false, Window_VS)
guiSetFont(Button_VS_Warp, "default-bold-small")
guiLabelSetColor(Button_VS_Warp, 255, 255, 255)
guiLabelSetVerticalAlign(Button_VS_Warp, "center")
guiLabelSetHorizontalAlign(Button_VS_Warp, "center")


-- guiSetFont(Button_VS_Warp_info, "default-bold-small")
-- guiLabelSetColor(Button_VS_Warp_info, 255, 255, 255)
-- guiLabelSetVerticalAlign(Button_VS_Warp_info, "center")
-- guiLabelSetHorizontalAlign(Button_VS_Warp_info, "center")
--Button_VS_Warp_info


Button_VS_bp_s = guiCreateStaticImage(381, 133, 166, 25, "images/button_standard.png", false, Window_VS)
Button_VS_bp_o = guiCreateStaticImage(381, 133, 166, 25, "images/button_mouse.png", false, Window_VS)
Button_VS_bp = guiCreateLabel(381, 133, 166, 25, "Localizar / Desmarcar", false, Window_VS)
guiSetFont(Button_VS_bp, "default-bold-small")
guiLabelSetColor(Button_VS_bp, 255, 255, 255)
guiLabelSetVerticalAlign(Button_VS_bp, "center")
guiLabelSetHorizontalAlign(Button_VS_bp, "center")


-- guiSetFont(Button_VS_Fix_info, "default-bold-small")
-- guiLabelSetColor(Button_VS_Fix_info, 255, 255, 255)
-- guiLabelSetVerticalAlign(Button_VS_Fix_info, "center")
-- guiLabelSetHorizontalAlign(Button_VS_Fix_info, "center")


Button_VS_lk_s = guiCreateStaticImage(381, 168, 166, 25, "images/button_standard.png", false, Window_VS)
Button_VS_lk_o = guiCreateStaticImage(381, 168, 166, 25, "images/button_mouse.png", false, Window_VS)
Button_VS_lk = guiCreateLabel(381, 168, 166, 25, "Aberto - Fechado", false, Window_VS)
guiSetFont(Button_VS_lk, "default-bold-small")
guiLabelSetColor(Button_VS_lk, 255, 255, 255)
guiLabelSetVerticalAlign(Button_VS_lk, "center")
guiLabelSetHorizontalAlign(Button_VS_lk, "center")

Button_VS_sl_s = guiCreateStaticImage(381, 203, 166, 25, "images/button_standard.png", false, Window_VS)
Button_VS_sl_o = guiCreateStaticImage(381, 203, 166, 25, "images/button_mouse.png", false, Window_VS)
Button_VS_sl = guiCreateLabel(381, 203, 166, 25, "Vender Veiculo", false, Window_VS)
guiSetFont(Button_VS_sl, "default-bold-small")
guiLabelSetColor(Button_VS_sl, 255, 255, 255)
guiLabelSetVerticalAlign(Button_VS_sl, "center")
guiLabelSetHorizontalAlign(Button_VS_sl, "center")

Button_VS_give_s = guiCreateStaticImage(381, 238, 166, 25, "images/button_standard.png", false, Window_VS)
Button_VS_give_o = guiCreateStaticImage(381, 238, 166, 25, "images/button_mouse.png", false, Window_VS)
Button_VS_give = guiCreateLabel(381, 238, 166, 25, "Vender Para o Jogador", false, Window_VS)
guiSetFont(Button_VS_give, "default-bold-small")
guiLabelSetColor(Button_VS_give, 255, 255, 255)
guiLabelSetVerticalAlign(Button_VS_give, "center")
guiLabelSetHorizontalAlign(Button_VS_give, "center")

adLabel = guiCreateLabel(130, 269, 296, 24, "Loja De carros", false, Window_VS)  -------------- Nome do seu servidor
guiSetFont(adLabel, "default-bold-small")
guiLabelSetHorizontalAlign(adLabel, "center", false)
guiLabelSetVerticalAlign(adLabel, "center")  

guiSetVisible(Button_VS_sn_o,false)--
guiSetVisible(Button_VS_dy_o,false)--
guiSetVisible(Button_VS_Warp_o,false)
guiSetVisible(Button_VS_Warp_info,false)
guiSetVisible(Button_VS_Fix_o,false)
guiSetVisible(Button_VS_Fix_info,false)
guiSetVisible(Button_VS_lk_o,false)
guiSetVisible(Button_VS_sl_o,false)
guiSetVisible(Button_VS_give_o,false)

--Button_VS_Warp_info
--Button_VS_Fix_info


Window_CHK = guiCreateWindow(screX/2-155,screY/2-60,310,120,"Vender Veiculo!",false)
guiSetVisible(Window_CHK, false)
guiSetProperty(Window_CHK, "AlwaysOnTop", "true")
guiWindowSetSizable(Window_CHK, false)
Label_CHK = guiCreateLabel(21,28,266,36,"",false,Window_CHK)
guiLabelSetColor(Label_CHK, 38, 122, 216)
guiLabelSetHorizontalAlign(Label_CHK,"center",true)
Button_CHK_Y = guiCreateButton(17,73,129,36,"Deseja Vender?",false,Window_CHK)
Button_CHK_N = guiCreateButton(161,73,129,36,"Cancelar",false,Window_CHK)

function updateGridList()
    local data = getElementData(localPlayer, "VehicleInfo")
    if data then
        local rw, cl = guiGridListGetSelectedItem(Grid_VS)
        guiGridListClear(Grid_VS)
        for i, data in ipairs (data) do
            local carName = customCarNames[ data['Model'] ] or getVehicleNameFromModel(data["Model"])
            local ID = data["ID"]
            local Cost = data["Cost"]
            local HP = math.floor(data["HP"])
            local PreCost = math.ceil(Cost*.9*HP/100/10)
            local row = guiGridListAddRow(Grid_VS)
            guiGridListSetItemText(Grid_VS, row, 1, carName, false, true)
            guiGridListSetItemData(Grid_VS, row, 1, ID)
            guiGridListSetItemText(Grid_VS, row, 2, PreCost, false, true)
            guiGridListSetItemText(Grid_VS, row, 3, HP.." HP", false, true)
        end
        guiGridListSetSelectedItem(Grid_VS, rw, cl)
    end
end

bindKey("F7", "down",
function()
if getElementInterior(localPlayer) == 0 and getElementDimension(localPlayer) == 0 then
if getElementData(localPlayer, "MissionWarProtection") and getElementData(localPlayer, "MissionProtection")then return end
    guiSetVisible(Window_VS, not guiGetVisible(Window_VS))
    guiSetVisible (Window_CHK, false)
    showCursor(guiGetVisible(Window_VS))
    end
end)

triggerServerEvent("onOpenGui", localPlayer)

addEventHandler("onClientElementDataChange", root,
function(dd)
    if getElementType(source) == "player" and source == localPlayer and dd == "VehicleInfo" then
        local data = getElementData(source, dd)
        if data then
            updateGridList()
        end
    end
end)

function WINDOW_CLICK_VEHICLE (button, state, absoluteX, absoluteY)
    local id = guiGridListGetSelectedItem(Grid_VS)
    local ID = guiGridListGetItemData(Grid_VS, id, 1)
    if source == Button_VS_close then
        guiSetVisible(Window_VS, false)
        showCursor(false)
    end
    if (source == Grid_VS) then
        if id == -1 and idd then
            guiGridListSetSelectedItem(Grid_VS, idd, 1)
            return false
        else
            idd = guiGridListGetSelectedItem(Grid_VS)
        end
    elseif id == -1 then
    elseif (source == Button_VS_sn) then
    if not isInColExport () then
        triggerServerEvent("SpawnMyVehicle", localPlayer, ID)
                end
    elseif (source == Button_VS_dy) then 
        triggerServerEvent("DestroyMyVehicle", localPlayer, ID)
    elseif (source == Button_VS_lt) then 
        triggerServerEvent("LightsMyVehicle", localPlayer, ID)
    elseif (source == Button_VS_bp) then 
        triggerServerEvent("BlipMyVehicle", localPlayer, ID)
    elseif (source == Button_VS_lk) then 
        triggerServerEvent("LockMyVehicle", localPlayer, ID)
    elseif (source == Button_VS_sl) then 
        guiSetVisible(Window_CHK, true)
        local carName = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 1)
        local carprice = guiGridListGetItemText(Grid_VS, guiGridListGetSelectedItem(Grid_VS), 2)
        guiSetText(Label_CHK, 'Você deseja realmente vender seu "'..carName..'" por $'..carprice)
    elseif source == Button_VS_give then
        createPlayersList(id)
    elseif source == Button_CHK_Y then
        triggerServerEvent("SellMyVehicle", localPlayer, ID)
        guiSetVisible(Window_VS, false)
        guiSetVisible(Window_CHK, false)
        showCursor(false)
    elseif source == Button_CHK_N then
        guiSetVisible (Window_CHK, false)
    elseif source == Button_VS_Spc then
      if getElementInterior(localPlayer) == 0 then
if getElementData(localPlayer,"Stats") < 2 then
        SpecVehicle(ID)
end
end
    elseif source == Button_VS_Fix then
        triggerServerEvent("FixMyVehicle", localPlayer, ID)
    elseif source == Button_VS_Warp then
           if not isInColExport () then
        triggerServerEvent("WarpMyVehicle", localPlayer, ID)
                      end
    elseif source == Button_PLS_Y then
        local row = guiGridListGetSelectedItem ( playerList_PLS )
        if row and row ~= -1 then
            -- if guiGridListGetItemText ( playerList_PLS, row, 1 ) == getPlayerName ( localPlayer ) then
                -- return true
            -- end
            if (tonumber(guiGetText (edit_PLS_price)) or 0) >= 0 then
                outputMessage ( "#c1c1c1Esperar uma resposta do jogador.", 10, 250, 10,true )
                invitations_send = true
                triggerServerEvent ( 'inviteToBuyCarSended', localPlayer, guiGridListGetItemText ( playerList_PLS, row, 1 ), guiGetText (edit_PLS_price) or 0, guiGridListGetItemText(Grid_VS, id, 1), guiGridListGetItemData(Grid_VS, id, 1) )
                destroyElement ( Window_PLS )
            end
        end
    elseif source == Button_PLS_N then
        destroyElement ( Window_PLS)
    end
end
addEventHandler("onClientGUIClick", resourceRoot, WINDOW_CLICK_VEHICLE)

Link to comment
2 hours ago, ViniGuzela said:

Button_VS_Warp_s = guiCreateStaticImage(381, 98, 166, 25, "images/button_standard.png", false, Window_VS)
Button_VS_Warp_o = guiCreateStaticImage(381, 98, 166, 25, "images/button_mouse.png", false, Window_VS)
Button_VS_Warp = guiCreateLabel(381, 98, 166, 25, "Resgatar", false, Window_VS)
guiSetFont(Button_VS_Warp, "default-bold-small")
guiLabelSetColor(Button_VS_Warp, 255, 255, 255)
guiLabelSetVerticalAlign(Button_VS_Warp, "center")
guiLabelSetHorizontalAlign(Button_VS_Warp, "center")

    elseif ( source == GUIEditor.button[6] ) then
        fadeCamera( false )
        setTimer( fadeCamera, 1500, 1, true )
        setTimer( setElementPosition, 1500, 1, Cplayer, -1639.25244, 1203.28857, 8.22800 )
        guiSetVisible( GUIEditor.window[1], false )
            showCursor( false )
end

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