Jump to content

Menu Bug


Tando

Recommended Posts

local sx, sy = guiGetScreenSize()

local rx, ry = sx/1920, sy/1080

local selectedPlayer = false

function isCursorInPosition(rectX, rectY, rectW, rectH)
    if isCursorShowing() then
        local cursorX, cursorY = getCursorPosition()
        local cursorX, cursorY = cursorX * sx, cursorY * sy
        return (cursorX >= rectX and cursorX <= rectX+rectW) and (cursorY >= rectY and cursorY <= rectY+rectH)
    else
        return false
    end
end

setTimer(function()
    if isElement(selectedPlayer) then
        local x, y, z = getElementPosition(localPlayer)
        local px, py, pz = getElementPosition(selectedPlayer)
        local dist = getDistanceBetweenPoints3D(x, y, z, px, py, pz)
        if dist > 5 then
            selectedPlayer = false
        end
    end
end, 500, 0)
local screenW, screenH = guiGetScreenSize()
addEventHandler("onClientRender", getRootElement(), function()
    if isElement(selectedPlayer) then
   dxDrawLine(624, 136, 765, 137, tocolor(255, 255, 255, 255), 2, false)
        dxDrawLine(624, 236, 764, 236, tocolor(255, 255, 255, 255), 2, false)
        dxDrawLine(624, 137, 623, 238, tocolor(255, 255, 255, 255), 2, false)
        dxDrawLine(765, 137, 764, 237, tocolor(255, 255, 255, 255), 2, false)
        dxDrawLine(624, 169, 765, 169, tocolor(255, 255, 255, 255), 2, false)
        dxDrawLine(624, 202, 765, 202, tocolor(255, 255, 255, 255), 2, false)

        dxDrawText("Menu", 657, 106, 785, 137, tocolor(255, 255, 255, 255), 2.00, "default-bold", "left", "top", false, false, false, false, false)
        dxDrawText("Revive", 663, 140, 749, 164, tocolor(255, 255, 255, 255), 0.90, "pricedown", "left", "top", false, false, false, false, false)
        dxDrawText("Trade", 663, 174, 749, 198, tocolor(255, 255, 255, 255), 0.90, "pricedown", "left", "top", false, false, false, false, false)
        dxDrawText("Invite", 663, 208, 749, 232, tocolor(255, 255, 255, 255), 0.90, "pricedown", "left", "top", false, false, false, false, false)
				if isCursorInPosition(663, 140, 749, 164)  then
		  dxDrawText("Revive", 663, 140, 749, 164, tocolor(255, 255, 255, 255), 0.90, "pricedown", "left", "top", false, false, false, false, false)
		  end
		  if isCursorInPosition(663, 174, 749, 198)  then
		    dxDrawText("Trade", 663, 174, 749, 198, tocolor(255, 255, 255, 255), 0.90, "pricedown", "left", "top", false, false, false, false, false)
		  end
		   if isCursorInPosition(663, 208, 749, 232)  then
		      dxDrawText("Invite", 663, 208, 749, 232, tocolor(255, 255, 255, 255), 0.90, "pricedown", "left", "top", false, false, false, false, false)
		  end
		 
		  
    end    
end)
---ped = createPed(217,-1967.25732, -435.42059, 35.33594,80)
ped = createPed(217,133.37, -96.9, 1.43,80)




local screenW, screenH = guiGetScreenSize()


addEventHandler("onClientClick", getRootElement(), function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedElement)
    if (state == "up") then
        if (button == "right") then
            if (clickedElement) and (getElementType(clickedElement) == "player") and clickedElement ~= localPlayer then
                cX, cY = absoluteX, absoluteY
                selectedPlayer = clickedElement
            else
                selectedPlayer = false
            end
        elseif (button == "left") then
            if isElement(selectedPlayer) and isCursorInPosition(663, 140, 749, 164) and getElementData(selectedPlayer,"KArr") then
                triggerServerEvent("up1", resourceRoot, selectedPlayer) 
				
                
                selectedPlayer = false
            end
			 if isElement(selectedPlayer) and isCursorInPosition(663, 208, 749, 232)  then
			
                triggerServerEvent("clanInvitePlayer1",resourceRoot,getElementData(localPlayer,"Clan"),selectedPlayer)
				
                
                selectedPlayer = false
            end
        end
    end
end)

Server

addEvent("up1",true) 
addEventHandler("up1", getRootElement( ), function( button, state, player ) 
    if button == "left" and state == "down" then
        if getElementType( source ) == "player" then 
		if player == source then return end
		if getElementData(source,"KArr") then   
            local x, y, z = getElementPosition( player )
            local x1, y1, z1 = getElementPosition( source ) 
            local distance = getDistanceBetweenPoints3D( x, y, z, x1, y1, z1 )
            if distance < 2 and (getTeamName(getPlayerTeam(player)) == "Gangster" or getTeamName(getPlayerTeam(player)) == "Terrorists" ) then 
			removeEventHandler("onPlayerQuit", source, onQuit)
			setPedAnimation(player, "medic", "cpr")
			setElementData (player,"antibug" , true)
			 triggerClientEvent ( source,"showit",source )
			  triggerClientEvent ( player,"showit",player )
			  if isTimer(proTimerx[source]) then killTimer(proTimerx[source]) end
              if isTimer(kArrest[source]) then killTimer(kArrest[source]) end 
	
              end
            end
        end
    end
end)

idk why it's doesn't work

it's work when player open menu and click revive player get revive

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