Kors

How up DX position

Recommended Posts

local playerMoney = getPlayerMoney ( localPlayer )
local messages =  { }
local sx, sy = guiGetScreenSize ( )

addEventHandler ( "onClientRender", root, function ( )
	local tick = getTickCount ( )
	if ( playerMoney ~= getPlayerMoney ( localPlayer ) ) then
		local pM = getPlayerMoney ( localPlayer ) 
		if ( pM > playerMoney ) then
			local diff = pM - playerMoney
			table.insert ( messages, { diff, true, tick + 5000, 180 } )
		else
			local diff = playerMoney - pM
			table.insert ( messages, { diff, false, tick + 5000, 180 } )
		end
		playerMoney = pM
	end
	
	if ( #messages > 7 ) then
		table.remove ( messages, 1 )
	end
	
	for index, data in ipairs ( messages ) do
		local v1 = data[1]
		local v2 = data[2]
		local v3 = data[3]
		local v4 = data[4]
		dxDrawRectangle ( sx - 220, (sy-20)-(index*25), 200, 20, tocolor ( 0, 0, 0, v4 ) )
		
		if ( v2 ) then
			dxDrawText ( "+ $"..convertNumber ( v1 ), sx - 200, (sy-18)-(index*25), 50, 20, tocolor ( 0, 255, 0, v4+75 ), 1, 'default-bold' )
		else
			dxDrawText ( "- $"..convertNumber ( v1 ), sx - 200, (sy-18)-(index*25), 50, 20, tocolor ( 255, 0, 0, v4+75 ), 1, 'default-bold' )
		end
		
		if ( tick >= v3 ) then
			messages[index][4] = v4-2
			if ( v4 <= 25 ) then
				table.remove ( messages, index )
			end
		end
	end
end )



function convertNumber ( number )  
	local formatted = number  
	while true do      
		formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')    
		if ( k==0 ) then      
			break   
		end  
	end  
	return formatted
end

 

9fffa31b5174.png

Share this post


Link to post
if ( v2 ) then
    dxDrawText ( "+ $"..convertNumber ( v1 ), sx - 200, (sy-18)-(index*25), 50, 20, tocolor ( 0, 255, 0, v4+75 ), 1, 'default-bold' )
else
    dxDrawText ( "- $"..convertNumber ( v1 ), sx - 200, (sy-18)-(index*25), 50, 20, tocolor ( 255, 0, 0, v4+75 ), 1, 'default-bold' )
end


sx - 200 - This is the screen width - 200 pixels, which is where it currently is on the screen. Change the 200 to a higher value to subtract from the total screen width.

  • Like 1

Share this post


Link to post

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.