Szerző Téma: Klikkelés  (Megtekintve 1306 alkalommal)

Klikkelés
« Dátum: 2017. Február 18. - 19:02:08 »
0 Show voters
Sziasztok! Egy dashboard készítése közben elakadtam! Nem sikerült megcsinálnom, hogy csak akkor tudjak rákattintani a gombra, ha a dashboard elővan hozva. Mielőtt először megnyitom működik, de miután bezárom és a képernyőre kattintok, ugyanúgy kiírja a szöveget! Mi lehet a gond?

Klikkelés
« Válasz #1 Dátum: 2017. Február 18. - 19:16:16 »
0 Show voters
Hogy oldottad meg a gombot?

Klikkelés
« Válasz #2 Dátum: 2017. Február 18. - 19:17:43 »
0 Show voters
Szia! DX vsgy gui gomb?

Klikkelés
« Válasz #3 Dátum: 2017. Február 18. - 19:19:54 »
0 Show voters

local screenW, screenH = guiGetScreenSize()
local font = dxCreateFont( \"font/myriadproregular.ttf\", 11 )
local font1 = dxCreateFont( \"font/OpenSansB.ttf\", 12 )
local font2 = dxCreateFont( \"font/OpenSans.ttf\", 12 )
local monitorSize = {guiGetScreenSize()}
local panelSize = {500, 400}
local panelX, panelY = monitorSize[1]/2-panelSize[1]/2, monitorSize[2]/2-panelSize[2]/2
local mutat = false
local jelenAblak = 0
function isCursorOnBox(xS,yS,wS,hS)
if(isCursorShowing()) then
   XY = {guiGetScreenSize()}
   local cursorX, cursorY = getCursorPosition()
   cursorX, cursorY = cursorX*XY[1], cursorY*XY[2]
   if(cursorX >= xS and cursorX <= xS+wS and cursorY >= yS and cursorY <= yS+hS) then
      return true
   else
      return false
   end
end   
end
function dobozbaVan(dX, dY, dSZ, dM, eX, eY)
if(eX >= dX and eX <= dX+dSZ and eY >= dY and eY <= dY+dM) then
   return true
else
   return false
end
end
 
 
function rajzol()
local id = getElementData(localPlayer, \"char:id\")
local name = getElementData(localPlayer, \"acc:name\")
local admin = getElementData(localPlayer, \"acc:admin\")
local penz = getElementData(localPlayer, \"char:money\")
local ig_name = getElementData(localPlayer, \"char:name\")
local pp = getElementData(localPlayer, \"char:pp\")
local skin = getElementData(localPlayer, \"char:skin\")
local vehSlot = getElementData(localPlayer, \"char:vehSlot\")
local garageSlot = getElementData(localPlayer, \"char:houseSlot\")
local jatszottperc = getElementData(localPlayer, \"char:playedTime\")
--if show then
--addEventHandler(\"onClientClick\", root, semmisem)
--
--else
addEventHandler(\"onClientClick\", root, menuClick)
--end
 
   dxDrawText(\"Név:\", panelX+100, panelY-100, 400, 400, tocolor(255,255,255), 1, font1, \"center\", \"center\", true, true, true, true)         
   dxDrawText(\"#d8a84e\"..ig_name, panelX+200, panelY-100, 400, 400, tocolor(255,255,255), 1, font2, \"center\", \"center\",  true, true, true, true)         
   dxDrawText(\"Készpénz:\", panelX+143, panelY-50, 400, 400, tocolor(255,255,255), 1, font1, \"center\", \"center\", true, true, true, true)         
   dxDrawText(\"PP:\", panelX+88, panelY, 400, 400, tocolor(255,255,255), 1, font1, \"center\", \"center\", true, true, true, true)         
   dxDrawText(\"Skin ID:\", panelX+122, panelY+50, 400, 400, tocolor(255,255,255), 1, font1, \"center\", \"center\", true, true, true, true)         
   dxDrawText(\"#d8a84e\"..skin, panelX+220, panelY+50, 400, 400, tocolor(255,255,255), 1, font2, \"center\", \"center\", true, true, true, true)         
   dxDrawText(\"#d8a84e\"..pp..\"#ffffffPP\", panelX+145, panelY, 400, 400, tocolor(255,255,255), 1, font2, \"center\", \"center\", true, true, true, true)         
   dxDrawText(\"#4286f4\"..penz..\" #ffffff$\", panelX+260, panelY-50, 400, 400, tocolor(255,255,255), 1, font2, \"center\", \"center\",  true, true, true, true)         
   --dxDrawText(\"#4286f4\"..penz..\"#ffffff$\", panelX+260, panelY-50, 400, 400, tocolor(255,255,255), 1, font2, \"center\", \"center\",  true, true, true, true)         
   dxDrawText(\"Admin:\", panelX+120, panelY+100, 400, 400, tocolor(255,255,255), 1, font1, \"center\", \"center\",  true, true, true, true)         
   --dxDrawText(\"Autó slotok:\", panelX+120, panelY+100, 400, 400, tocolor(255,255,255), 1, font1, \"center\", \"center\",  true, true, true, true)         
   dxDrawText(\"Játszott percek:\", panelX+190, panelY+150, 400, 400, tocolor(255,255,255), 1, font1, \"center\", \"center\",  true, true, true, true)         
   dxDrawText(\"#41f48f\"..jatszottperc..\" #ffffffperc\", panelX+380, panelY+150, 400, 400, tocolor(255,255,255), 1, font1, \"center\", \"center\",  true, true, true, true)         
   
   
   
   dxDrawImage(panelX-170, panelY-77, 24, 24, \"image/info.png\", 0, 0, 0, tocolor(255, 255, 255, 200), true)
   dxDrawImage(panelX+50, panelY-77, 24, 24, \"image/car_garage.png\", 0, 0, 0, tocolor(255, 255, 255, 200), true)
   dxDrawImage(panelX+260, panelY-77, 24, 24, \"image/admin.png\", 0, 0, 0, tocolor(255, 255, 255, 200), true)
   dxDrawImage(panelX+476, panelY-77, 24, 24, \"image/settings.png\", 0, 0, 0, tocolor(255, 255, 255, 200), true)
   --dxDrawImage(panelX-170, panelY-77, 24, 24, \"image/info.png\", 0, 0, 0, tocolor(255, 255, 255, 150), true)
        dxDrawRectangle((screenW - 847) / 2, (screenH - 481) / 2, 847, 481, tocolor(0, 0, 0, 247), false) --bg
        dxDrawLine(297 - 1, 173 - 1, 297 - 1, 199, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(498, 173 - 1, 297 - 1, 173 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(297 - 1, 199, 498, 199, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(498, 199, 498, 173 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(512 - 1, 173 - 1, 512 - 1, 199, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(713, 173 - 1, 512 - 1, 173 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(512 - 1, 199, 713, 199, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(713, 199, 713, 173 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(727 - 1, 173 - 1, 727 - 1, 199, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(928, 173 - 1, 727 - 1, 173 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(727 - 1, 199, 928, 199, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(928, 199, 928, 173 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(943 - 1, 173 - 1, 943 - 1, 199, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(1144, 173 - 1, 943 - 1, 173 - 1, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(943 - 1, 199, 1144, 199, tocolor(0, 0, 0, 255), 1, false)
        dxDrawLine(1144, 199, 1144, 173 - 1, tocolor(0, 0, 0, 255), 1, false)
   
      --dxDrawText(\"\", 89, 383, 180, 444, tocolor(255, 255, 255, 255), 1.00, \"default\", \"left\", \"top\", false, false, false, false, false)
      --dxDrawText(\"\", 89, 383, 180, 444, tocolor(255, 255, 255, 255), 1.00, \"default\", \"left\", \"top\", false, false, false, false, false)
      --dxDrawText(\"\", 89, 383, 180, 444, tocolor(255, 255, 255, 255), 1.00, \"default\", \"left\", \"top\", false, false, false, false, false)
      dxDrawRectangle(panelX-173, panelY-77, 201, 26, tocolor(0, 0, 0, 195))
      dxDrawRectangle(panelX+42, panelY-77, 201, 26, tocolor(0, 0, 0, 195), false) --2. gomb
      dxDrawRectangle(panelX+257, panelY-77, 201, 26, tocolor(0, 0, 0, 195), false) --3. gomb
      dxDrawRectangle(panelX+473, panelY-77, 201, 26, tocolor(0, 0, 0, 195), false) --4. gomb
   dxDrawImage(panelX-145, panelY-10, 128, 256, \"files/Skinek/\"..getElementModel(localPlayer)..\".jpg\", 0, 0, 0, tocolor(255, 255, 255, 255)) ---<[ Skin kép ]>---
   dxDrawImage(panelX-151, panelY-17, 256, 512, \"files/Skinek/frame.png\", 0, 0, 0, tocolor(0, 0, 0, 255)) ---<[ Skin kép ]>---
      
      
      
if(isCursorOnBox(panelX-173, panelY-77, 201, 26)) then   
dxDrawRectangle(panelX-173, panelY-77, 201, 26, tocolor(60, 114, 201), false)
end
if(isCursorOnBox(panelX+42, panelY-77, 201, 26)) then   
dxDrawRectangle(panelX+42, panelY-77, 201, 26, tocolor(60, 114, 201), false) --2. gomb
end
if(isCursorOnBox(panelX+257, panelY-77, 201, 26)) then   
dxDrawRectangle(panelX+257, panelY-77, 201, 26, tocolor(60, 114, 201), false) --3. gomb
end
if(isCursorOnBox(panelX+473, panelY-77, 201, 26)) then   
dxDrawRectangle(panelX+473, panelY-77, 201, 26, tocolor(60, 114, 201), false) --4. gomb
end
 
end
 
function meghivod()
addEventHandler(\"onClientRender\", root, rajzol)
rajzol()
end
 
 

-------------------------Klikkelések-----------------------------------      
   
function menuClick(gomb,stat,x,y)
if getElementData(localPlayer, \"dashon\") then return
if gomb == \"left\" and stat == \"down\" then
if (dobozbaVan(panelX+473, panelY-77, 201, 26, x, y)) then
   outputChatBox(\"#ffffffSettings-re kattoltál!\", 124, 197, 118, true)
end
if (dobozbaVan(panelX+257, panelY-77, 201, 26, x, y)) then
   outputChatBox(\"#ffffffAdmin-ra kattoltál!\", 124, 197, 118, true)
end
if (dobozbaVan(panelX+42, panelY-77, 201, 26, x, y)) then
   outputChatBox(\"#ffffffVagyon-ra kattoltál!\", 124, 197, 118, true)
end
if (dobozbaVan(panelX-173, panelY-77, 201, 26, x, y)) then
   outputChatBox(\"#ffffffInfo-ra kattoltál!\", 124, 197, 118, true)

end
end

end
end
 
addCommandHandler(\"hehe\", meghivod)
   
bindKey(\"home\", \"down\", function()
setElementData(localPlayer, \"dashon\")
addEventHandler(\"onClientRender\", root, rajzol)
toggleControl(\"change_camera\",false)
 
end)
 
bindKey(\"backspace\", \"down\", function()
setElementData(localPlayer, \"dashoff\")
removeEventHandler(\"onClientRender\", root, rajzol)
toggleControl(\"change_camera\",true)
end)

 
Dx

Klikkelés
« Válasz #4 Dátum: 2017. Február 18. - 19:28:28 »
0 Show voters

if getElementData(localPlayer, \"dashon\") then return

 
 

Klikkelés
« Válasz #5 Dátum: 2017. Február 18. - 19:30:25 »
0 Show voters
Ez benn van a menuClick funkció-ban vagy máshova is kell? 

Klikkelés
« Válasz #6 Dátum: 2017. Február 18. - 19:37:12 »
0 Show voters
Ez nem jó:D
 
Egy az, h nem adsz meg a dashon -ra értéket. Kettő meg, h nem jól használod.
 
Ha a dashon-ra true -t vagy false -t raksz, akkor vagy:
 

if getElementData(localPlayer, \"dashon\") then
[ide a többi kód]
end

 
Vagy pedig:
 

if not getElementData(localPlayer, \"dashon\") then return end
[ide a többi kód]

 
De amúgy szerintem itt ne használj elementData -t, hanem csak sima változót. (kivéve ha más resource-ban is le akarod kérni, h elöl van-e a dashboard)

Klikkelés
« Válasz #7 Dátum: 2017. Február 18. - 19:42:46 »
0 Show voters
A gomboknál meg inkább elseif -et használj.
 
Ja meg a tabot (meg az entert) ne össze-vissza rakd, könnyebb a dolgod, ha jobban átlátod a kódot:D

Klikkelés
« Válasz #8 Dátum: 2017. Február 18. - 19:43:02 »
0 Show voters
Köszönöm, le is tesztelem! Azért használok element data-t mert ezt találtam a legegyszerűbbnek. Még csak tanulgatom a lua-t. Nem tudom könnyebben hogyan lehetne megoldani. 
« Utoljára szerkesztve: 2017. Február 18. - 19:43:08 írta Koko ((Maxi)) »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal