Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2020-08-03, 23:02


Rumper

Majster od pysa






Wiek: 15
Na forum: 3457 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
Witam, pisz? skrypt na prac? lecz spotka?em si? z kilkoma problemi na kt?re zaradzi? nie umiem.Pierwszy problem jest taki ?e gdy u?ywam detachElements to tak jakby robi tylko ?e si? kopiuje ten objekt a gracz dalej to ma, a kolejna jest z tym ?e nie dzia?a mi removeEventHandler w gui clicku.Mo?e wy macie pomys?y jak to zrobi?.
Kod:

local marker1 = createMarker(378.57,-114.38,1001.49-1, "cylinder", 1.5, 35, 142, 35)
local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, }
setElementDimension(marker1, 5)
setElementInterior(marker1, 5)


function isMouseIn(psx,psy,pssx,pssy,abx,aby)
    if not isCursorShowing() then return end
    cx,cy=getCursorPosition()
    cx,cy=cx*sx,cy*sy
    if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
        return true,cx,cy
    else
        return false
    end
end
  
function draw()
        local screenW, screenH = guiGetScreenSize()
        dxDrawLine((screenW * 0.2328) - 1, (screenH * 0.2633) - 1, (screenW * 0.2328) - 1, screenH * 0.7367, tocolor(54, 254, 27, 222), 1, false)
        dxDrawLine(screenW * 0.7680, (screenH * 0.2633) - 1, (screenW * 0.2328) - 1, (screenH * 0.2633) - 1, tocolor(54, 254, 27, 222), 1, false)
        dxDrawLine((screenW * 0.2328) - 1, screenH * 0.7367, screenW * 0.7680, screenH * 0.7367, tocolor(54, 254, 27, 222), 1, false)
        dxDrawLine(screenW * 0.7680, screenH * 0.7367, screenW * 0.7680, (screenH * 0.2633) - 1, tocolor(54, 254, 27, 222), 1, false)
        dxDrawRectangle(screenW * 0.2328, screenH * 0.2633, screenW * 0.5352, screenH * 0.4733, tocolor(0, 0, 0, 222), false)
        dxDrawLine(screenW * 0.4039, screenH * 0.2633, screenW * 0.4039, screenH * 0.7400, tocolor(54, 254, 27, 222), 1, false)
        dxDrawText("Wymagania:", screenW * 0.2359, screenH * 0.2800, screenW * 0.4039, screenH * 0.3433, tocolor(255, 255, 255, 255), 1.20, "default", "center", "top", false, false, false, false, false)
        dxDrawText("-0SRP", screenW * 0.2344, screenH * 0.3433, screenW * 0.4039, screenH * 0.4050, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
        dxDrawText("-Du?o wolnego czasu", screenW * 0.2336, screenH * 0.4050, screenW * 0.4039, screenH * 0.4750, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
        dxDrawText("-Wytrzyma?o?ci", screenW * 0.2344, screenH * 0.4750, screenW * 0.4039, screenH * 0.5267, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
        dxDrawText("-Przede wszystkim ch?ci do pracy", screenW * 0.2328, screenH * 0.5267, screenW * 0.4016, screenH * 0.5767, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false)
        dxDrawImage(screenW * 0.4781, screenH * 0.2783, screenW * 0.2203, screenH * 0.2317, "cos.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
        dxDrawText("Praca kelnera", screenW * 0.4781, screenH * 0.5150, screenW * 0.6984, screenH * 0.5517, tocolor(255, 255, 255, 255), 1.20, "default", "center", "top", false, false, false, false, false)
        dxDrawText("Praca polegaj?ca na podanie zam?wie? dla klientow.Chyba w nic w tym trudnego nie ma.Ale je?li jeste? ci??ko my?l?cy cz?owiek to wypad", screenW * 0.4141, screenH * 0.5667, screenW * 0.7641, screenH * 0.6633, tocolor(255, 255, 255, 255), 1.00, "default", "center", "top", false, true, false, false, false)
        if not isMouseIn(screenW * 0.5125, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633) then dxDrawRectangle(screenW * 0.5125, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633, tocolor(54, 254, 27, 222), false)
        else dxDrawRectangle(screenW * 0.5125, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633, tocolor(50, 244, 17, 212), false) end
        dxDrawText("Rozpocznij", screenW * 0.5203, screenH * 0.6733, screenW * 0.6391, screenH * 0.7200, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
       if not isMouseIn(screenW * 0.2500, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633)then  dxDrawRectangle(screenW * 0.2500, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633, tocolor(54, 254, 27, 222), false) 
       else dxDrawRectangle(screenW * 0.2500, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633, tocolor(50, 244, 17, 212), false) end
       dxDrawText("Zakoncz", screenW * 0.1000, screenH * 0.6733, screenW * 0.5300, screenH * 0.7200, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false)
end
addEventHandler("onClientMarkerHit", marker1, function(hitPlayer)
    if (localPlayer == hitPlayer) then
        addEventHandler("onClientRender", root, draw)
    end
end)

addEventHandler ( "onClientMarkerLeave", marker1, function(leftPlayer)
if(localPlayer == leftPlayer) then
removeEventHandler("onClientRender", root, draw)
end
end)

addEventHandler("onClientClick", root, function(btn,state)
    local screenW, screenH = guiGetScreenSize()
    if btn=="left" and state=="down" then
        if isMouseIn(screenW * 0.5125, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633)  then
        outputChatBox("Rozpocze?e?/a? prac?, udaj si? do kasy po zam?wienie", 255,255,255)
end
end
end)

addEventHandler("onClientClick", root, function(btn,state)
    local screenW, screenH = guiGetScreenSize()
    if btn=="left" and state=="down" then
        if isMouseIn(screenW * 0.5125, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633)  then
        local marker2= createMarker(375.87,-118.80,1001.50-1, "cylinder", 1.5, 35, 142, 35)
        setElementDimension(marker2, 5)
        setElementInterior(marker2, 5)
        addEventHandler("onClientMarkerHit", marker2, function(hitPlayer)
        if (localPlayer == hitPlayer) then
        local taca = createObject (2216, 0,0,0)
        setElementDimension(taca, 5)
        setElementInterior(taca, 5)
        attachElements (taca,localPlayer, 0.2, 0.3, 0.4,-30,25, 80)
        setPedAnimation(localPlayer, "CARRY", "crry_prtial", 20)
        outputChatBox("We jeszcze raz bo kucharz rozwali? ?arcie, a i mo?esz te? odda? odrazu te 2 zam?wienie", 255,255,255)
          markery= {
        {369.40,-125.31,1001.49},
        {369.20,-128.73,1001.50},
        {369.20,-125.55,1001.49},
        {369.20,-122.48,1001.49},
        {378.13,-122.20,1001.49},
        {378.13,-125.47,1001.49},
        }
   addEventHandler("onClientMarkerHit", marker2, function(hitPlayer)
   if (localPlayer == hitPlayer) then
   rd = math.random(1, #markery)
  local markerss=createMarker(markery[rd][1],  markery[rd][2],  markery[rd][3],  "checkpoint", 1, 255, 0, 0, 200)
 setElementDimension(markerss, 5)
 setElementInterior(markerss, 5)
addEventHandler("onClientMarkerHit", markerss, function(hitPlayer)
if (localPlayer == hitPlayer) then
outputChatBox("Za dostarczenie zam?wienia otrzymujesz 30,000 PLN", 255,255,255)
 outputChatBox("Resztki zosta?y, oddaj spowrotem je a kucharz co? z nich zrobi", 255,255,255)
givePlayerMoney(30000)
destroyElement(markerss)
detachElements(taca)
end
end)
end
end)
end    
end)
end
end
end)
addEventHandler("onClientClick", root, function(btn,state)
    local screenW, screenH = guiGetScreenSize()
    if btn=="left" and state=="down" then
        if isMouseIn(screenW * 0.2500, screenH * 0.6633, screenW * 0.1344, screenH * 0.0633)  then
        removeEventHandler("onClientMarkerHit", markerss, function(hitPlayer)
        removeEventHandler("onClientMarkerHit", marker2, function(hitPlayer)
end)
end)
end)
end
end
end)
 




Podpis
Elo benc
Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-03, 23:38


MeeShuffle

Programista/Grafik






Wiek: 33
Na forum: 4536 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8578

Respekt: 535,3
Respekt: 535,3

Wstawiaj?c problem, wstaw tez bledy db3, nikt nie bedzie ci trzepal calego kodu.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-03, 23:46


Rumper

Majster od pysa






Wiek: 15
Na forum: 3457 dni
Posty: 231
Nick w MP: Rumper

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
Brak DB3

[ Dodano: 2020-08-04, 02:46 ]
Nevermind, sam naprawi?em ju?

Postaw piwo autorowi tego posta
 

 
Tagi: guiclick :: detachelements
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Guiclick,detachElements Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku