Jump to content

please guys help please guyys :'( :'( :'(


iiv03

Recommended Posts

I'm telling the third time how to make the button press the next picture changes, I tried this and did not succeed, please help :'(

 

Client-Side :

 

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 drawWindow()
        dxDrawRectangle(296, 104, 688, 512, tocolor(0, 0, 0, 180), false)
		if ( isMouseInPosition(372, 542, 160, 43) ) then-- Left
		dxDrawRectangle(372, 542, 160, 43, tocolor(0, 0, 0, 255), false)
		else
		dxDrawRectangle(372, 542, 160, 43, tocolor(80, 80, 80, 255), false)
		end
		if ( isMouseInPosition(783, 542, 160, 43) ) then --Right
		dxDrawRectangle(783, 542, 160, 43, tocolor(0, 0, 0, 255), false)
		else
        dxDrawRectangle(783, 542, 160, 43, tocolor(80, 80, 80, 255), false)
		end
        dxDrawRectangle(296, 104, 688, 38, tocolor(80, 80, 80, 255), false)
        dxDrawText("Left", 370, 542, 532, 585, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Right", 783, 542, 945, 585, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("× [ Skin Cars ] ×", 295, 103, 984, 142, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawImage(493, 161, 295, 361, ":guieditor/images/examples/mtalogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

function addskin ( )
		if ( isMouseInPosition(372, 542, 160, 43) ) then
		triggerServerEvent("onVehicleRandomColor", getLocalPlayer())
		if ( isMouseInPosition(783, 542, 160, 43) ) then
		triggerServerEvent("onPlayerRandomSkin", getLocalPlayer())
        end
end
addEventHandler ( "onClientClick", getRootElement(), addskin )

	bindKey("F4","down",function ( )
	if ( removeEventHandler("onClientRender",root,drawWindow) ) then
	removeEventHandler("onClientRender",root,drawWindow)
	addEventHandler("onClientClick", getRootElement(), onButtonClick)
	removeEventHandler("onClientClick", getRootElement(), onButtonClick)
	addEventHandler("onClientRender", getRootElement(), drawWindow)
	showCursor(false)
	else
	addEventHandler("onClientRender",root,drawWindow)
	showCursor(true)
	end
	 end
	  )

Server :

---------------------------------
-- TEST DX PANEL
-- AUTHOR: LIME (C)
-- CREATED: 31.10.16
---------------------------------

-- GLOBAL VARIABLES

local theSkins = {0, 1, 2, 7, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32, 33, 34, 35, 36, 37, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 57, 58, 59, 60, 61, 62, 66, 67, 68, 70, 71, 72, 73, 78, 79, 80, 81, 82, 83, 84, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 132, 133, 134, 135, 136, 137, 142, 143, 144, 146, 147, 153, 154, 155, 156, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 170, 171, 173, 174, 175, 176, 177, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 200, 202, 203, 204, 206, 209, 210, 212, 213, 217, 220, 221, 222, 223, 227, 228, 229, 230, 234, 235, 236, 239, 240, 241, 242, 247, 248, 249, 250, 252, 253, 254, 255, 258, 259, 260, 261, 262, 264, 265, 266, 267, 268, 269, 270, 271, 272, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 290, 291, 292, 293, 294, 295, 296, 297, 299, 300, 301, 302, 303, 305, 306, 307, 308, 309, 310, 311, 312}

-- MAIN

function randColor()
local theVehicle = getPedOccupiedVehicle(source)
	if (theVehicle) then
		setVehicleColor(theVehicle, math.random(255), math.random(255), math.random(255))
	end
end
addEvent("onVehicleRandomColor", true)
addEventHandler("onVehicleRandomColor", getRootElement(), randColor)

function randSkin()
	setElementModel(source, theSkins[math.random(#theSkins)])
end
addEvent("onPlayerRandomSkin", true)
addEventHandler("onPlayerRandomSkin", getRootElement(), randSkin)

guys please I have gone through this thing. I am 24/24 to build this script. In the other, this has not succeeded.

Link to comment
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 drawWindow()
        dxDrawRectangle(296, 104, 688, 512, tocolor(0, 0, 0, 180), false)
		dxDrawRectangle(372, 542, 160, 43, tocolor(0, 0, 0, 255), false)
		dxDrawRectangle(372, 542, 160, 43, tocolor(80, 80, 80, 255), false)
		dxDrawRectangle(783, 542, 160, 43, tocolor(0, 0, 0, 255), false)
        dxDrawRectangle(783, 542, 160, 43, tocolor(80, 80, 80, 255), false)
        dxDrawRectangle(296, 104, 688, 38, tocolor(80, 80, 80, 255), false)
        dxDrawText("Left", 370, 542, 532, 585, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("Right", 783, 542, 945, 585, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawText("× [ Skin Cars ] ×", 295, 103, 984, 142, tocolor(255, 255, 255, 255), 2.00, "default-bold", "center", "center", false, false, false, false, false)
        dxDrawImage(493, 161, 295, 361, ":guieditor/images/examples/mtalogo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

addEventHandler("onClientClick",root,
function(bttn,state)
    if bttn == "left" and state == "down" then
        if GonnaFade then return false end
        local resolutionX = 1366
        local resolutionY = 768
        local sWidth,sHeight = guiGetScreenSize( )
        if isMouseInPosition((783/resolutionX )*sWidth,(542/resolutionY )*sHeight, (160/resolutionX )*sWidth, (43/resolutionY )*sHeight) then
		triggerServerEvent("onPlayerRandomSkin", getLocalPlayer())
		if isMouseInPosition((372/resolutionX )*sWidth,(542/resolutionY )*sHeight, (160/resolutionX )*sWidth, (43/resolutionY )*sHeight) then
		triggerServerEvent("onVehicleRandomColor", getLocalPlayer())
end
end
end
end)

	bindKey("F4","down",function ( )
	if ( removeEventHandler("onClientRender",root,drawWindow) ) then
	removeEventHandler("onClientRender",root,drawWindow)
	addEventHandler("onClientClick", getRootElement(), onButtonClick)
	removeEventHandler("onClientClick", getRootElement(), onButtonClick)
	addEventHandler("onClientRender", getRootElement(), drawWindow)
	showCursor(false)
	else
	addEventHandler("onClientRender",root,drawWindow)
	showCursor(true)
	end
	 end
	  )

@liwahadri

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