xRGamingx Posted January 30, 2018 Posted January 30, 2018 (edited) Hello Friends, I need your help.. I have this random chat, and I want the chat to disappear in slow motion. interpolateBetween Help me please How to fade out DX? ---Client setElementData (localPlayer,"SXPadMensajes",true) function removeColorCoding( name ) return type(name)=='string' and string.gsub ( name, '#%x%x%x%x%x%x', '' ) or name end addCommandHandler ("chat", function () if isTimer (ReactivacionTimer) then killTimer (ReactivacionTimer) end if getElementData (localPlayer,"SXPadMensajes") == true then addGuiText ("Chat Off",255,255,255) addGuiText ("Chat of for 15min",255,255,255) setElementData (localPlayer,"SXPadMensajes",false) ReactivacionTimer = setTimer (function () setElementData (localPlayer,"SXPadMensajes",true) end, 600000, 1) else setElementData (localPlayer,"SXPadMensajes",true) addGuiText ("Chat On.",255,255,255) end end) function addGuiText(text,c1,c2,c3) if getElementData (localPlayer,"SXPadMensajes") == true then outputSGuiText(text,c1,c2,c3) if not isTimer (removeall) then removeall = setTimer (epic, 10000, 1) else killTimer (removeall) removeall = setTimer (epic, 8000, 1) end end end addEvent("callOutputGuiText",true) addEventHandler("callOutputGuiText",root, addGuiText ) x,y = guiGetScreenSize() gui1 = guiCreateLabel(x,0,0,0,"",false) gui2 = guiCreateLabel(x,0,0,0,"",false) gui3 = guiCreateLabel(x,0,0,0,"",false) gui4 = guiCreateLabel(x,0,0,0,"",false) gui5 = guiCreateLabel(x,0,0,0,"",false) guiSetVisible(gui1,false) guiSetVisible(gui2,false) guiSetVisible(gui3,false) guiSetVisible(gui4,false) guiSetVisible(gui5,false) guic1 = guiCreateLabel(x,0,0,0,"-65536",false) guic2 = guiCreateLabel(x,0,0,0,"-65536",false) guic3 = guiCreateLabel(x,0,0,0,"-65536",false) guic4 = guiCreateLabel(x,0,0,0,"-65536",false) guic5 = guiCreateLabel(x,0,0,0,"-65536",false) guiSetVisible(guic1,false) guiSetVisible(guic2,false) guiSetVisible(guic3,false) guiSetVisible(guic4,false) guiSetVisible(guic5,false) guit1 = guiCreateLabel(x,0,0,0,"10000000",false) guit2 = guiCreateLabel(x,0,0,0,"10000000",false) guit3 = guiCreateLabel(x,0,0,0,"10000000",false) guit4 = guiCreateLabel(x,0,0,0,"10000000",false) guit5 = guiCreateLabel(x,0,0,0,"10000000",false) guiSetVisible(guit1,false) guiSetVisible(guit2,false) guiSetVisible(guit3,false) guiSetVisible(guit4,false) guiSetVisible(guit5,false) function drawit() text1 = guiGetText(gui1) text2 = guiGetText(gui2) text3 = guiGetText(gui3) text4 = guiGetText(gui4) text5 = guiGetText(gui5) color1 = guiGetText(guic1) color2 = guiGetText(guic2) color3 = guiGetText(guic3) color4 = guiGetText(guic4) color5 = guiGetText(guic5) a = 0.02 dx5 = dxDrawText(removeColorCoding(text5), (x * 0.0078) - 1, (y * 0.4367) - 1, (x * 0.8930) - 1, (y * 0.4633) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx5 = dxDrawText(removeColorCoding(text5), (x * 0.0078) + 1, (y * 0.4367) - 1, (x * 0.8930) + 1, (y * 0.4633) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx5 = dxDrawText(removeColorCoding(text5), (x * 0.0078) - 1, (y * 0.4367) + 1, (x * 0.8930) - 1, (y * 0.4633) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx5 = dxDrawText(removeColorCoding(text5), (x * 0.0078) + 1, (y * 0.4367) + 1, (x * 0.8930) + 1, (y * 0.4633) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx5 = dxDrawText(text5, x * 0.0078, y * 0.4367, x * 0.8930, y * 0.4633, tonumber(color5), 1, "default-bold", "left", "top", false, false, false, true, false) dx4 = dxDrawText(removeColorCoding(text4), (x * 0.0078) - 1, (y * 0.4633) - 1, (x * 0.8930) - 1, (y * 0.4900) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx4 = dxDrawText(removeColorCoding(text4), (x * 0.0078) + 1, (y * 0.4633) - 1, (x * 0.8930) + 1, (y * 0.4900) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx4 = dxDrawText(removeColorCoding(text4), (x * 0.0078) - 1, (y * 0.4633) + 1, (x * 0.8930) - 1, (y * 0.4900) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx4 = dxDrawText(removeColorCoding(text4), (x * 0.0078) + 1, (y * 0.4633) + 1, (x * 0.8930) + 1, (y * 0.4900) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx4 = dxDrawText(text4, x * 0.0078, y * 0.4633, x * 0.8930, y * 0.4900, tonumber(color4), 1, "default-bold", "left", "top", false, false, false, true, false) dx3 = dxDrawText(removeColorCoding(text3), (x * 0.0078) - 1, (y * 0.4900) - 1, (x * 0.8930) - 1, (y * 0.5167) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx3 = dxDrawText(removeColorCoding(text3), (x * 0.0078) + 1, (y * 0.4900) - 1, (x * 0.8930) + 1, (y * 0.5167) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx3 = dxDrawText(removeColorCoding(text3), (x * 0.0078) - 1, (y * 0.4900) + 1, (x * 0.8930) - 1, (y * 0.5167) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx3 = dxDrawText(removeColorCoding(text3), (x * 0.0078) + 1, (y * 0.4900) + 1, (x * 0.8930) + 1, (y * 0.5167) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx3 = dxDrawText(text3, x * 0.0078, y * 0.4900, x * 0.8930, y * 0.5167, tonumber(color3), 1, "default-bold", "left", "top", false, false, false, true, false) dx2 = dxDrawText(removeColorCoding(text2), (x * 0.0078) - 1, (y * 0.5167) - 1, (x * 0.8930) - 1, (y * 0.5433) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx2 = dxDrawText(removeColorCoding(text2), (x * 0.0078) + 1, (y * 0.5167) - 1, (x * 0.8930) + 1, (y * 0.5433) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx2 = dxDrawText(removeColorCoding(text2), (x * 0.0078) - 1, (y * 0.5167) + 1, (x * 0.8930) - 1, (y * 0.5433) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx2 = dxDrawText(removeColorCoding(text2), (x * 0.0078) + 1, (y * 0.5167) + 1, (x * 0.8930) + 1, (y * 0.5433) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx2 = dxDrawText(text2, x * 0.0078, y * 0.5167, x * 0.8930, y * 0.5433, tonumber(color2), 1, "default-bold", "left", "top", false, false, false, true, false) dx1 = dxDrawText(removeColorCoding(text1), (x * 0.0078) - 1, (y * 0.5433) - 1, (x * 0.8930) - 1, (y * 0.5700) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx1 = dxDrawText(removeColorCoding(text1), (x * 0.0078) + 1, (y * 0.5433) - 1, (x * 0.8930) + 1, (y * 0.5700) - 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx1 = dxDrawText(removeColorCoding(text1), (x * 0.0078) - 1, (y * 0.5433) + 1, (x * 0.8930) - 1, (y * 0.5700) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx1 = dxDrawText(removeColorCoding(text1), (x * 0.0078) + 1, (y * 0.5433) + 1, (x * 0.8930) + 1, (y * 0.5700) + 1, tocolor(0, 0, 0, 255), 1, "default-bold", "left", "top", false, false, false, true, false) dx1 = dxDrawText(text1, x * 0.0078, y * 0.5433, x * 0.8930, y * 0.5700, tonumber(color1), 1, "default-bold", "left", "top", false, false, false, true, false) end addEventHandler("onClientRender",root,drawit) function outputSGuiText(text,c1,c2,c3) text1 = guiGetText(gui1) text2 = guiGetText(gui2) text3 = guiGetText(gui3) text4 = guiGetText(gui4) guiSetText(gui2,text1) guiSetText(gui3,text2) guiSetText(gui4,text3) guiSetText(gui5,text4) -- textc1 = guiGetText(guic1) textc2 = guiGetText(guic2) textc3 = guiGetText(guic3) textc4 = guiGetText(guic4) guiSetText(guic2,textc1) guiSetText(guic3,textc2) guiSetText(guic4,textc3) guiSetText(guic5,textc4) -- guiSetText(gui1,text) c1,c2,c3 = tonumber(c1),tonumber(c2),tonumber(c3) color = tocolor(c1,c2,c3) guiSetText(guic1,color) end function outputGuiText(text,c1,c2,c3) text1 = guiGetText(gui1) text2 = guiGetText(gui2) text3 = guiGetText(gui3) text4 = guiGetText(gui4) guiSetText(gui2,text1) guiSetText(gui3,text2) guiSetText(gui4,text3) guiSetText(gui5,text4) -- textt1 = guiGetText(guit1) textt2 = guiGetText(guit2) textt3 = guiGetText(guit3) textt4 = guiGetText(guit4) guiSetText(guic2,textt1) guiSetText(guic3,textt2) guiSetText(guic4,textt3) guiSetText(guic5,textt4) guiSetText(guit1,"15") -- textc1 = guiGetText(guic1) textc2 = guiGetText(guic2) textc3 = guiGetText(guic3) textc4 = guiGetText(guic4) guiSetText(guic2,textc1) guiSetText(guic3,textc2) guiSetText(guic4,textc3) guiSetText(guic5,textc4) -- c1,c2,c3 = tonumber(c1),tonumber(c2),tonumber(c3) color = tocolor(c1,c2,c3) guiSetText(guic1,color) return "true: added text '"..text.."'" end function epic() text1 = guiGetText(guic1) text2 = guiGetText(guic2) text3 = guiGetText(guic3) text4 = guiGetText(guic4) text5 = guiGetText(guic5) guiSetText(gui1,tostring(tonumber(text1)-5)) guiSetText(gui2,tostring(tonumber(text2)-4)) guiSetText(gui3,tostring(tonumber(text3)-3)) guiSetText(gui4,tostring(tonumber(text4)-2)) guiSetText(gui5,tostring(tonumber(text5)-1)) if tonumber(text1) <= 4 then guiSetText(gui1,"") end if tonumber(text2) <= 3 then guiSetText(gui2,"") end if tonumber(text3) <= 2 then guiSetText(gui3,"") end if tonumber(text4) <= 1 then guiSetText(gui4,"") end if tonumber(text5) <= 0 then guiSetText(gui5,"") end end Edited January 30, 2018 by xRGamingx
xRGamingx Posted January 30, 2018 Author Posted January 30, 2018 20 minutes ago, NeXuS™ said: Using the alpha of tocolor. You can edit it to me please
NeXuS™ Posted January 30, 2018 Posted January 30, 2018 Try it first, if it doesn't work, I'll give you a hand.
xRGamingx Posted January 30, 2018 Author Posted January 30, 2018 1 minute ago, NeXuS™ said: Try it first, if it doesn't work, I'll give you a hand. But how do I start? the chat is all good, but I do not know how to fade them
xRGamingx Posted January 30, 2018 Author Posted January 30, 2018 1 minute ago, NeXuS™ said: What does this code do? What is it for? it's an information chat,. it's called guitext, example call(getResourceFromName("guitext"),"outputServerGuiText",thePlayer,"You are already working, you do not need another vehicle.",255,0,0)
NeXuS™ Posted January 30, 2018 Posted January 30, 2018 Let me create one for you. Give me about 15-20 minutes. 1
xRGamingx Posted January 30, 2018 Author Posted January 30, 2018 1 minute ago, NeXuS™ said: Let me create one for you. Give me about 15-20 minutes. Thank you brother, I am very grateful !
NeXuS™ Posted January 30, 2018 Posted January 30, 2018 Server side. function addInfo(playerSource, infoText, rA, rG, rB) isPlayer = isElement(playerSource) and getElementType(playerSource) == "player" assert(isPlayer, "Bad argument @ 'addInfo' [Expected player at argument 1, got " .. type(playerSource) .. "]") assert(tostring(infoText), "Bad argument @ 'addInfo' [Expected string at argument 2, got " .. type(infoText) .. "]") assert(tonumber(rA), "Bad argument @ 'addInfo' [Expected number at argument 3, got " .. type(rA) .. "]") assert(tonumber(rG), "Bad argument @ 'addInfo' [Expected number at argument 4, got " .. type(rG) .. "]") assert(tonumber(rB), "Bad argument @ 'addInfo' [Expected number at argument 5, got " .. type(rB) .. "]") triggerClientEvent(playerSource, "addInfo", root, infoText, rA, rG, rB) end function testInfo(playerSource) local i = 1 setTimer(function() addInfo(playerSource, "Test " .. i, 255, 255, 255) i = i + 1 end, 1000, 10) end addCommandHandler("testinfo4", testInfo) Client side. local sX, sY = guiGetScreenSize() local infoX, infoY = 0, sY/2 -- Edit this to set the text's X and Y. local messageStayTime = 6 -- Edit this to set how many seconds the message is shown for. local infoTexts = {} function addInfo(infoText, rA, rG, rB) table.insert(infoTexts, 1, {infoText, rA, rG, rB, 255, getTickCount()}) outputDebugString("Added info on tick: " .. getTickCount()) end addEvent("addInfo", true) addEventHandler("addInfo", root, addInfo) function drawInfos() if #infoTexts > 0 then for i = #infoTexts, 1, -1 do local selectedInfo = infoTexts[i] dxDrawText(selectedInfo[1], infoX, infoY+(#infoTexts-i)*15, infoX, infoY, tocolor(selectedInfo[2], selectedInfo[3], selectedInfo[4], selectedInfo[5])) if getTickCount() > selectedInfo[6] + messageStayTime*1000 then infoTexts[i][5] = infoTexts[i][5] - 1 if infoTexts[i][5] == 0 then table.remove(infoTexts, i) outputDebugString("Removed info on tick: " .. getTickCount()) end end end end end addEventHandler("onClientRender", root, drawInfos) Meta. <meta> <script src="sourceS.lua"/> <script src="sourceC.lua" type="client"/> <export function="addInfo" type="server"/> <export function="addInfo" type="client"/> </meta> You can easily export it from both sides. Server exports.resName:addInfo(playerData, "Test", 255, 255, 255) Client exports.resName:addInfo("Test", 255, 255, 255)
xRGamingx Posted January 30, 2018 Author Posted January 30, 2018 20 minutes ago, NeXuS™ said: Server side. function addInfo(playerSource, infoText, rA, rG, rB) isPlayer = isElement(playerSource) and getElementType(playerSource) == "player" assert(isPlayer, "Bad argument @ 'addInfo' [Expected player at argument 1, got " .. type(playerSource) .. "]") assert(tostring(infoText), "Bad argument @ 'addInfo' [Expected string at argument 2, got " .. type(infoText) .. "]") assert(tonumber(rA), "Bad argument @ 'addInfo' [Expected number at argument 3, got " .. type(rA) .. "]") assert(tonumber(rG), "Bad argument @ 'addInfo' [Expected number at argument 4, got " .. type(rG) .. "]") assert(tonumber(rB), "Bad argument @ 'addInfo' [Expected number at argument 5, got " .. type(rB) .. "]") triggerClientEvent(playerSource, "addInfo", root, infoText, rA, rG, rB) end function testInfo(playerSource) local i = 1 setTimer(function() addInfo(playerSource, "Test " .. i, 255, 255, 255) i = i + 1 end, 1000, 10) end addCommandHandler("testinfo4", testInfo) Client side. local sX, sY = guiGetScreenSize() local infoX, infoY = 0, sY/2 -- Edit this to set the text's X and Y. local messageStayTime = 6 -- Edit this to set how many seconds the message is shown for. local infoTexts = {} function addInfo(infoText, rA, rG, rB) table.insert(infoTexts, 1, {infoText, rA, rG, rB, 255, getTickCount()}) outputDebugString("Added info on tick: " .. getTickCount()) end addEvent("addInfo", true) addEventHandler("addInfo", root, addInfo) function drawInfos() if #infoTexts > 0 then for i = #infoTexts, 1, -1 do local selectedInfo = infoTexts[i] dxDrawText(selectedInfo[1], infoX, infoY+(#infoTexts-i)*15, infoX, infoY, tocolor(selectedInfo[2], selectedInfo[3], selectedInfo[4], selectedInfo[5])) if getTickCount() > selectedInfo[6] + messageStayTime*1000 then infoTexts[i][5] = infoTexts[i][5] - 1 if infoTexts[i][5] == 0 then table.remove(infoTexts, i) outputDebugString("Removed info on tick: " .. getTickCount()) end end end end end addEventHandler("onClientRender", root, drawInfos) Meta. <meta> <script src="sourceS.lua"/> <script src="sourceC.lua" type="client"/> <export function="addInfo" type="server"/> <export function="addInfo" type="client"/> </meta> Thank you very much brother I thank you very much it works perfectly Thank you so so so much
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now