Jump to content

SoySuperxD

Members
  • Posts

    9
  • Joined

  • Last visited

Posts posted by SoySuperxD

  1.  

    ERROR EN LA CONSOLA: ERROR:  items/itemsS.lua:671: attempt to index global 'trash' (a nil value)

    El error me aparece cada vez que inicio el server y cada vez que le hago restart a cualquier script, no entiendo, me tiene cabezón. 

    Resalto la línea 671 del error en amarrillo. (línea del supuesto error) 

    local sistemaitems

    function loadTrash()
        local query = dbQuery(connection, "SELECT * FROM bins;" )
        local result, numrows = dbPoll(query, -1)
        if (result and numrows > 0) then
            for index, trashPos in pairs(result) do
                trashPos = fromJSON(trash["pos"]) or "[[ 0,0,0,0,0,0,0,0 ]]"
                sistemaitems = createObject(1359, trashPos[1],trashPos[2], trashPos[3]-0.4, trashPos[4], trashPos[5], trashPos[6])
                setElementData(sistemaitems, "sistemaID", trash['id'])
                setElementInterior(sistemaitems, trashPos[7])
                setElementDimension(sistemaitems, trashPos[8])
            end
        end
    end

     

    addCommandHandler("papelera",
    function(playerSource, cmd)
            if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(playerSource)), aclGetGroup("Console")) then
            local x, y, z = getElementPosition(playerSource)
            local rx, ry, rz = getElementRotation(playerSource)
            local int = getElementInterior(playerSource)
            local Dim = getElementDimension(playerSource)
            
            local Query, _, insertID = dbQuery(connection,"INSERT INTO bins (pos) VALUES(?)", toJSON({x, y, z, rx, ry, rz, int ,Dim}))


            local checkQuery, _, insertID = dbPoll ( Query, -1 )
            if checkQuery then
                outputChatBox("#7cc776[Inventario] #ffffff Papelera creada.", playerSource, 255,255, 255, true)
                sistemaitems = createObject(1359, x, y, z-0.4, rx, ry, rz)
                setElementData(sistemaitems, "sistemaID", insertID)
                setElementInterior(sistemaitems, int)
                setElementDimension(sistemaitems, Dim)
            end
        end
    end)

    El código es parte de un sistema de papelera para desechar items, todo lo demás corre muy bien.

    Será algún problema con mi sistema de ID?

  2. 6 minutes ago, Tut said:

    Hey,

    I don't think you can replace the TXD.

    What you can do is load your textures as shader replacements. A basic shader will let you wrap an image around an existing texture.
    https://wiki.multitheftauto.com/wiki/EngineApplyShaderToWorldTexture

    Your thread has been moved to the Scripting forum for best results.

    Thank you very kind, actually what I want to change from that .txd is the vehiclegrunge256, it is the one that gives the vehicles a dirty look, and I want to remove it and replace it with a white image to eliminate the dirt effect

  3. Greetings to the entire MTA Community, my problem is that I want to replace the .txd called (vehicle.txd) which is located in GTASanAndreas \ models \ generic.

    I have searched all over google and apparently this .txd has no id. My question is: How do I replace it through a script?

  4. Friend, I am translating a scripts, it is not compiled, but there is a section that when I change the words the scripts stop working, is there a special command?

    this is the script, what is underlined in red is what I want to translate, what can I do?

    If I change it directly it stops working, and check the other .lua files and it is the only script where that category appears that is reflected in a GUI

    -----------------------------------------------------------------------------------------------------------------------------

    local screenW,screenH = guiGetScreenSize()
    local resW, resH = 1366, 768
    local x, y =  (screenW/resW), (screenH/resH)

    local Font_1 = dxCreateFont("font/font.ttf", x*12)
    local Font_2 = dxCreateFont("font/font1.ttf", x*10)
    local Font_3 = dxCreateFont("font/fontNick.ttf", x*10)
    local Font_4 = dxCreateFont("font/OpenSans-Bold.ttf", x*11)
    local Font_6 = dxCreateFont("font/OpenSans-Bold.ttf", x*15)
    local Font_7 = dxCreateFont("font/fontNick.ttf", x*13)

    function getTimeLeft(timer)
      if isTimer(timer) then
        local ms = getTimerDetails(timer)
        local m = math.floor(ms/60000)
        local s = math.floor((ms-m*60000)/1000)
        if m < 10 then m = "0"..m end
        if s < 10 then s = "0"..s end
        return m..":"..s
     end
    end


    --[[
             ><><><><><><><><><><><><><><><
             ><       Abrir/Fechar       ><
             ><><><><><><><><><><><><><><><
    --]]
    function Abrir_Categorias ()
    if isEventHandlerAdded("onClientRender", getRootElement(), Dx_TirarCNH) then return end
    addEventHandler("onClientRender", root, Dx_TirarCNH)
    ListaCategorias:SetVisible(true)
    showCursor(true)
    showChat(false)
    end
    addEvent("DNL:AbrirCategorias", true)
    addEventHandler("DNL:AbrirCategorias", root, Abrir_Categorias)

    function Fechar_Categorias ()
      if isEventHandlerAdded("onClientRender", getRootElement(), Dx_TirarCNH) then  
         removeEventHandler("onClientRender", root, Dx_TirarCNH)
         ListaCategorias:SetVisible(false)
         showCursor(false)
         showChat(true)
      end
    end
    addEvent("DNL:FecharCategorias", true)
    addEventHandler("DNL:FecharCategorias", root, Fechar_Categorias)

    function Dx_TirarCNH ()
            dxDrawRectangle(x*418, y*218, x*531, y*293, tocolor(0, 0, 0, 177), false) -- Fundo
            dxDrawRectangle(x*418, y*218, x*531, y*34, tocolor(0, 0, 0, 202), false) -- Cabecario        
            dxDrawLine(x*417, y*251, x*949, y*250, tocolor(0, 255, 0, 255), x*2, false) -- Line Enfeite
            dxDrawText("Auto Escuela", x*646, y*223, x*720, y*243, tocolor(255, 255, 255, 255), x*1.00, Font_1, "left", "top", false, false, false, false, false)
            
            dxDrawImage(x*489, y*449, x*186, y*47, "Img/botao.png", 0, 0, 0, Corteste, false)    
            dxDrawText("Hacer Examen", x*544, y*463, x*622, y*484, tocolor(255, 255, 255, 255), x*1.00, Font_4, "left", "top", false, false, false, false, false)    
            Corteste = tocolor(0, 255, 0, 150)
          if isCursorOnElement ( x*489, y*449, x*186, y*47 ) then
            Corteste = tocolor(0, 255, 0, 255)
          end
            
            dxDrawImage(x*687, y*449, x*186, y*47, "Img/botao.png", 0, 0, 0, CorCancel, false)
            dxDrawText("Cancelar", x*752, y*463, x*809, y*484, tocolor(255, 255, 255, 255), x*1.00, Font_4, "left", "top", false, false, false, false, false)
            CorCancel = tocolor(255, 0, 0, 150)
          if isCursorOnElement ( x*687, y*449, x*186, y*47 ) then
            CorCancel = tocolor(255, 0, 0, 255)
          end
    end
    --addEventHandler("onClientRender", root, Dx_TirarCNH)

    Categorias = {
        {"Moto", 0, 800, "A"},
        {"Carro", 0, 1000, "B"},
        {"Caminhao", 0, 2000, "C"},
        {"Carreta", 0, 3000, "D"},
        {"Helicóptero", 0, 5000, "E"},
    }

    addEventHandler("onClientResourceStart", resourceRoot,
      function ()
        ListaCategorias = dxGridW:Create(x*424, y*258, x*519, y*177)
        ListaCategorias:AddColumn("Categoria", x*180)
        ListaCategorias:AddColumn("Nivel Requerido", x*177)
        ListaCategorias:AddColumn("Precio", x*155)
        ListaCategorias:AddColumn("Categoria", x*400)
        ListaCategorias:SetVisible(false)
        
        for i,v in ipairs (Categorias) do
                ListaCategorias:AddItem(1, tostring(v[1]))
                ListaCategorias:AddItem(2, tostring(v[2]))
                ListaCategorias:AddItem(3, tostring(v[3]))
                ListaCategorias:AddItem(4, tostring(v[4]))
        end
    end)

    --[[
             ><><><><><><><><><><><><><><><
             ><       Fazer_Teste        ><
             ><><><><><><><><><><><><><><><
    --]]
    function FazerCNH ( _,state )
      if isEventHandlerAdded("onClientRender", getRootElement(), Dx_TirarCNH) then  
       if state == "down" then
       
        if isCursorOnElement(x*687, y*449, x*186, y*47) then
           Fechar_Categorias ()
        end
        
        if isCursorOnElement(x*489, y*449, x*186, y*47) then
           local SelectCategoria = ListaCategorias:GetSelectedItem()
           local Cat_Name = ListaCategorias:GetItemDetails(1, SelectCategoria)
           local Level_Cat = ListaCategorias:GetItemDetails(2, SelectCategoria)
           local Preco_Cat = ListaCategorias:GetItemDetails(3, SelectCategoria)
           local CategoriaVeh = ListaCategorias:GetItemDetails(3, SelectCategoria)
           local Hab = getElementData(localPlayer, "DNL:Categoria("..CategoriaVeh.."")
           local Level = tonumber(getElementData(localPlayer, "Level")) or 0
           if SelectCategoria > -1 then  
            if Hab == false then
             if Level >= tonumber(Level_Cat) then
                triggerServerEvent("DNL:Teste("..Cat_Name..")", root, localPlayer)     
              else
                outputChatBox ( "#00ff00✘ #ffffffINFO #00ff00✘➺ #ffffffSu nivel es demasiado bajo y no puede realizar esta prueba!", 255,255,255, true)
             end
             
             else
               outputChatBox ( "#00ff00✘ #ffffffINFO #00ff00✘➺ #ffffffYa tienes esta licencia!", 255,255,255, true)
            end
            
            else                   
              outputChatBox ( "#00ff00✘ #ffffffINFO #00ff00✘➺ #ffffffSeleccione la categoría que desea hacer.", 255,255,255, true)
           end
             
        end
       end
      end
    end
    addEventHandler ( "onClientClick", root, FazerCNH )
            
            
    function Dx_Praticando ()
      local Veiculo = getPedOccupiedVehicle(localPlayer)    
      if ( getElementHealth( Veiculo ) >= 1000 ) then
        Life = 100
      else
        Life = math.floor(getElementHealth( Veiculo )/10)
      end    
            dxDrawRectangle(x*519, y*608, x*328, y*140, tocolor(0, 0, 0, 160), false) -- Fundo 
            dxDrawLine(x*519, y*610, x*847, y*610, tocolor(0, 255, 0, 255), x*4, false) -- Line Enfeite
            dxDrawText("Tiempo", x*656, y*620, x*716, y*644, tocolor(255, 255, 255, 255), x*1.00, Font_6, "left", "top", false, false, false, false, false)
            dxDrawText("Vida del Vehículo", x*652, y*678, x*719, y*692, tocolor(255, 255, 255, 255), x*1.00, Font_3, "left", "top", false, false, false, false, false)
            dxDrawRectangle(x*573, y*696, x*220, y*42, tocolor(0, 0, 0, 160), false)
            dxDrawRectangle(x*573, y*696, x*220/100*Life, y*42, tocolor(0, 255, 0, 160), false)  
        
        if getElementData(localPlayer, "Categoria") == "A" then
            dxDrawText(""..getTimeLeft(Tempo_Moto[localPlayer]).."", x*665, y*645, x*704, y*668, tocolor(0, 255, 0, 255), x*1.00, Font_6, "left", "top", false, false, false, false, false)      
            dxDrawText(""..Life.."", x*669, y*705, x*719, y*692, tocolor(255, 255, 255, 255), x*1.00, Font_7, "left", "top", false, false, false, false, false)    

        elseif getElementData(localPlayer, "Categoria") == "B" then
            dxDrawText(""..getTimeLeft(Tempo_Carro[localPlayer]).."", x*665, y*645, x*704, y*668, tocolor(0, 255, 0, 255), x*1.00, Font_6, "left", "top", false, false, false, false, false)      
            dxDrawText(""..Life.."", x*669, y*705, x*719, y*692, tocolor(255, 255, 255, 255), x*1.00, Font_7, "left", "top", false, false, false, false, false)

        elseif getElementData(localPlayer, "Categoria") == "C" then
            dxDrawText(""..getTimeLeft(Tempo_Caminhao[localPlayer]).."", x*665, y*645, x*704, y*668, tocolor(0, 255, 0, 255), x*1.00, Font_6, "left", "top", false, false, false, false, false)      
            dxDrawText(""..Life.."", x*669, y*705, x*719, y*692, tocolor(255, 255, 255, 255), x*1.00, Font_7, "left", "top", false, false, false, false, false)
        
        elseif getElementData(localPlayer, "Categoria") == "D" then
            dxDrawText(""..getTimeLeft(Tempo_Carreta[localPlayer]).."", x*665, y*645, x*704, y*668, tocolor(0, 255, 0, 255), x*1.00, Font_6, "left", "top", false, false, false, false, false)      
            dxDrawText(""..Life.."", x*669, y*705, x*719, y*692, tocolor(255, 255, 255, 255), x*1.00, Font_7, "left", "top", false, false, false, false, false)

        elseif getElementData(localPlayer, "Categoria") == "E" then
            dxDrawText(""..getTimeLeft(Tempo_Heli[localPlayer]).."", x*665, y*645, x*704, y*668, tocolor(0, 255, 0, 255), x*1.00, Font_6, "left", "top", false, false, false, false, false)      
            dxDrawText(""..Life.."", x*669, y*705, x*719, y*692, tocolor(255, 255, 255, 255), x*1.00, Font_7, "left", "top", false, false, false, false, false)
        end
        
    end

    Tempo_Moto = {}
    Tempo_Carro = {}
    Tempo_Caminhao = {}
    Tempo_Carreta = {}
    Tempo_Heli = {}

    --[[
             ><><><><><><><><><><><><><><><
             ><        Tempo_Moto       ><
             ><><><><><><><><><><><><><><><
    --]]
    function Tempo_MotoC ()    
        setPedCanBeKnockedOffBike ( localPlayer, false )
        addEventHandler("onClientRender", root, Dx_Praticando)
        Tempo_Moto[localPlayer] = setTimer(function()
            triggerServerEvent("DNL:Tempo(Moto)", localPlayer) 
            removeEventHandler("onClientRender", root, Dx_Praticando)
            setPedCanBeKnockedOffBike ( localPlayer, true )
        end, 180000, 2)  
    end
    addEvent("DNL:TempoC(Moto)", true)
    addEventHandler("DNL:TempoC(Moto)", root, Tempo_MotoC)

    function SucessidoMoto ()    
        if isTimer(Tempo_Moto[localPlayer]) then
            killTimer(Tempo_Moto[localPlayer])
            removeEventHandler("onClientRender", root, Dx_Praticando)
            setPedCanBeKnockedOffBike ( localPlayer, true )
        end
    end
    addEvent("DNL:KillTimer(Moto)", true)
    addEventHandler("DNL:KillTimer(Moto)", root, SucessidoMoto)

    --[[
             ><><><><><><><><><><><><><><><
             ><        Tempo_Carro       ><
             ><><><><><><><><><><><><><><><
    --]]
    function Tempo_CarroC ()    
        addEventHandler("onClientRender", root, Dx_Praticando)
        Tempo_Carro[localPlayer] = setTimer(function()
            triggerServerEvent("DNL:Tempo(Carro)", localPlayer) 
            removeEventHandler("onClientRender", root, Dx_Praticando)
        end, 190000, 2)  
    end
    addEvent("DNL:TempoC(Carro)", true)
    addEventHandler("DNL:TempoC(Carro)", root, Tempo_CarroC)

    function SucessidoCarro ()    
        if isTimer(Tempo_Carro[localPlayer]) then
            killTimer(Tempo_Carro[localPlayer])
            removeEventHandler("onClientRender", root, Dx_Praticando)
        end
    end
    addEvent("DNL:KillTimer(Carro)", true)
    addEventHandler("DNL:KillTimer(Carro)", root, SucessidoCarro)

    --[[
             ><><><><><><><><><><><><><><><
             ><      Tempo_Caminhao      ><
             ><><><><><><><><><><><><><><><
    --]]
    function Tempo_CaminhaosC ()    
        addEventHandler("onClientRender", root, Dx_Praticando)
        Tempo_Caminhao[localPlayer] = setTimer(function()
            triggerServerEvent("DNL:Tempo(Caminhao)", localPlayer) 
            removeEventHandler("onClientRender", root, Dx_Praticando)
        end, 900000, 2)  
    end
    addEvent("DNL:TempoC(Caminhao)", true)
    addEventHandler("DNL:TempoC(Caminhao)", root, Tempo_CaminhaosC)

    function SucessidoCaminhao ()    
        if isTimer(Tempo_Caminhao[localPlayer]) then
            killTimer(Tempo_Caminhao[localPlayer])
            removeEventHandler("onClientRender", root, Dx_Praticando)
        end
    end
    addEvent("DNL:KillTimer(Caminhao)", true)
    addEventHandler("DNL:KillTimer(Caminhao)", root, SucessidoCaminhao)

    --[[
             ><><><><><><><><><><><><><><><
             ><      Tempo_Carreta       ><
             ><><><><><><><><><><><><><><><
    --]]
    function Tempo_CarretaC ()    
        addEventHandler("onClientRender", root, Dx_Praticando)
        Tempo_Carreta[localPlayer] = setTimer(function()
            triggerServerEvent("DNL:Tempo(Carreta)", localPlayer) 
            removeEventHandler("onClientRender", root, Dx_Praticando)
        end, 1850000, 2)  
    end
    addEvent("DNL:TempoC(Carreta)", true)
    addEventHandler("DNL:TempoC(Carreta)", root, Tempo_CarretaC)

    function SucessidoCarreta ()    
        if isTimer(Tempo_Carreta[localPlayer]) then
            killTimer(Tempo_Carreta[localPlayer])
            removeEventHandler("onClientRender", root, Dx_Praticando)
        end
    end
    addEvent("DNL:KillTimer(Carreta)", true)
    addEventHandler("DNL:KillTimer(Carreta)", root, SucessidoCarreta)


    --[[
             ><><><><><><><><><><><><><><><
             ><        Tempo_Heli        ><
             ><><><><><><><><><><><><><><><
    --]]
    function Tempo_HeliC ()    
        addEventHandler("onClientRender", root, Dx_Praticando)
        Tempo_Heli[localPlayer] = setTimer(function()
            triggerServerEvent("DNL:Tempo(Heli)", localPlayer) 
            removeEventHandler("onClientRender", root, Dx_Praticando)
        end, 4400000, 2)  
    end
    addEvent("DNL:TempoC(Helicóptero)", true)
    addEventHandler("DNL:TempoC(Helicóptero)", root, Tempo_HeliC)

    function SucessidoHeli ()    
        if isTimer(Tempo_Heli[localPlayer]) then
            killTimer(Tempo_Heli[localPlayer])
            removeEventHandler("onClientRender", root, Dx_Praticando)
        end
    end
    addEvent("DNL:KillTimer(Heli)", true)
    addEventHandler("DNL:KillTimer(Heli)", root, SucessidoHeli)

                                       --=============================--
                                       ------------- IGNORA ------------
                                       --=============================--
                    
    addEventHandler ( "onClientPlayerDamage",root,
    function ()
        if getElementData(source,"DNL:TestePratico") then
            cancelEvent()
        end
    end)
                       
    function isEventHandlerAdded( sEventName, pElementAttachedTo, func )
        if 
            type( sEventName ) == 'string' and 
            isElement( pElementAttachedTo ) and 
            type( func ) == 'function' 
        then
            local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo )
            if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then
                for i, v in ipairs( aAttachedFunctions ) do
                    if v == func then
                        return true
                    end
                end
            end
        end

        return false
    end

    local x,y = guiGetScreenSize()
    function isCursorOnElement(x, y, w, h)
        if (not isCursorShowing()) then
            return false
        end
        local mx, my = getCursorPosition()
        local fullx, fully = guiGetScreenSize()
        cursorx, cursory = mx*fullx, my*fully
        if cursorx > x and cursorx < x + w and cursory > y and cursory < y + h then
            return true
        else
            return false
        end
    end
     

     

  5. Hello, I hope you are well, I have a question.

    I'm making a radar from scratch, it's ready, but the blips look very small on the radar, that is, in 0, I don't know how to set the option to change the size of the blips within the radar script, does anyone know the command? help

    thanks to everyone...

  6. Just now, SawCode said:

    @SuperHeroYT

    Hola

    haz tu pregunta en inglés, ¡te ayudaremos a la brevedad!

    Buena suerte

     Hello I am new within the community and I am creating a Spanish role play server, I downloaded 2 scripts from a youtube channel but they are compiled and in Portuguese language, is there any way to translate the scripts and the content of the GUI that runs its function, or some script that works as a total translator?

    Thank you very much in advance and greetings to the community!

  7. English: Hello I am new within the community and I am creating a Spanish role play server, I downloaded 2 scripts from a youtube channel but they are compiled and in Portuguese language, is there any way to translate the scripts and the content of the GUI that runs its function, or some script that works as a total translator?

    Thank you very much in advance and greetings to the community!

     

    Español: Hola soy nuevo dentro de la comunidad y estoy creando un servidor de juego de roles en español, descargué 2 scripts de un canal de youtube pero están compilados y en idioma portugués, hay alguna forma de traducir los scripts y el contenido de la GUI que ejecuta su función, ¿o algún script que funcione como traductor total? 

    Muchas gracias de antemano y saludos a la comunidad!

×
×
  • Create New...