Jump to content

إستفسار


Recommended Posts

سلام عليكم ورحمه الله الحين

عندي مود توب بار شات

وابي كل الكلام الي فوق والخط

يجي على كل الشاشات نفس المقاس حق المود

لانه يجي عندي مختلف وعند مقاس شاشه اخري مختلفه نرجو الأفادة

Link to comment

ابيه على جميع الشاشات المقاس

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
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)

 

من الاكواد شايف انها لكل المقاسات :| 

  • Like 1
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...