Jump to content

| مشكله في لوحة دي اكس dx |


Recommended Posts

السلام عليكم شباب

انا كنت حابب اسوي لوحة دي اكس

انا اعرف ابرمجها وكل شي بس في مشكله تقابلني ما عارف احلها

انا مسوي في اللوحه 6 ازرار

كل زر يفتح لوحه صغيره

كل لوحة من الصغار, نفس الاحداثيات

اذا ضغطت على زر منهم يفتح لي زر اللوحه الثانيه

رجاء الحل

Link to comment
local start = getTickCount() 
local one, one1 = 0, 0 
local three, three1 = 0, 0
local four, four1 = 500, 30
local two, two1 = 505, 520 
local tick, toggle, x, y
local sx,sy = guiGetScreenSize()
function isMouseInPosition ( x, y, width, height )
	if ( not isCursorShowing( ) ) then
		return false
	end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end
function togglethat()
   if not ( toggle ) then
     tick = getTickCount()
     toggle = true
   else
     toggle = false
   end
end
bindKey("F2", "down", togglethat)
-- Modified version for DX Text
function isCursorOverText(posX, posY, sizeX, sizeY)
    if(isCursorShowing()) then
        local cX, cY = getCursorPosition()
        local screenWidth, screenHeight = guiGetScreenSize()
        local cX, cY = (cX*screenWidth), (cY*screenHeight)
        if(cX >= posX and cX <= posX+(sizeX - posX)) and (cY >= posY and cY <= posY+(sizeY - posY)) then
            return true
        else
            return false
        end
    else
        return false	
    end
end

function dx()
    local now = getTickCount() 
	 if ( toggle ) then
    local p = ( getTickCount() - tick ) / 10
    x, y = interpolateBetween( sx, sy, 0, 100, 173, 0, p, "Linear" )
	local wid, heigh = interpolateBetween(three, three1, 0, four, four1, 0, (now - start) / ((start + 6000) - start), "OutElastic")
    local width, height = interpolateBetween(one, one1, 0, two, two1, 0, (now - start) / ((start + 6000) - start), "OutElastic") 
        dxDrawRectangle(250, 114, width, height, tocolor(0, 0, 0, 150), false) 
        dxDrawRectangle(253, 81, wid, heigh, tocolor(221, 80, 21, 150), false)
        dxDrawText("KOG Ammunation", 372, 81, 759, 107, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 278, 192, 179, 36 ) ) then
        dxDrawRectangle(278, 192, 179, 36, tocolor(0, 0, 0, 255), false)
		else
        dxDrawRectangle(278, 192, 179, 36, tocolor(221, 80, 21, 150), false)
		end
		if ( isMouseInPosition ( 554, 192, 179, 36 ) ) then
		dxDrawRectangle(554, 192, 179, 36, tocolor(0, 0, 0, 255), false)
		else
        dxDrawRectangle(554, 192, 179, 36, tocolor(221, 80, 21, 150), false)
		end
		if ( isMouseInPosition ( 554, 290, 179, 36 ) ) then
		dxDrawRectangle(554, 290, 179, 36, tocolor(0, 0, 0, 255), false)
		else
        dxDrawRectangle(554, 290, 179, 36, tocolor(221, 80, 21, 150), false)
		end
		if ( isMouseInPosition ( 278, 290, 179, 36 ) ) then
        dxDrawRectangle(278, 290, 179, 36, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(278, 290, 179, 36, tocolor(221, 80, 21, 150), false)
		end
        dxDrawText("Pistols", 304, 192, 457, 221, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Machines", 570, 192, 723, 221, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 278, 401, 179, 36 ) ) then
        dxDrawRectangle(278, 401, 179, 36, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(278, 401, 179, 36, tocolor(221, 80, 21, 150), false)
		end
		if ( isMouseInPosition ( 554, 401, 179, 36 ) ) then
        dxDrawRectangle(554, 401, 179, 36, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(554, 401, 179, 36, tocolor(221, 80, 21, 150), false)
		end
		if ( isMouseInPosition ( 278, 524, 179, 36 ) ) then
        dxDrawRectangle(278, 524, 179, 36, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(278, 524, 179, 36, tocolor(221, 80, 21, 150), false)
		end
		if ( isMouseInPosition ( 554, 524, 179, 36 ) ) then
        dxDrawRectangle(554, 524, 179, 36, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(554, 524, 179, 36, tocolor(221, 80, 21, 150), false)
		end
        dxDrawText("Shotguns", 288, 290, 441, 319, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Rifles", 590, 290, 743, 319, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Heavy", 314, 401, 467, 430, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Explosives", 558, 401, 711, 430, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Mini", 330, 524, 483, 553, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Close", 590, 524, 743, 553, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawRectangle(259, 633, 490, 33, tocolor(221, 80, 21, 150), false)
        dxDrawText("Kingdom Of Gamers", 352, 633, 739, 659, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
    end
	end
function pistols()
        dxDrawRectangle(309, 252, 412, 134, tocolor(0, 0, 0, 150), false)
        dxDrawRectangle(304, 228, 422, 24, tocolor(221, 86, 21, 150), false)
        dxDrawText("Pistols", 440, 223, 566, 252, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 309, 258, 131, 35 ) ) then
        dxDrawRectangle(309, 258, 131, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(309, 258, 131, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 442, 258, 139, 35 ) ) then
		dxDrawRectangle(442, 258, 139, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(442, 258, 139, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 586, 258, 135, 35 ) ) then
        dxDrawRectangle(586, 258, 135, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(586, 258, 135, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 319, 309, 114, 35 ) ) then
        dxDrawRectangle(319, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(319, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 457, 309, 114, 35 ) ) then
        dxDrawRectangle(457, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(457, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 597, 309, 114, 35 ) ) then
        dxDrawRectangle(597, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(597, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
        dxDrawText("Deagle", 321, 258, 416, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Silenced", 440, 258, 535, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Colt 45", 586, 258, 681, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 616, 357, 100, 24 ) ) then
		dxDrawRectangle(616, 357, 100, 24, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(616, 357, 100, 24, tocolor(221, 86, 21, 150), false)
		end
        dxDrawText("Bullet", 597, 305, 692, 334, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Bullet", 457, 303, 525, 348, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Bullet", 321, 303, 389, 348, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Close", 616, 354, 711, 383, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
    end
	function machines()
        dxDrawRectangle(309, 252, 412, 134, tocolor(0, 0, 0, 150), false)
        dxDrawRectangle(304, 228, 422, 24, tocolor(221, 86, 21, 150), false)
        dxDrawText("Machines", 440, 223, 566, 252, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 309, 258, 131, 35 ) ) then
        dxDrawRectangle(309, 258, 131, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(309, 258, 131, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 586, 258, 135, 35 ) ) then
        dxDrawRectangle(586, 258, 135, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(586, 258, 135, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 319, 309, 114, 35 ) ) then
        dxDrawRectangle(319, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(319, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
				if ( isMouseInPosition ( 597, 309, 114, 35 ) ) then
        dxDrawRectangle(597, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(597, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end

        dxDrawText("M4", 321, 258, 416, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("AK-47", 586, 258, 681, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 616, 357, 100, 24 ) ) then
		dxDrawRectangle(616, 357, 100, 24, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(616, 357, 100, 24, tocolor(221, 86, 21, 150), false)
		end
		        dxDrawText("Bullet", 597, 305, 692, 334, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Bullet", 321, 303, 389, 348, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Close", 616, 354, 711, 383, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
    end
	function rifles()
        dxDrawRectangle(309, 252, 412, 134, tocolor(0, 0, 0, 150), false)
        dxDrawRectangle(304, 228, 422, 24, tocolor(221, 86, 21, 150), false)
        dxDrawText("Rifles", 440, 223, 566, 252, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 309, 258, 131, 35 ) ) then
        dxDrawRectangle(309, 258, 131, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(309, 258, 131, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 586, 258, 135, 35 ) ) then
        dxDrawRectangle(586, 258, 135, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(586, 258, 135, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 319, 309, 114, 35 ) ) then
        dxDrawRectangle(319, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(319, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
				if ( isMouseInPosition ( 597, 309, 114, 35 ) ) then
        dxDrawRectangle(597, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(597, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end

        dxDrawText("Rifle", 321, 258, 416, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Sniper", 586, 258, 681, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 616, 357, 100, 24 ) ) then
		dxDrawRectangle(616, 357, 100, 24, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(616, 357, 100, 24, tocolor(221, 86, 21, 150), false)
		end
		        dxDrawText("Bullet", 597, 305, 692, 334, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Bullet", 321, 303, 389, 348, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Close", 616, 354, 711, 383, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
    end
	function shotguns()
        dxDrawRectangle(309, 252, 412, 134, tocolor(0, 0, 0, 150), false)
        dxDrawRectangle(304, 228, 422, 24, tocolor(221, 86, 21, 150), false)
        dxDrawText("Shotguns", 440, 223, 566, 252, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 309, 258, 131, 35 ) ) then
        dxDrawRectangle(309, 258, 131, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(309, 258, 131, 35, tocolor(221, 86, 21, 150), false)
		end
				if ( isMouseInPosition ( 442, 258, 139, 35 ) ) then
		dxDrawRectangle(442, 258, 139, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(442, 258, 139, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 586, 258, 135, 35 ) ) then
        dxDrawRectangle(586, 258, 135, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(586, 258, 135, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 319, 309, 114, 35 ) ) then
        dxDrawRectangle(319, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(319, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 457, 309, 114, 35 ) ) then
        dxDrawRectangle(457, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(457, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 597, 309, 114, 35 ) ) then
        dxDrawRectangle(597, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(597, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
		dxDrawText("Shotgun", 440, 258, 535, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Sawed", 321, 258, 416, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Combat", 586, 258, 681, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 616, 357, 100, 24 ) ) then
		dxDrawRectangle(616, 357, 100, 24, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(616, 357, 100, 24, tocolor(221, 86, 21, 150), false)
		end
		dxDrawText("Bullet", 457, 303, 525, 348, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Bullet", 597, 305, 692, 334, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Bullet", 321, 303, 389, 348, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Close", 616, 354, 711, 383, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
    end
	function explosives()
        dxDrawRectangle(309, 252, 412, 134, tocolor(0, 0, 0, 150), false)
        dxDrawRectangle(304, 228, 422, 24, tocolor(221, 86, 21, 150), false)
        dxDrawText("Explosives", 440, 223, 566, 252, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 309, 258, 131, 35 ) ) then
        dxDrawRectangle(309, 258, 131, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(309, 258, 131, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 586, 258, 135, 35 ) ) then
        dxDrawRectangle(586, 258, 135, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(586, 258, 135, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 319, 309, 114, 35 ) ) then
        dxDrawRectangle(319, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(319, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 597, 309, 114, 35 ) ) then
        dxDrawRectangle(597, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(597, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
        dxDrawText("Grenade", 304, 258, 416, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Satchel", 586, 258, 681, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 616, 357, 100, 24 ) ) then
		dxDrawRectangle(616, 357, 100, 24, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(616, 357, 100, 24, tocolor(221, 86, 21, 150), false)
		end

        dxDrawText("Molotov", 595, 310, 692, 334, tocolor(255, 255, 255, 255), 0.8, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Teargas", 318, 310, 389, 348, tocolor(255, 255, 255, 255), 0.9, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Close", 616, 354, 711, 383, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
    end
	function heavy()
        dxDrawRectangle(309, 252, 412, 134, tocolor(0, 0, 0, 150), false)
        dxDrawRectangle(304, 228, 422, 24, tocolor(221, 86, 21, 150), false)
        dxDrawText("Heavy Weapons", 440, 223, 566, 252, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 457, 258, 131, 35 ) ) then
        dxDrawRectangle(457, 258, 131, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(457, 258, 131, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 457, 309, 114, 35 ) ) then
        dxDrawRectangle(457, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(457, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end

        dxDrawText("Minigun", 457, 258, 535, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 616, 357, 100, 24 ) ) then
		dxDrawRectangle(616, 357, 100, 24, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(616, 357, 100, 24, tocolor(221, 86, 21, 150), false)
		end
		dxDrawText("Bullet", 457, 303, 525, 348, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Close", 616, 354, 711, 383, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
    end
		function mini()
        dxDrawRectangle(309, 252, 412, 134, tocolor(0, 0, 0, 150), false)
        dxDrawRectangle(304, 228, 422, 24, tocolor(221, 86, 21, 150), false)
        dxDrawText("Mini Machines", 440, 223, 566, 252, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 309, 258, 131, 35 ) ) then
        dxDrawRectangle(309, 258, 131, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(309, 258, 131, 35, tocolor(221, 86, 21, 150), false)
		end
		if ( isMouseInPosition ( 586, 258, 135, 35 ) ) then
        dxDrawRectangle(586, 258, 135, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(586, 258, 135, 35, tocolor(221, 86, 21, 150), false)
		end

		if ( isMouseInPosition ( 457, 309, 114, 35 ) ) then
        dxDrawRectangle(457, 309, 114, 35, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(457, 309, 114, 35, tocolor(221, 86, 21, 150), false)
		end
        dxDrawText("MP5", 310, 258, 416, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		dxDrawText("UZI", 475, 309, 416, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
        dxDrawText("Close", 616, 354, 711, 383, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		dxDrawText("TEC-9", 600, 258, 681, 287, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false)
		if ( isMouseInPosition ( 616, 357, 100, 24 ) ) then
		dxDrawRectangle(616, 357, 100, 24, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(616, 357, 100, 24, tocolor(221, 86, 21, 150), false)
		end
	end

        label = guiCreateLabel(485, 375, 208, 25, "Bullets:", false)
        edit = guiCreateEdit(375, 303, 275, 31, "", false)   
guiSetVisible(label, false)
guiSetVisible(edit, false)
guiSetAlpha(edit, 0)
guiEditSetMaxLength(edit, 17)
    function bullets()
        dxDrawRectangle(316, 259, 391, 26, tocolor(252, 80, 21, 255), false)
        dxDrawRectangle(320, 286, 383, 143, tocolor(0, 0, 0, 150), false)
        dxDrawRectangle(373, 302, 279, 36, tocolor(255, 255, 255, 255), false)
        dxDrawRectangle(391, 361, 243, 40, tocolor(0, 0, 0, 200), false)
		dxDrawText(guiGetText(edit), 380, 620, 10, 20, tocolor(0, 0, 0, 255), 0.7, "bankgothic", "left", "center", false, false, false, false, false) 
		end
showWindow = false
bindKey("F2", "down", function ( )
if ( showWindow == true ) then
removeEventHandler("onClientRender", root, dx)
showCursor(false)
else
showWindow = not showWindow
addEventHandler("onClientRender", root, dx)
showCursor(true)
end
end
)

showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then -- Wep
if ( showWindow == true ) then
if ( isMouseInPosition ( 554, 524, 179, 36 ) ) then
triggerServerEvent( "givewep", localPlayer, localPlayer ) 
showWindow = not showWindow
end
end
end
end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then ---Close
if ( showWindow == true ) then
if ( isMouseInPosition ( 554, 524, 179, 36 ) ) then
removeEventHandler("onClientRender", root, dx)
showCursor(false)
showWindow = not showWindow
end
end
end
end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then -- Pistol
if ( showWindow == false ) then
if ( isMouseInPosition ( 278, 192, 179, 36 ) ) then
addEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, dx)
showWindow = not showWindow
end
end
end
end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then -- Pistol
if ( isMouseInPosition ( 457, 309, 114, 35 ) ) then
addEventHandler("onClientRender", root, bullets)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, heavy)
removeEventHandler("onClientRender", root, mini)
	if (showWindow == false) then
		guiSetVisible(edit,true)
		guiSetVisible(label,true)
		showCursor(true)
		addEventHandler("onClientRender",root,bullets)
	else
		guiSetVisible(edit,false)
		guiSetVisible(label,false)
		showCursor(false)
		removeEventHandler("onClientRender",root,bullets)
		showWindow = not showWindow
	end
	end
	end
	end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( isMouseInPosition ( 319, 309, 114, 35 ) ) then
addEventHandler("onClientRender", root, bullets)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, heavy)
removeEventHandler("onClientRender", root, mini)
	if (showWindow == false) then
		guiSetVisible(edit,true)
		guiSetVisible(label,true)
		showCursor(true)
		addEventHandler("onClientRender",root,bullets)
	else
		guiSetVisible(edit,false)
		guiSetVisible(label,false)
		showCursor(false)
		removeEventHandler("onClientRender",root,bullets)
		showWindow = not showWindow
	end
	end
	end
	end
)


showWindow = false 
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( isMouseInPosition ( 597, 309, 114, 35 ) ) then
addEventHandler("onClientRender", root, bullets)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, heavy)
removeEventHandler("onClientRender", root, mini)
	if (showWindow == false) then
		guiSetVisible(edit,true)
		guiSetVisible(label,true)
		showCursor(true)
		addEventHandler("onClientRender",root,bullets)
	else
		guiSetVisible(edit,false)
		guiSetVisible(label,false)
		showCursor(false)
		removeEventHandler("onClientRender",root,bullets)
		showWindow = not showWindow
	end
	end
	end
	end
)

showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then -- Machines
if ( showWindow == false ) then
if ( isMouseInPosition ( 554, 192, 179, 36 ) ) then
addEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, dx)
end
showWindow = not showWindow
end
end
end
)


showWindow = false 
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( showWindow == false ) then
if ( isMouseInPosition ( 616, 357, 100, 24 ) ) then -- Close Windows
addEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, heavy)
removeEventHandler("onClientRender", root, mini)
end
showWindow = not showWindow
end
end
end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( showWindow == false ) then
if ( isMouseInPosition ( 278, 290, 179, 36 ) ) then -- Shotguns
addEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, heavy)
removeEventHandler("onClientRender", root, mini)
end
showWindow = not showWindow
end
end
end
)
 
 showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( showWindow == false ) then
if ( isMouseInPosition ( 554, 290, 179, 36 ) ) then -- Rifles
addEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, heavy)
removeEventHandler("onClientRender", root, mini)
end
showWindow = not showWindow
end
end
end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( showWindow == false ) then
if ( isMouseInPosition ( 554, 401, 179, 36 ) ) then -- Explosives
addEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, heavy)
removeEventHandler("onClientRender", root, mini)
end
showWindow = not showWindow
end
end
end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( showWindow == false ) then
if ( isMouseInPosition ( 278, 401, 179, 36 ) ) then -- Heavy Weapons
addEventHandler("onClientRender", root, heavy)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, mini)
end
showWindow = not showWindow
end
end
end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( showWindow == false ) then
if ( isMouseInPosition ( 278, 401, 179, 36 ) ) then -- Heavy Weapons
addEventHandler("onClientRender", root, heavy) then
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, mini)
end
showWindow = not showWindow
end
end
end
)


showWindow = false
addEventHandler("onClientClick", root,
function ( button, state )
if ( button == "left" and state == "up" ) then
if ( showWindow == false ) then
if ( isMouseInPosition ( 278, 524, 179, 36 ) ) then -- Mini Weapons
addEventHandler("onClientRender", root, mini)
removeEventHandler("onClientRender", root, dx)
removeEventHandler("onClientRender", root, pistols)
removeEventHandler("onClientRender", root, machines)
removeEventHandler("onClientRender", root, shotguns)
removeEventHandler("onClientRender", root, rifles)
removeEventHandler("onClientRender", root, explosives)
removeEventHandler("onClientRender", root, heavy)
end
showWindow = not showWindow
end
end
end
)


local ammoMarkers = {
[1]={307.97, -141.04, 999.6, 7, 1},
[2]={313.95, -133.69, 999.6, 7, 1},
[3]={290.15, -109.42, 1001.51, 6, 10},
[4]={291.49, -83.97, 1001.51, 4, 2},
[5]={291.49, -83.96, 1001.51, 4, 3},
[6]={291.49, -83.96, 1001.51, 4, 5},
[7]={291.46, -83.8, 1001.51, 4, 6},
[8]={290.07, -109.36, 1001.51, 6, 3},
[9]={290.02, -109.51, 1001.51, 6, 8},
[10]={295.64, -38, 1001.51, 1, 100},
[11]={290.13, -109.46, 1001.51, 6, 9},
[12]={311.88, -164.52, 999.6, 6, 11},
[13]={3155, 1929, 32.7, 0, 0},
[14]={1551.88, -1633.52, 13.6, 0, 0}
}

function ammoMarkerHit( hitPlayer, matchingDimension )
local px,py,pz = getElementPosition ( hitPlayer )
local mx, my, mz = getElementPosition ( source )
--if matchingDimension then
    if hitPlayer == localPlayer then
        local vehicle = getPedOccupiedVehicle (localPlayer)
            if not vehicle then
                if ( pz-3 < mz ) and ( pz+3 > mz ) then
                local cost = 5000
                local tName = getTeamName(getPlayerTeam(localPlayer))
                if tName == "Police Service" then
                    cost = 1000
                else
                    cost = 5000
                end
                    addEventHandler("onClientRender", root, dx)
                    showCursor(true)
                end
            end
        end
    end

for ID in pairs(ammoMarkers) do
local x, y, z = ammoMarkers[ID][1], ammoMarkers[ID][2], ammoMarkers[ID][3]
local interior = ammoMarkers[ID][4]
local dimension = ammoMarkers[ID][5]
local ammoShopMarker = createMarker(x,y,z -1,"cylinder",1.5,200,255,255,255)
setElementInterior(ammoShopMarker, interior)
setElementDimension( ammoShopMarker, tonumber(dimension) )

addEventHandler("onClientMarkerHit", ammoShopMarker, ammoMarkerHit)
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
function totalthing()
if tonumber(guiGetText(label)) > 0 then
local cur = tonumber(guiGetText(label))* tonumber(priceSp)
guiSetText(label, "Buy Weapon : $"..convertNumber ( cur ) )
            if tostring(choosenWep) == "22" then
                bul = 1
            elseif tostring(choosenWep) == "23" then
                bul = 1
            elseif tostring(choosenWep) == "24" then
                bul = 1
            elseif tostring(choosenWep) == "25" then
               bul = 1
            elseif tostring(choosenWep) == "26" then
                bul =  1
            elseif tostring(choosenWep) == "27" then
                bul = 1
            elseif tostring(choosenWep) == "28" then
                bul = 1
            elseif tostring(choosenWep) == "29" then
                bul =  1
            elseif tostring(choosenWep) == "30" then
                bul =  1
            elseif tostring(choosenWep) == "31" then
               bul =  1
            elseif tostring(choosenWep) == "32" then
                bul =  1
            elseif tostring(choosenWep) == "33" then
                bul =  1
            elseif tostring(choosenWep) == "34" then
               bul =  1
            elseif tostring(choosenWep) == "38" then
                bul =  1
            end
			curbl = bul* tonumber(guiGetText(label)) or tonumber(guiGetText(label))
guiSetText(label, "Bullets: "..curbl)
bul = nil
end
end

function d()
removeEventHandler("onClientRender", root, bullets)
 if choosenWep == 39 or choosenWep == 16 or choosenWep == 17 or choosenWep == 18 then 
  if tonumber(guiGetText(edit)) then
 triggerServerEvent ( "buySpecial", localPlayer, tostring(choosenWep), guiGetText(edit), tostring(priceSp) ) 
 end 
 return
 end
 if tonumber(guiGetText(edit)) then
 triggerServerEvent ( "buyAmmo", localPlayer, tostring(choosenWep), guiGetText(edit), tostring(priceSp) ) 
 end 
 end

الأكواد, رجاء الحل ضروري

Edited by gamerxx
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...