Mr.OppS Posted August 14, 2017 Share Posted August 14, 2017 السلام عليكم كيف الحال؟ مود الكلام يظهر فوق الرأس المود يعمل بدون مشاكل ! لكن الكلام لا يظهر بالترتـيـب المعروف صور من داخل المود ! 1 2مـود اخـر اريد اسوى مود رقم1 مثـل مود رقم 2 ض كيف !؟ الاكواد : سيرفر function outputMessage(element, text) assert(isElement(element), "outputMessage @ Bad argument: expected element at argument 1, got "..type(element).." "..tostring(element)) triggerClientEvent("onChatIncome", element, tostring(text)) end function sendMessageToClient(message,messagetype) if not wasEventCancelled() then if messagetype == 0 or messagetype == 2 then triggerClientEvent("onChatIncome", source, message, messagetype) end end end addEventHandler("onPlayerChat",getRootElement(),sendMessageToClient) كليـنــت local selfVisible = true -- Want to see your own message? local messages = {} -- {text, player, lastTick, alpha, yPos} local textures = {} local timeVisible = 13500 local distanceVisible = 50 local bubble = true -- Rounded rectangle(true) or not(false) function addBubble(text, player, tick) if (not messages[player]) then messages[player] = {} end local width = dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") local _texture = dxCreateRoundedTexture(width+16,20,100) table.insert(messages[player], {["text"] = text, ["player"] = player, ["tick"] = tick, ["endTime"] = tick + 2000, ["alpha"] = 0, ["texture"] = _texture}) end function removeBubble() table.remove(messages) end addEvent("onChatIncome", true) addEventHandler("onChatIncome", root, function(message, messagetype) if source ~= localPlayer then addBubble(message, source, getTickCount()) elseif selfVisible then addBubble(message, source, getTickCount()) end end ) -- outElastic | Got from https://github.com/EmmanuelOga/easing/blob/master/lib/easing.lua local pi = math.pi function outElastic(t, b, c, d, a, p) if t == 0 then return b end t = t / d if t == 1 then return b + c end if not p then p = d * 0.3 end local s if not a or a < math.abs(c) then a = c s = p / 4 else s = p / (2 * pi) * math.asin(c/a) end return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * pi) / p) + c + b end addEventHandler("onClientRender", root, function() local tick = getTickCount() local x, y, z = getElementPosition(localPlayer) for _, pMessage in pairs(messages) do for i, v in ipairs(pMessage) do if isElement(v.player) then if tick-v.tick < timeVisible then local px, py, pz = getElementPosition(v.player) if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < distanceVisible and isLineOfSightClear ( x, y, z, px, py, pz, true, not isPedInVehicle(v.player), false, true) then v.alpha = v.alpha < 200 and v.alpha + 5 or v.alpha local bx, by, bz = getPedBonePosition(v.player, 6) local sx, sy = getScreenFromWorldPosition(bx, by, bz) local elapsedTime = tick - v.tick local duration = v.endTime - v.tick local progress = elapsedTime / duration if sx and sy then if not v.yPos then v.yPos = sy end local width = dxGetTextWidth(v.text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") --local yPos = interpolateBetween ( v.yPos, 0, 0, sy - 22*i, 0, 0, progress, "OutElastic") local yPos = outElastic(elapsedTime, v.yPos, ( sy - 22*i ) - v.yPos, duration, 5) if bubble then dxDrawImage ( sx-width/2-10, yPos - 16, width+16, 20, v.texture, nil, nil, tocolor(0, 0, 0, v.alpha) ) else dxDrawRectangle(sx-width/2-10, yPos - 16, width+16, 20, tocolor(0, 0, 0, v.alpha)) end dxDrawText(v.text, sx-width/2-2, yPos - 14, width, 20, tocolor( 255, 255, 255, v.alpha+50), 1, "default-bold", "left", "top", false, false, false, true) end end else table.remove(messages[v.player], i) end else table.remove(messages[v.player], i) end end end end ) كليـنـت function dxCreateRoundedTexture(text_width,text_height,radius) assert(text_width,"Missing argument 'text_width' at dxCreateRoundedTexture") assert(text_height,"Missing argument 'height' at dxCreateRoundedTexture") assert(radius,"Missing argument 'radius' at dxCreateRoundedTexture") if type(text_width) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 1, got " .. type(text_width) .. "]",2) return false end if type(text_height) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 2, got " .. type(text_height) .. "]",2) return false end if type(radius) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 3, got " .. type(radius) .. "]",2) return false end if text_width < 0 then outputDebugString("text_width can't be less than 0",1) return false end if text_height < 0 then outputDebugString("text_height can't be less than 0",1) return false end if radius < 0 or radius > 100 then outputDebugString("Parameter 'radius' can't be between 0 and 100",1) return false end local texture = DxTexture(text_width,text_height) local pix = texture:getPixels() radius = (radius * (text_height / 2)) / 100 for x=0,text_width do for y=0,text_height do if x >= radius and x <= text_width - radius then dxSetPixelColor(pix,x,y,255,255,255,255) end if y >= radius and y <= text_height - radius then dxSetPixelColor(pix,x,y,255,255,255,255) end if math.sqrt((x - radius)^2 + (y - radius)^2) < radius then dxSetPixelColor(pix,x,y,255,255,255,255) end if math.sqrt((x - (text_width - radius))^2 + (y - radius)^2) < radius then dxSetPixelColor(pix,x,y,255,255,255,255) end if math.sqrt((x - radius)^2 + (y - (text_height - radius))^2) < radius then dxSetPixelColor(pix,x,y,255,255,255,255) end if math.sqrt((x - (text_width - radius))^2 + (y - (text_height - radius))^2) < radius then dxSetPixelColor(pix,x,y,255,255,255,255) end end end texture:setPixels(pix) return texture end ---- Link to comment
Omoi Posted August 14, 2017 Share Posted August 14, 2017 م فهمتك وش المشكله بالضبط , يتأخر الوقت عشان ينمسح الكلام ؟ Link to comment
Mr.OppS Posted August 14, 2017 Author Share Posted August 14, 2017 22 minutes ago, Omoi said: م فهمتك وش المشكله بالضبط , يتأخر الوقت عشان ينمسح الكلام ؟ لا أوضـح اكثـيـر ,, يـوجـود 2 مـود ( اظهار الكلام فوق الرأس)ض X اسـم الـمـود الأول Z اسـم الـمـود الـثـانـى الـمـود الأول X اذا انت تكـتـب فـى شـات السلام عليكم | هـلا | كيـف الحال ؟ 1 | 2 | 3 | يـظهـر كذا لـكـن الـمـود الـثـانـى Z اذا انت تكـتـب فـى شـات السلام عليكم | هـلا | كيـف الحال ؟ 1 | 2 | ض يـظهـر كذا الاختلاف واضح !! ان المود الاول يطلع الكلام بالـعــكـس !!! ولكـن مود الـثـانـى يطلع بالـتـرتـيـب و تـنـظيـم Link to comment
Omoi Posted August 14, 2017 Share Posted August 14, 2017 بأختصار , تبي يطلع اول شي هو القديم , واللي تحته هو الجديد ؟ ولا العكس ؟ Link to comment
Mr.OppS Posted August 14, 2017 Author Share Posted August 14, 2017 3 minutes ago, Omoi said: بأختصار , تبي يطلع اول شي هو القديم , واللي تحته هو الجديد ؟ Yes Link to comment
Omoi Posted August 14, 2017 Share Posted August 14, 2017 (edited) انصحك بحق عقرب مرتب وكويس عدلت عليه انا بـ انه يطلع للاعب اللي ارسل بعد -- meta <meta> <script src="cb-c.lua" type="client" /> <script src="cb-s.lua" type="server" /> <file src="font.ttf" /> <settings> <setting name="*DefaultTime" value="10000" accept="number" desc="The default time every bubble will be visible." /> <setting name="*PerCharacterAddition" value="50" accept="number" desc="The time every character in a message adds to the total time visible." /> <setting name="*MaxBubbles" value="3" accept="number/false" desc="The max number of bubbles stacked above one's head. To disable enter 'false'." /> <setting name="*HideOwn" value="true" accept="true/false" desc="Decides whether players are able to see their own bubbles or not." /> </settings> </meta> -- Server local showtime = tonumber(get("chat.DefaultTime")) local characteraddition = tonumber(get("chat.PerCharacterAddition")) local maxbubbles = get("chat.MaxBubbles") if maxbubbles == "false" then maxbubbles = false else maxbubbles = tonumber(maxbubbles) end local hideown = get("chat.HideOwn") if hideown == "true" then hideown = true else hideown = false end function sendMessageToClient(message,messagetype) if not wasEventCancelled() then if messagetype == 0 or messagetype == 2 then triggerClientEvent("onChatbubblesMessageIncome",source,message,messagetype) end end end function returnSettings() local settings = { showtime, characteraddition, maxbubbles, hideown } triggerClientEvent(source,"onBubbleSettingsReturn",getRootElement(),settings) end addEventHandler("onPlayerChat",getRootElement(),sendMessageToClient) addEvent("onAskForBubbleSettings",true) addEventHandler("onAskForBubbleSettings",getRootElement(),returnSettings) -- Client local textsToDraw = {} local hideown local showtime local characteraddition local maxbubbles local showthebubbles = true function income(message,messagetype) if source ~= getLocalPlayer() or hideown then if messagetype == 2 then if getPlayerTeam(source) == getPlayerTeam(getLocalPlayer()) then addText(source,message,messagetype) end else addText(source,message,messagetype) end end end function addText(source,message,messagetype) local notfirst = false for i,v in ipairs(textsToDraw) do if v[1] == source then v[4] = v[4] + 1 notfirst = true end end local infotable = {source,message,messagetype,0} table.insert(textsToDraw,infotable) if not notfirst then setTimer(removeText,showtime + (#message * characteraddition),1,infotable) end end -- onChatbubblesMessageIncome function removeText(infotable) for i,v in ipairs(textsToDraw) do if v[1] == infotable[1] and v[2] == infotable[2] then for i2,v2 in ipairs(textsToDraw) do if v2[1] == v[1] and v[4] - v2[4] == 1 then setTimer(removeText,showtime + (#v2[2] * characteraddition),1,v2) end end table.remove(textsToDraw,i) break end end end function getTextsToRemove() for i,v in ipairs(textsToDraw) do if v[1] == source then removeText(v) end end end function isASCII(text) for i = 1, #text do local byte = text:byte(i) if(byte < 33 or byte > 126)then return false end end return true end local myFont = dxCreateFont("font.ttf",10) function handleDisplay() if showthebubbles then for i,v in ipairs(textsToDraw) do if isElement(v[1]) then local dim = getElementDimension(localPlayer) local int = getElementInterior(localPlayer) local pDim = getElementDimension(v[1]) local pInt = getElementInterior(v[1]) if tonumber(dim) == tonumber(pDim) and tonumber(int) == tonumber(pInt) then if getElementHealth(v[1]) > 0 then local camPosXl, camPosYl, camPosZl = getPedBonePosition (v[1], 6) local camPosXr, camPosYr, camPosZr = getPedBonePosition (v[1], 7) local x,y,z = (camPosXl + camPosXr) / 2, (camPosYl + camPosYr) / 2, (camPosZl + camPosZr) / 2 --local posx,posy = getScreenFromWorldPosition(x,y,z+0.25) local cx,cy,cz = getCameraMatrix() local px,py,pz = getElementPosition(v[1]) local distance = getDistanceBetweenPoints3D(cx,cy,cz,px,py,pz) local posx,posy = getScreenFromWorldPosition(x,y,z+0.020*distance+0.10) local elementtoignore1 = getPedOccupiedVehicle(getLocalPlayer()) or getLocalPlayer() local elementtoignore2 = getPedOccupiedVehicle(v[1]) or v[1] if posx and distance <= 45 and ( isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore1) or isLineOfSightClear(cx,cy,cz,px,py,pz,true,true,false,true,false,true,true,elementtoignore2) ) and ( not maxbubbles or v[4] < maxbubbles ) then -- change this when multiple ignored elements can be specified if isASCII(v[2]) then size = 1 font = "arial" else size = 1 font = myFont end local width = dxGetTextWidth(v[2],1,font) dxDrawRectangle(posx - (3 + (0.5 * width)),posy - (2 + (v[4] * 20)),width + 5 ,19,tocolor(0,0,0,255)) dxDrawRectangle(posx - (6 + (0.5 * width)),posy - (2 + (v[4] * 20)),width + 11,19,tocolor(0,0,0,40)) dxDrawRectangle(posx - (8 + (0.5 * width)),posy - (1 + (v[4] * 20)),width + 15,17,tocolor(0,0,0,255)) dxDrawRectangle(posx - (10 + (0.5 * width)),posy - (1 + (v[4] * 20)),width + 19,17,tocolor(0,0,0,40)) dxDrawRectangle(posx - (10 + (0.5 * width)),posy - (v[4] * 20) + 1,width + 19,13,tocolor(0,0,0,255)) dxDrawRectangle(posx - (12 + (0.5 * width)),posy - (v[4] * 20) + 1,width + 23,13,tocolor(0,0,0,40)) dxDrawRectangle(posx - (12 + (0.5 * width)),posy - (v[4] * 20) + 4,width + 23,7,tocolor(0,0,0,255)) local r,g,b = 255,255,255 if v[3] == 2 then r,g,b = getTeamColor(getPlayerTeam(v[1])) end dxDrawText(v[2],posx - (0.5 * width),posy - (v[4] * 20),posx - (0.5 * width),posy - (v[4] * 20),tocolor(r,g,b,255),size,font,"left","top",false,false,false) end end end else table.remove(textsToDraw,k) end end end end function getServerSettings() triggerServerEvent("onAskForBubbleSettings",getLocalPlayer()) end function saveSettings(settings) showtime = settings[1] characteraddition = settings[2] maxbubbles = settings[3] hideown = settings[4] addEvent("onChatbubblesMessageIncome",true) addEventHandler("onChatbubblesMessageIncome",getRootElement(),income) end function toggleBubblesOnOff() showthebubbles = not showthebubbles outputChatBox("Toggled chatbubbles " ..( not showthebubbles and "#FF0000off#FFFFFF." or "#00FF00on#FFFFFF." ),255,255,255,true) end addEventHandler("onClientPlayerQuit",getRootElement(),getTextsToRemove) addEventHandler("onClientRender",getRootElement(),handleDisplay) addEventHandler("onClientResourceStart",getResourceRootElement(getThisResource()),getServerSettings) addEvent("onBubbleSettingsReturn",true) addEventHandler("onBubbleSettingsReturn",getRootElement(),saveSettings) addCommandHandler("chatbubbles",toggleBubblesOnOff) لو تبي مايطلع للاعب اللي ارسل سطر 11 بالكلنت حطه كذا if source ~= getLocalPlayer() or not hideown then Edited August 14, 2017 by Omoi Link to comment
Mr.OppS Posted August 14, 2017 Author Share Posted August 14, 2017 انصحك بحق عقرب مرتب وكويس عدلت عليه انا بـ انه يطلع للاعب اللي ارسل بعد مشكوؤر ! و لـكـن أفـضـل أن اعدل على كود خاص بى ! واسـوى كود منـظم و مرتـب ,,, ساعدونى رجاء Link to comment
Omoi Posted August 14, 2017 Share Posted August 14, 2017 ماهو حقك ي الطيب ذآ منشور لكن تفضل بدل الكلنت بذا local selfVisible = true -- Want to see your own message? local messages = {} -- {text, player, lastTick, alpha, yPos} local textures = {} local timeVisible = 5500 local distanceVisible = 30 local bubble = true -- Rounded rectangle(true) or not(false) function addBubble(text, player, tick) if (not messages[player]) then messages[player] = {} end local width = dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") local _texture = dxCreateRoundedTexture(width+16,20,100) table.insert(messages[player], {["text"] = text, ["player"] = player, ["tick"] = tick, ["endTime"] = tick + 2000, ["alpha"] = 0, ["texture"] = _texture}) end function removeBubble() table.remove(messages) end addEvent("onChatIncome", true) addEventHandler("onChatIncome", root, function(message, messagetype) if source ~= localPlayer then addBubble(message, source, getTickCount()) elseif selfVisible then addBubble(message, source, getTickCount()) end end ) local pi = math.pi function outElastic(t, b, c, d, a, p) if t == 0 then return b end t = t / d if t == 1 then return b + c end if not p then p = d * 0.3 end local s if not a or a < math.abs(c) then a = c s = p / 4 else s = p / (2 * pi) * math.asin(c/a) end return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * pi) / p) + c + b end addEventHandler("onClientRender", root, function() local tick = getTickCount() local x, y, z = getElementPosition(localPlayer) for _, pMessage in pairs(messages) do for i, v in ipairs(pMessage) do if isElement(v.player) then if tick-v.tick < timeVisible then local px, py, pz = getElementPosition(v.player) if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < distanceVisible and isLineOfSightClear ( x, y, z, px, py, pz, true, not isPedInVehicle(v.player), false, true) then v.alpha = v.alpha < 200 and v.alpha + 5 or v.alpha local bx, by, bz = getPedBonePosition(v.player, 6) local sx, sy = getScreenFromWorldPosition(bx, by, bz) local elapsedTime = tick - v.tick local duration = v.endTime - v.tick local progress = elapsedTime / duration if sx and sy then if not v.yPos then v.yPos = sy end local width = dxGetTextWidth(v.text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") --local yPos = interpolateBetween ( v.yPos, 0, 0, sy - 22*i, 0, 0, progress, "OutElastic") local yPos = outElastic(elapsedTime, v.yPos, ( sy + 22*i ) - v.yPos, duration, 5) if bubble then dxDrawImage ( sx-width/2-10, yPos - 130, width+16, 20, v.texture, nil, nil, tocolor(0, 0, 0, v.alpha) ) else dxDrawRectangle(sx-width/2-10, yPos - 130, width+16, 20, tocolor(0, 0, 0, v.alpha)) end dxDrawText(v.text, sx-width/2-2, yPos - 126, width, 20, tocolor( 255, 255, 255, v.alpha+50), 1, "default-bold", "left", "top", false, false, false, true) end end else table.remove(messages[v.player], i) end else table.remove(messages[v.player], i) end end end end ) Link to comment
Mr.OppS Posted August 14, 2017 Author Share Posted August 14, 2017 21 minutes ago, Omoi said: ماهو حقك ي الطيب ذآ منشور لكن تفضل بدل الكلنت بذا local selfVisible = true -- Want to see your own message?local messages = {} -- {text, player, lastTick, alpha, yPos}local textures = {}local timeVisible = 5500local distanceVisible = 30local bubble = true -- Rounded rectangle(true) or not(false)function addBubble(text, player, tick) if (not messages[player]) then messages[player] = {} end local width = dxGetTextWidth(text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") local _texture = dxCreateRoundedTexture(width+16,20,100) table.insert(messages[player], {["text"] = text, ["player"] = player, ["tick"] = tick, ["endTime"] = tick + 2000, ["alpha"] = 0, ["texture"] = _texture})endfunction removeBubble() table.remove(messages)endaddEvent("onChatIncome", true)addEventHandler("onChatIncome", root, function(message, messagetype) if source ~= localPlayer then addBubble(message, source, getTickCount()) elseif selfVisible then addBubble(message, source, getTickCount()) end end)local pi = math.pifunction outElastic(t, b, c, d, a, p) if t == 0 then return b end t = t / d if t == 1 then return b + c end if not p then p = d * 0.3 end local s if not a or a < math.abs(c) then a = c s = p / 4 else s = p / (2 * pi) * math.asin(c/a) end return a * math.pow(2, -10 * t) * math.sin((t * d - s) * (2 * pi) / p) + c + bendaddEventHandler("onClientRender", root, function() local tick = getTickCount() local x, y, z = getElementPosition(localPlayer) for _, pMessage in pairs(messages) do for i, v in ipairs(pMessage) do if isElement(v.player) then if tick-v.tick < timeVisible then local px, py, pz = getElementPosition(v.player) if getDistanceBetweenPoints3D(x, y, z, px, py, pz) < distanceVisible and isLineOfSightClear ( x, y, z, px, py, pz, true, not isPedInVehicle(v.player), false, true) then v.alpha = v.alpha < 200 and v.alpha + 5 or v.alpha local bx, by, bz = getPedBonePosition(v.player, 6) local sx, sy = getScreenFromWorldPosition(bx, by, bz) local elapsedTime = tick - v.tick local duration = v.endTime - v.tick local progress = elapsedTime / duration if sx and sy then if not v.yPos then v.yPos = sy end local width = dxGetTextWidth(v.text:gsub("#%x%x%x%x%x%x", ""), 1, "default-bold") --local yPos = interpolateBetween ( v.yPos, 0, 0, sy - 22*i, 0, 0, progress, "OutElastic") local yPos = outElastic(elapsedTime, v.yPos, ( sy + 22*i ) - v.yPos, duration, 5) if bubble then dxDrawImage ( sx-width/2-10, yPos - 130, width+16, 20, v.texture, nil, nil, tocolor(0, 0, 0, v.alpha) ) else dxDrawRectangle(sx-width/2-10, yPos - 130, width+16, 20, tocolor(0, 0, 0, v.alpha)) end dxDrawText(v.text, sx-width/2-2, yPos - 126, width, 20, tocolor( 255, 255, 255, v.alpha+50), 1, "default-bold", "left", "top", false, false, false, true) end end else table.remove(messages[v.player], i) end else table.remove(messages[v.player], i) end end end end) ماهو حقك !! أقـراء مشاركـة / راح تشـوف ماذكرت أن هذا كودى الخاص و برمجتى الخاصـة , ليش تـتـهـم ؟ اتهمات كذبة؟ ,,, لكـن أفـضـل أن اعدل على كود خاص بى ! واسـوى كود منـظم و مرتـب = الكود الخاص = الكود الذى انا ضفتة فى مشاركة ! حتى لا تسال وين كود او كذا ! ض ,,, لا عذر لك ! لان امثلك صارو يـنـقـرضـون !و من المعروف الشخص من ينقرض ,يحاول الايذاء وتخريب ! ههههه , ضض Link to comment
Omoi Posted August 14, 2017 Share Posted August 14, 2017 2 minutes ago, Mr.OppS said: ماهو حقك !! أقـراء مشاركـة / راح تشـوف ماذكرت أن هذا كودى الخاص و برمجتى الخاصـة , ليش تـتـهـم ؟ اتهمات كذبة؟ ,,, لكـن أفـضـل أن اعدل على كود خاص بى ! واسـوى كود منـظم و مرتـب = الكود الخاص = الكود الذى انا ضفتة فى مشاركة ! حتى لا تسال وين كود او كذا ! ض ,,, لا عذر لك ! لان امثلك صارو يـنـقـرضـون !و من المعروف الشخص من ينقرض ,يحاول الايذاء وتخريب ! ههههه , ضض م اقول الا الله يسامحك لو بخرب وكذا , م كان ساعدتك وطولت معك ؟ انا مجرد استغربت من كلامك , لو م تبي مساعدتي براحتك قل م ابي مساعدتك لكن لاتقول اني احاول اخرب م ادري من اللي يتهم الثاني 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