Jump to content

Sasu

MTA Contributors
  • Posts

    1,056
  • Joined

  • Last visited

Posts posted by Sasu

  1. No entendieron mi codigo anterior pero bueno lo dejo como antes, intenta esto:

    local sx, sy = guiGetScreenSize() 
    local screenX = 1024 
    local screenY = 768 
    local scX, scY = ( 1 / screenX  ), ( 1 / screenY ) 
      
    function _dxDrawRectangle(posX, posY, ancho, largo, ...) 
        local x, y, w, h = sx * ( posX * scX ), sy * ( posY * scY), sx * ( ancho * scX ), sy * ( largo * scY) 
        dxDrawRectangle(x, y, w, h, ...) 
    end 
      
    function mostrarsed () 
        local sed = getElementData(localPlayer,"sed") or 100 
        local anchototal = 120 
        local anchototal2 = (sed*anchototal)/100 
        _dxDrawRectangle( 842 , 185,  138,  86, tocolor(0, 0, 0, 90), false) 
        _dxDrawRectangle( 848, 198, 124, 14, tocolor(0, 0, 0, 255), false) 
        _dxDrawRectangle( 850, 200, anchototal, 10, tocolor(0, 0, 0, 90), false) 
        _dxDrawRectangle( 850, 200, anchototal2, 10, tocolor(0, 255, 0, 200), false) 
        _dxDrawText("Sed", sx * ( 890 * scX ), sy * ( 184 * scY), sx * ( 845 * scX ), sy * ( 213* scY), tocolor(255, 255, 255, 255), 0.40, "bankgothic", "left", "top", false, false, false, false, false) 
    end 
      
    function abrirsed() 
    addEventHandler ( "onClientRender", getRootElement(), mostrarsed ) 
    end 
    addEvent( "onSed", true ) 
    addEventHandler( "onSed", getRootElement(), abrirsed ) 
    

  2. De hecho, hice que el dxDrawRectangle pase a llamarse _dxDrawRectangle asi pudiera crear una funcion con el nombre del dxDrawRectangle pero que este se diferencie en que los valores absolutos de los primeros cuatro argumentos los convierta en valores relativos. Despues lo demás no cambie nada, asi que no me lo agredezcas a mí, tan solo ordené un poco el script.

  3. local sx, sy = guiGetScreenSize() 
    local screenX = 1024 
    local screenY = 768 
    local scX, scY = ( 1 / screenX  ), ( 1 / screenY ) 
    local _dxDrawRectangle = dxDrawRectangle 
      
    function dxDrawRectangle(posX, posY, ancho, largo, ...) 
        local x, y, w, h = sx * ( posX * scX ), sy * ( posY * scY), sx * ( ancho * scX ), sy * ( largo * scY) 
        _dxDrawRectangle(x, y, w, h, ...) 
    end 
      
    function mostrarsed () 
        local sed = getElementData(localPlayer,"sed") or 100 
        local anchototal = 120 
        local anchototal2 = (sed*anchototal)/100 
        dxDrawRectangle( 842 , 185,  138,  86, tocolor(0, 0, 0, 90), false) 
        dxDrawRectangle( 848, 198, 124, 14, tocolor(0, 0, 0, 255), false) 
        dxDrawRectangle( 850, 200, anchototal, 10, tocolor(0, 0, 0, 90), false) 
        dxDrawRectangle( 850, 200, anchototal2, 10, tocolor(0, 255, 0, 200), false) 
        dxDrawText("Sed", sx * ( 890 * scX ), sy * ( 184 * scY), sx * ( 845 * scX ), sy * ( 213* scY), tocolor(255, 255, 255, 255), 0.40, "bankgothic", "left", "top", false, false, false, false, false) 
    end 
      
    function abrirsed() 
    addEventHandler ( "onClientRender", getRootElement(), mostrarsed ) 
    end 
    addEvent( "onSed", true ) 
    addEventHandler( "onSed", getRootElement(), abrirsed ) 
    

  4. Y por que no directamente usas el sistema de 'admin' diseñado por Lil_Toady?

    El problema, es que CLIENT no admite todos los fetchRemote (o almenos, hace 2 dias, que fue cuando probé)

    De esta forma puedes usar

    getElementData(element, "lang") --en servidor 
    getElementData(localPlayer, "lang") --en client 
    

    local mensajes = { 
        ["ES"] = "Bienvenido al servidor", 
        ["PT"] = "Benvido ao servidor", 
        ["EN"] = "Welcome to server" 
    } 
    function subLang (value) 
    local langs = { 
        ["ES"] = {"MX", "VE", "SV", "PY", "PE", "AR", "CL", "UY", "CO", "EC"}, 
        ["PT"] = {"BR"}, 
        ["EN"] = {} 
    } 
        for k,v in pairs(langs) do 
            for k,v in ipairs(v) do 
                if v == value then 
                return k 
                end 
            end 
        end 
    return "EN" 
    end 
      
    function getLang(player) 
    local country = subLang(exports.admin:getPlayerCountry(player)) 
        if country then 
        return country 
        else 
        return false 
        end 
    end 
    addEventHandler("onPlayerJoin", root, 
        function () 
        local country = getLang(source) 
            if country then 
            setElementData(source, "lang", country) 
            end 
        end 
    ) 
    addEventHandler("onResourceStart", resourceRoot, 
        function () 
            for k,v in ipairs(getElementsByType('player')) do 
                if not getElementData(v, "lang") then 
                local country = getLang(v) 
                    if country then 
                    setElementData(v, "lang", country) 
                    end 
                end 
            end 
        end 
    ) 
    

    Dijo que no le devolvia el pais de la IP española.

    @Dannys, fetchRemote funciona con web's remotas(no son propio del mismo host) solo en server-side, tendras que usar triggerClientEvent

  5. fetchRemote("http://ip-api.com/json/"..getPlayerIP(player), returnData, "", false, player) 
      
    function returnData(data, err, player) 
        if err == 0 then 
            local json = fromJSON(data) 
            outputChatBox(getPlayerName(player).." proviene de "..json.country, root) 
        end 
    end 
    

    No lo he probado, estoy desde el telefono.

  6. Bubble chat

    Well, as the tittle says, is a bubble chat resource.

    Screenshots:

    18476.png

    *- Rounded rectangle(optional) | v1.1.0 (05/09/15):

    18532.png

    *- Rounded rectangle improved(optional) Thanks to Piorun's function | v1.2 (26/01/2016):

    19411.png

    Resource's download: https://community.multitheftauto.com/index.php?p= ... s&id=12008

    SUGGESTIONS ARE ACCEPTED!

    CHANGELOG

    *- Rounded rectangle(optional) | v1.1.0 (05/09/15): Added rounded rectangle(optional)! Go to client.lua and modify line 5 (I left a note) [suggestion by ramyxFa]

    *- Rounded rectangle improved(optional) Thanks to Piorun's function | v1.2 (26/01/2016): New way to round rectangles

    . All credits of this new way to Piorun! Added selfVisible argument.
  7. Mod downloader (beta)

    Hi there!

    I've just made a mod downloader. With this resource, you can download mods that you want using a GUI(open with /mods). Make sure you add files in the meta.xml and in mods.lua, where you have an example. Having some doubt? Ask me here.

    Screenshots:

    18453.png

    18454.png

    18455.png

    18456.png

    18457.png

    WARNING: This resource is a beta version, so it may fail. If you find any bug, reply this thread.

    Resource's download: https://community.multitheftauto.com/index.php?p= ... s&id=12000

×
×
  • Create New...