Jump to content

سؤال


iSULTAN

Recommended Posts

السلام عليكم ورحمه الله , معي اكواد توب بار شات

بس فيها مشكله

كلنت

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)

سيرفر

function sendClientMessage(message,player, r, g, b)
	if (isElement(player)) then
		triggerClientEvent(player, "DoN.sendClientMessage", player, message, r, g, b)
	end
end

 

ابي الكلام في الششات يصير لكل الشاشات بنفس المقاس

 

Link to comment
1 minute ago, TOUNSI | ا̍ڸــڛۣــ؏ــٰٱ̍دہ said:

يب ادري انا قلت له ماهو يعني هو ذا ماني اقصد ابي شرح ض2
صبر بعدل كلامي

علي حسب كلامك ان انتا تقول العيب من المتغيرين يعني ولا وش ؟؟

 

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