Flipi Posted November 4, 2013 Share Posted November 4, 2013 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" /> Link to comment
Bc# Posted November 4, 2013 Share Posted November 4, 2013 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) Link to comment
Flipi Posted November 4, 2013 Author Share Posted November 4, 2013 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) Link to comment
Bc# Posted November 4, 2013 Share Posted November 4, 2013 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) Link to comment
Flipi Posted November 4, 2013 Author Share Posted November 4, 2013 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" /> Link to comment
Bc# Posted November 4, 2013 Share Posted November 4, 2013 Tienes un error en el color, prueba con: local Color = "0080FF" Link to comment
Flipi Posted November 4, 2013 Author Share Posted November 4, 2013 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. Link to comment
Flipi Posted November 5, 2013 Author Share Posted November 5, 2013 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? Link to comment
Alexs Posted November 5, 2013 Share Posted November 5, 2013 Tienes un error en el color, prueba con: local Color = "0080FF" Los códigos de color comienzan con un '#'. Link to comment
Flipi Posted November 5, 2013 Author Share Posted November 5, 2013 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.. Link to comment
Arsilex Posted November 5, 2013 Share Posted November 5, 2013 usa si quieres que cargue el color que pusite en settings get Link to comment
Flipi Posted November 5, 2013 Author Share Posted November 5, 2013 usa si quieres que cargue el color que pusite en settings get pero en que parte? Link to comment
Renkon Posted November 6, 2013 Share Posted November 6, 2013 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) Link to comment
Flipi Posted November 6, 2013 Author Share Posted November 6, 2013 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 Link to comment
Flipi Posted November 6, 2013 Author Share Posted November 6, 2013 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 Link to comment
Flipi Posted November 7, 2013 Author Share Posted November 7, 2013 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? Link to comment
Recommended Posts