Adham Posted June 2, 2018 Share Posted June 2, 2018 سلام عليكم ورحمه الله الحين عندي مود توب بار شات وابي كل الكلام الي فوق والخط يجي على كل الشاشات نفس المقاس حق المود لانه يجي عندي مختلف وعند مقاس شاشه اخري مختلفه نرجو الأفادة Link to comment
Adham Posted June 7, 2018 Author Share Posted June 7, 2018 ابيه على جميع الشاشات المقاس local x, y = guiGetScreenSize() local dxMessages = {} local dxMessagesY = {-25, -25, -25, -25} local dxMessagesTick = {} local isMoving = false function drawMessages() for index, Message in pairs(dxMessages) do dxDrawRectangle (( x / 800 ) * 250, ( y / 900 ) * dxMessagesY[index], ( x / 1440 ) * 1160, ( y / 900 ) * 25, tocolor(0, 0, 0, 90)) dxDrawText ( Message[1], ( x / 800 ) * 265, ( y / 900 ) * ( dxMessagesY[index] * 2 ), ( x / 1440 ) * 1250, ( y / 900 ) * 25, tocolor(Message[2], Message[3], Message[4], 255), (x / 1440) * 1.8, "default-bold", "left", "center", true, false, false, true ) end end addEventHandler("onClientRender", root, drawMessages) function sendClientMessage(message, r, g, b) if dxGetTextWidth(message, (x / 1440) * 1, "default-bold") > 750 then sendClientMessage("Invalid Length", 255, 0, 0) return end r, g, b = r or 255, g or 255, b or 255 if #dxMessages == 10 or isMoving then setTimer ( sendClientMessage, 1000, 1, message, r, g, b ) return end table.insert(dxMessages, {message, r, g, b}) dxMessagesTick[#dxMessages] = getTickCount() addEventHandler("onClientRender", root, addMessage) isMoving = true end addEvent("DoN.sendClientMessage", true) addEventHandler("DoN.sendClientMessage", root, sendClientMessage) function addMessage() local index = #dxMessages local difference = (y / 900) * 1.5 dxMessagesY[index] = (index - 1) * 25 if dxMessagesY[index] >= (index - 1) * 25 then dxMessagesY[index] = (index - 1) * 25 if #dxMessages == 10 then isMoving = true addEventHandler("onClientRender", root, removeMessage) removeEventHandler("onClientRender", root, addMessage) else isMoving = false removeEventHandler("onClientRender", root, addMessage) end end end function removeMessage() local difference = (y / 900) * 1.5 for index = 1, #dxMessages do dxMessagesY[index] = dxMessagesY[index] - difference end if dxMessagesY[1] <= -25 then for index = 1, #dxMessages do dxMessages[index] = dxMessages[index + 1] dxMessagesTick[index] = dxMessagesTick[index + 1] dxMessagesY[index] = (index - 1) * 25 end isMoving = false removeEventHandler("onClientRender", root, removeMessage) for index = 1, #dxMessagesY do if not dxMessages[index] then dxMessagesY[index] = -25 end end end end function removeReadMessages() for index, message in pairs(dxMessages) do local currentTick = getTickCount() if currentTick - dxMessagesTick[index] >= 10000 then removeMessage() end end end addEventHandler("onClientRender", root, removeReadMessages) Link to comment
Ram, Posted June 9, 2018 Share Posted June 9, 2018 On ٧/٦/٢٠١٨ at 05:59, Adham said: ابيه على جميع الشاشات المقاس local x, y = guiGetScreenSize() local dxMessages = {} local dxMessagesY = {-25, -25, -25, -25} local dxMessagesTick = {} local isMoving = false function drawMessages() for index, Message in pairs(dxMessages) do dxDrawRectangle (( x / 800 ) * 250, ( y / 900 ) * dxMessagesY[index], ( x / 1440 ) * 1160, ( y / 900 ) * 25, tocolor(0, 0, 0, 90)) dxDrawText ( Message[1], ( x / 800 ) * 265, ( y / 900 ) * ( dxMessagesY[index] * 2 ), ( x / 1440 ) * 1250, ( y / 900 ) * 25, tocolor(Message[2], Message[3], Message[4], 255), (x / 1440) * 1.8, "default-bold", "left", "center", true, false, false, true ) end end addEventHandler("onClientRender", root, drawMessages) function sendClientMessage(message, r, g, b) if dxGetTextWidth(message, (x / 1440) * 1, "default-bold") > 750 then sendClientMessage("Invalid Length", 255, 0, 0) return end r, g, b = r or 255, g or 255, b or 255 if #dxMessages == 10 or isMoving then setTimer ( sendClientMessage, 1000, 1, message, r, g, b ) return end table.insert(dxMessages, {message, r, g, b}) dxMessagesTick[#dxMessages] = getTickCount() addEventHandler("onClientRender", root, addMessage) isMoving = true end addEvent("DoN.sendClientMessage", true) addEventHandler("DoN.sendClientMessage", root, sendClientMessage) function addMessage() local index = #dxMessages local difference = (y / 900) * 1.5 dxMessagesY[index] = (index - 1) * 25 if dxMessagesY[index] >= (index - 1) * 25 then dxMessagesY[index] = (index - 1) * 25 if #dxMessages == 10 then isMoving = true addEventHandler("onClientRender", root, removeMessage) removeEventHandler("onClientRender", root, addMessage) else isMoving = false removeEventHandler("onClientRender", root, addMessage) end end end function removeMessage() local difference = (y / 900) * 1.5 for index = 1, #dxMessages do dxMessagesY[index] = dxMessagesY[index] - difference end if dxMessagesY[1] <= -25 then for index = 1, #dxMessages do dxMessages[index] = dxMessages[index + 1] dxMessagesTick[index] = dxMessagesTick[index + 1] dxMessagesY[index] = (index - 1) * 25 end isMoving = false removeEventHandler("onClientRender", root, removeMessage) for index = 1, #dxMessagesY do if not dxMessages[index] then dxMessagesY[index] = -25 end end end end function removeReadMessages() for index, message in pairs(dxMessages) do local currentTick = getTickCount() if currentTick - dxMessagesTick[index] >= 10000 then removeMessage() end end end addEventHandler("onClientRender", root, removeReadMessages) من الاكواد شايف انها لكل المقاسات 1 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