Jump to content

Ayuda setting!


Flipi

Recommended Posts

Posted

Hola, como puedo hacer un setting que cumpla la función de cambiar el color del texto para un shout de admin.... (nunca eh realizado un script con setting)

Client....

local sx, sy = guiGetScreenSize() 
local sx = sx / 2 
local sy = sy / 2 
function drawText() 
    local width = dxGetTextWidth(theText, 3, "default") 
    local height = dxGetFontHeight(3, "default") 
    local leftB = sx - width / 2 
    local topB = sy - (height + 5) 
    local left = sx - width / 2 
    local top = sy - height 
    dxDrawText(theText, leftB+2, topB+2, left, top, tocolor(0, 0, 0, 255), 3, "default-bold", "left", "top", false, true, true) 
    dxDrawText(theText, leftB, topB, left, top, [[EN ESTA PARTE?]], 3, "default-bold", "left", "top", false, true, true) 
end 
draw = false 
function drawShout(text) 
    if not draw then 
        theText = text 
        addEventHandler("onClientRender", root, drawText) 
        draw = true 
        setTimer(function() 
        draw = false 
        removeEventHandler("onClientRender", root, drawText) 
        end, 5000, 1) 
    end 
end 
addEvent("onShouts", true) 
addEventHandler("onShouts", root, drawShout) 

Meta....

   
        name="*Colortexto"  
    value="#0080FF"  
    /> 
  

Posted

Es mas conveniente hacerlo así si es que usas colores hex.

dxDrawText(tuColor..theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 

Posted
Es mas conveniente hacerlo así si es que usas colores hex.
dxDrawText(tuColor..theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 

algo asi?

    local Color = 0080FF 
    dxDrawText(theText, leftB+2, topB+2, left, top, tocolor(0, 0, 0, 255), 3, "default-bold", "left", "top", false, true, true) 
    dxDrawText(..Color, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 

Posted

Esta muy mal esa sintaxis, seria así:

local Color = 0080FF 
    dxDrawText(theText, leftB+2, topB+2, left, top, tocolor(0, 0, 0, 255), 3, "default-bold", "left", "top", false, true, true) 
    dxDrawText(Color..theText, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 

Posted
Esta muy mal esa sintaxis, seria así:
local Color = 0080FF 
    dxDrawText(theText, leftB+2, topB+2, left, top, tocolor(0, 0, 0, 255), 3, "default-bold", "left", "top", false, true, true) 
    dxDrawText(Color..theText, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 

no me funciona :/ (server-side no tiene nada que ver cierto?)

Client...

local sx, sy = guiGetScreenSize() 
local sx = sx / 2 
local sy = sy / 2 
function drawText() 
    local width = dxGetTextWidth(theText, 3, "default") 
    local height = dxGetFontHeight(3, "default") 
    local leftB = sx - width / 2 
    local topB = sy - (height + 5) 
    local left = sx - width / 2 
    local top = sy - height 
    local Color = 0080FF 
    dxDrawText(theText, leftB+2, topB+2, left, top, tocolor(0, 0, 0, 255), 3, "default-bold", "left", "top", false, true, true) 
    dxDrawText(Color..theText, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 
end 
draw = false 
function drawShout(text) 
    if not draw then 
        theText = text 
        addEventHandler("onClientRender", root, drawText) 
        draw = true 
        setTimer(function() 
        draw = false 
        removeEventHandler("onClientRender", root, drawText) 
        end, 5000, 1) 
    end 
end 
addEvent("onShouts", true) 
addEventHandler("onShouts", root, drawShout) 

meta setting...

   
        name="*Colortexto"  
    value="#0080FF"  
    /> 

Posted
Tienes un error en el color, prueba con:
local Color = "0080FF" 

funciona, pero al cambiar el color del setting no pasa nada, solo se mantiene el color por defecto.

Posted
Tienes un error en el color, prueba con:
local Color = "0080FF" 

funciona, pero al cambiar el color del setting no pasa nada, solo se mantiene el color por defecto.

alguna idea?

Posted
Tienes un error en el color, prueba con:
local Color = "0080FF" 

Los códigos de color comienzan con un '#'.

si le puse el "#" al código, pero aún así no pasa nada..

Posted
usa si quieres que cargue el color que pusite en settings
get 

pero en que parte?

En el script, donde seteas el valor de la variable Color usa el mètodo get más el nombre de la configuración del meta (color supongo que sería)

Posted

En el script, donde seteas el valor de la variable Color usa el mètodo get más el nombre de la configuración del meta (color supongo que sería)

así?

    local Color = "#0080FF" 
    dxDrawText(get(Color)..theText, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 
end 

Posted
get es server-side

como seria, asi?

server...

function shout( player, cmd, ... ) 
    local accountname = getAccountName( getPlayerAccount( player ) ) 
    local w = {...} 
    local message = table.concat(w, " ") 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) )  then 
        triggerClientEvent ( root, "onShouts", root, message ) 
            if get ("ColorText") then 
             dxDrawText(ColorText, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 
    else 
        outputChatBox( "* #0080FFNo puedes usar este comando!", player, 255, 255, 255, true ) 
    end 
end 
end 
addCommandHandler( "shout", shout ) 

client....

local sx, sy = guiGetScreenSize() 
local sx = sx / 2 
local sy = sy / 2 
function drawText() 
    local width = dxGetTextWidth(theText, 3, "default") 
    local height = dxGetFontHeight(3, "default") 
    local leftB = sx - width / 2 
    local topB = sy - (height + 5) 
    local left = sx - width / 2 
    local top = sy - height 
    local ColorText = "#0080FF" 
    dxDrawText(theText, leftB+2, topB+2, left, top, tocolor(0, 0, 0, 255), 3, "default-bold", "left", "top", false, true, true) 
    dxDrawText(ColorText, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 
end 
draw = false 
function drawShout(text) 
    if not draw then 
        theText = text 
        addEventHandler("onClientRender", root, drawText) 
        draw = true 
        setTimer(function() 
        draw = false 
        removeEventHandler("onClientRender", root, drawText) 
        end, 5000, 1) 
    end 
end 
addEvent("onShouts", true) 
addEventHandler("onShouts", root, drawShout) 

modifique un poco el server-side, pero aún así no logro hacerlo funcionar

Posted
get es server-side

como seria, asi?

server...

function shout( player, cmd, ... ) 
    local accountname = getAccountName( getPlayerAccount( player ) ) 
    local w = {...} 
    local message = table.concat(w, " ") 
    if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "Admin" ) )  then 
        triggerClientEvent ( root, "onShouts", root, message ) 
            if get ("ColorText") then 
             dxDrawText(ColorText, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 
    else 
        outputChatBox( "* #0080FFNo puedes usar este comando!", player, 255, 255, 255, true ) 
    end 
end 
end 
addCommandHandler( "shout", shout ) 

client....

local sx, sy = guiGetScreenSize() 
local sx = sx / 2 
local sy = sy / 2 
function drawText() 
    local width = dxGetTextWidth(theText, 3, "default") 
    local height = dxGetFontHeight(3, "default") 
    local leftB = sx - width / 2 
    local topB = sy - (height + 5) 
    local left = sx - width / 2 
    local top = sy - height 
    local ColorText = "#0080FF" 
    dxDrawText(theText, leftB+2, topB+2, left, top, tocolor(0, 0, 0, 255), 3, "default-bold", "left", "top", false, true, true) 
    dxDrawText(ColorText, theText, leftB, topB, left, top, tocolor(255,255,255,255), 3, "default-bold", "left", "top", false, true, true,true) 
end 
draw = false 
function drawShout(text) 
    if not draw then 
        theText = text 
        addEventHandler("onClientRender", root, drawText) 
        draw = true 
        setTimer(function() 
        draw = false 
        removeEventHandler("onClientRender", root, drawText) 
        end, 5000, 1) 
    end 
end 
addEvent("onShouts", true) 
addEventHandler("onShouts", root, drawShout) 

modifique un poco el server-side, pero aún así no logro hacerlo funcionar

alguna ayuda?

  • Recently Browsing   0 members

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