SaedAmer Posted June 7, 2016 Share Posted June 7, 2016 السلام عليكم ده مود الفيسات عاوز لما اجي اكتب بالشات ما يسيب مسافة local root = getRootElement() local rroot = getResourceRootElement() --addEvent("Mensaje",true) local sx,sy = guiGetScreenSize() local chatbox = getChatboxLayout() local y = chatbox["chat_scale"][2] local lineas = chatbox["chat_lines"] local font = "default" if chatbox["chat_font"] == 1 then font = "clear" elseif chatbox["chat_font"] == 2 then font = "default-bold" elseif chatbox["chat_font"] == 3 then font = "arial" end addEventHandler("onClientChatMessage",root,function(txt) for k,v in ipairs(getElementsByType("gui-staticimage",rroot)) do local gx,gy = guiGetPosition(v,true) if string.len(txt) > 100 then guiSetPosition(v, gx,gy-0.025,true) else guiSetPosition(v, gx,gy-0.025,true) end if gy <= 0.01 then destroyElement(v) end end txt = string.gsub(txt,"#[%x][%x][%x][%x][%x][%x]","") local len = 0 if string.len(txt) > 48 then return end if string.find(txt,"ض1") then local text = string.gsub(txt,"ض1","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q1.png",true) setTimer(outputChatBox,50,1,"") elseif string.find(txt,"ض2") then local text = string.gsub(txt,"ض2","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q2.png",true) setTimer(outputChatBox,50,1,"") elseif string.find(txt,"ض3") then local text = string.gsub(txt,"ض3","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q3.png",true) elseif string.find(txt,"ض4") then local text = string.gsub(txt,"ض4","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q4.png",true) elseif string.find(txt,"ض5") then local text = string.gsub(txt,"ض5","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q5.png",true) elseif string.find(txt,"ض6") then local text = string.gsub(txt,"ض6","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q6.png",true) elseif string.find(txt,"ض7") then local text = string.gsub(txt,"ض7","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q7.png",true) elseif string.find(txt,"ض8") then local text = string.gsub(txt,"ض8","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q8.png",true) elseif string.find(txt,"ض9") then local text = string.gsub(txt,"ض9","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q9.png",true) elseif string.find(txt,"ض0") then local text = string.gsub(txt,"ض0","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q0.png",true) elseif string.find(txt,"@") then local text = string.gsub(txt,"@","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q10.png",true) elseif string.find(txt,"ق0") then local text = string.gsub(txt,"ق0","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q11.png",true) elseif string.find(txt,"ق1") then local text = string.gsub(txt,"ق1","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q12.png",true) elseif string.find(txt,"ق2") then local text = string.gsub(txt,"ق2","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q13.png",true) elseif string.find(txt,"ق3") then local text = string.gsub(txt,"ق3","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q14.png",true) elseif string.find(txt,"ق4") then local text = string.gsub(txt,"ق4","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q15.png",true) elseif string.find(txt,"ق5") then local text = string.gsub(txt,"ق5","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q16.png",true) elseif string.find(txt,"ق6") then local text = string.gsub(txt,"ق6","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q17.png",true) elseif string.find(txt,"ق7") then local text = string.gsub(txt,"ق7","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q18.png",true) elseif string.find(txt,"ق8") then local text = string.gsub(txt,"ق8","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q19.png",true) elseif string.find(txt,"ق9") then local text = string.gsub(txt,"ق9","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q20.png",true) elseif string.find(txt,"د1") then local text = string.gsub(txt,"د1","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q21.png",true) elseif string.find(txt,"د2") then local text = string.gsub(txt,"د2","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q22.png",true) elseif string.find(txt,"د3") then local text = string.gsub(txt,"د3","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q23.png",true) elseif string.find(txt,"د4") then local text = string.gsub(txt,"د4","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q24.png",true) elseif string.find(txt,"د5") then local text = string.gsub(txt,"د5","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q25.png",true) end end) function convertirRelativo(x) local rx = x/sx return rx end Link to comment
!#NssoR_) Posted June 7, 2016 Share Posted June 7, 2016 local root = getRootElement() local rroot = getResourceRootElement() --addEvent("Mensaje",true) local sx,sy = guiGetScreenSize() local chatbox = getChatboxLayout() local y = chatbox["chat_scale"][2] local lineas = chatbox["chat_lines"] local font = "default" if chatbox["chat_font"] == 1 then font = "clear" elseif chatbox["chat_font"] == 2 then font = "default-bold" elseif chatbox["chat_font"] == 3 then font = "arial" end addEventHandler("onClientChatMessage",root,function(txt) for k,v in ipairs(getElementsByType("gui-staticimage",rroot)) do local gx,gy = guiGetPosition(v,true) if string.len(txt) > 100 then guiSetPosition(v, gx,gy-0.025,true) else guiSetPosition(v, gx,gy-0.025,true) end if gy <= 0.01 then destroyElement(v) end end txt = string.gsub(txt,"#[%x][%x][%x][%x][%x][%x]","") local len = 0 if string.len(txt) > 48 then return end if string.find(txt,"ض1") then local text = string.gsub(txt,"ض1","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q1.png",true) elseif string.find(txt,"ض2") then local text = string.gsub(txt,"ض2","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q2.png",true) elseif string.find(txt,"ض3") then local text = string.gsub(txt,"ض3","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q3.png",true) elseif string.find(txt,"ض4") then local text = string.gsub(txt,"ض4","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q4.png",true) elseif string.find(txt,"ض5") then local text = string.gsub(txt,"ض5","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q5.png",true) elseif string.find(txt,"ض6") then local text = string.gsub(txt,"ض6","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q6.png",true) elseif string.find(txt,"ض7") then local text = string.gsub(txt,"ض7","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q7.png",true) elseif string.find(txt,"ض8") then local text = string.gsub(txt,"ض8","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q8.png",true) elseif string.find(txt,"ض9") then local text = string.gsub(txt,"ض9","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q9.png",true) elseif string.find(txt,"ض0") then local text = string.gsub(txt,"ض0","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q0.png",true) elseif string.find(txt,"@") then local text = string.gsub(txt,"@","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q10.png",true) elseif string.find(txt,"ق0") then local text = string.gsub(txt,"ق0","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q11.png",true) elseif string.find(txt,"ق1") then local text = string.gsub(txt,"ق1","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q12.png",true) elseif string.find(txt,"ق2") then local text = string.gsub(txt,"ق2","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q13.png",true) elseif string.find(txt,"ق3") then local text = string.gsub(txt,"ق3","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q14.png",true) elseif string.find(txt,"ق4") then local text = string.gsub(txt,"ق4","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q15.png",true) elseif string.find(txt,"ق5") then local text = string.gsub(txt,"ق5","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q16.png",true) elseif string.find(txt,"ق6") then local text = string.gsub(txt,"ق6","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q17.png",true) elseif string.find(txt,"ق7") then local text = string.gsub(txt,"ق7","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q18.png",true) elseif string.find(txt,"ق8") then local text = string.gsub(txt,"ق8","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q19.png",true) elseif string.find(txt,"ق9") then local text = string.gsub(txt,"ق9","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q20.png",true) elseif string.find(txt,"د1") then local text = string.gsub(txt,"د1","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q21.png",true) elseif string.find(txt,"د2") then local text = string.gsub(txt,"د2","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q22.png",true) elseif string.find(txt,"د3") then local text = string.gsub(txt,"د3","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q23.png",true) elseif string.find(txt,"د4") then local text = string.gsub(txt,"د4","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q24.png",true) elseif string.find(txt,"د5") then local text = string.gsub(txt,"د5","") local len = dxGetTextWidth(text,chatbox["chat_scale"][1],font) local lfin = convertirRelativo(len) outputDebugString("LEN="..tostring(len).." LFIN="..tostring(lfin)) local img = guiCreateStaticImage(0.01875+lfin,0.02+(0.025*(lineas-1)),0.02,0.025,"imagenes/q25.png",true) end end) function convertirRelativo(x) local rx = x/sx return rx end Link to comment
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