Jump to content

[Ayuda]Como Pongo Nombres a los Autos?


elchinooo98

Recommended Posts

hola necesito ayuda con este script ya que quiero que en vez de poner los nombres de los autos de mta normales ponga los que yo quiero en la GUI,tal cual seria el Freeroam que se hace por .xml o otra forma pero que tengan los nombres que yo quiera...

les dejo el client Side (no es Mio)

function centerWindow ( center_window ) 
    local sx, sy = guiGetScreenSize ( )
    local windowW, windowH = guiGetSize ( center_window, false )
    local x, y = ( sx - windowW ) / 2, ( sy - windowH ) / 2
    guiSetPosition ( center_window, x, y, false )
end
 
 
 
 
 
 
setTimer ( function ()
 
local theCol = getElementData(root, "BlockExportCol")
   
function isInColExport ()
    if isElement(theCol) and isElementWithinColShape(localPlayer,theCol) then
        return true else return false
    end
end
 
function ClientExplosionCFunction()
 if isInColExport ()  then
  cancelEvent ()
 end
end
addEventHandler("onClientExplosion", root, ClientExplosionCFunction)
 
end , 1000, 1 )
 
local screX, screY = guiGetScreenSize()
 
Window_VS = guiCreateWindow(500, 254, 276, 420,"Sistema De Autos",false)
guiSetAlpha(Window_VS, 0.88)
guiWindowSetSizable(Window_VS, false)
guiSetVisible(Window_VS, false)
centerWindow(Window_VS)
Grid_VS = guiCreateGridList(11, 107, 255, 225,false,Window_VS)
guiGridListSetSelectionMode(Grid_VS, 1)
guiGridListAddColumn(Grid_VS,"Auto",0.29)
guiGridListAddColumn(Grid_VS,"Precio $",0.29)
guiGridListAddColumn(Grid_VS,"Vida",0.29)
Label_SVS = guiCreateLabel(10, 386, 257, 15, "Reparar $1000 | Warpear $700",false,Window_VS)
 
 
Button_VS_sn = guiCreateButton(10, 342, 61, 39, "Sacar", false, Window_VS)
Button_VS_dy = guiCreateButton(75, 342, 61, 39, "Destrozar", false, Window_VS)
Button_VS_lk = guiCreateButton(184, 54, 67, 43, "Des/Bloquear", false, Window_VS)
Button_VS_bp = guiCreateButton(103, 54, 67, 43, "Des/Marcar", false, Window_VS)
Button_VS_Fix = guiCreateButton(205, 342, 61, 39, "Reparar", false, Window_VS)
Button_VS_sl = guiCreateButton(19, 54, 67, 43, "Vender", false, Window_VS)
Button_VS_Warp = guiCreateButton(141, 342, 61, 39, "Warpear", false, Window_VS)
 
 
 
 
 
Window_CHK = guiCreateWindow(screX/2-155,screY/2-60,310,120,"WARNING",false)
guiSetVisible(Window_CHK, false)
guiSetProperty(Window_CHK, "AlwaysOnTop", "true")
guiWindowSetSizable(Window_CHK, false)
Label_CHK = guiCreateLabel(21,28,266,36,"",false,Window_CHK)
guiLabelSetHorizontalAlign(Label_CHK,"center",true)
Button_CHK_Y = guiCreateButton(17,73,129,36,"Si",false,Window_CHK)
Button_CHK_N = guiCreateButton(161,73,129,36,"No",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 = getVehicleNameFrom{xml='vehicles.xml'}
            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("F6", "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, 'Esta Seguro En Vender Este Vehiculo "'..carName..'" Por $'..carprice)
    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
    end
end
addEventHandler("onClientGUIClick", resourceRoot, WINDOW_CLICK_VEHICLE)
 
function SpecVehicle(id)
 
    if spc then
        removeEventHandler("onClientPreRender", root, Sp)
        setCameraTarget(localPlayer)
        if isTimer(freezTimer) then killTimer(freezTimer) end
        freezTimer = setTimer(function() setElementFrozen(localPlayer, false) end, 2500, 1)
        spc = false
    return end
    for i, vehicle in ipairs(getElementsByType("vehicle")) do
        if getElementData(vehicle, "Owner") == localPlayer and getElementData(vehicle, "ID") == id then
            cVeh = vehicle
            spc = true
            addEventHandler("onClientPreRender", root, Sp)
            guiSetVisible(Window_VS, false)
            showCursor(false)
            break
          end
                       
    end
end
 
function Sp()
    if isElement(cVeh) then
        local x, y, z = getElementPosition(cVeh)
        setElementFrozen(localPlayer, true)
        setCameraMatrix(x, y-1, z+15, x, y, z)
 
    else
        removeEventHandler("onClientPreRender", root, Sp)
        setCameraTarget(localPlayer)
        if isTimer(freezTimer) then killTimer(freezTimer) end
        freezTimer = setTimer(function() setElementFrozen(localPlayer, false) end, 2500, 1)
        spc = false
      end
end
 
ShopMarkersTable = {}   
 
local ShopTable = {
    [1] = {ID = {{579, 70000}
        ,{400, 1000000}
        ,{404, 38000}
        ,{489, 75000}
        ,{505, 75000}
        ,{479, 55000}
        ,{442, 55000}
        ,{458, 55000}
        ,{602, 60000}
        ,{496, 52500}
        ,{401, 51000}
        ,{518, 70000}
        ,{527, 85000}
        ,{589, 85000}
        ,{419, 55000}
        ,{533, 85000}
        ,{526, 60000}
        ,{474, 65000}
        ,{545, 60000}
        ,{517, 55000}
        ,{410, 51000}
        ,{600, 60000}
        ,{436, 51000}
        ,{580, 60000}
        ,{439, 85000}
        ,{549, 85000}
        ,{491, 55000}
        ,{445, 55000}
        ,{507, 55000}
        ,{585, 55000}
        ,{587, 85000}
        ,{466, 65000}
        ,{492, 60000}
        ,{546, 55000}
        ,{551, 55000}
        ,{516, 55000}
        ,{467, 55000}
        ,{426, 57500}
        ,{547, 55000}
        ,{405, 65000}
        ,{409, 85000}
        ,{550, 55000}
        ,{566, 55000}
        ,{540, 55000}
        ,
Link to comment
  • 4 weeks later...
  • Recently Browsing   0 members

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