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: 3316 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.53514235)
local sx,sy=guiGetScreenSize()
local data={ showed=nilbutton={}, info=nilmisc=nil, }
setElementDimension(marker15)
setElementInterior(marker15)


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 screenWscreenH guiGetScreenSize()
        dxDrawLine((screenW 0.2328) - 1, (screenH 0.2633) - 1, (screenW 0.2328) - 1screenH 0.7367tocolor(5425427222), 1false)
        dxDrawLine(screenW 0.7680, (screenH 0.2633) - 1, (screenW 0.2328) - 1, (screenH 0.2633) - 1tocolor(5425427222), 1false)
        dxDrawLine((screenW 0.2328) - 1screenH 0.7367screenW 0.7680screenH 0.7367tocolor(5425427222), 1false)
        dxDrawLine(screenW 0.7680screenH 0.7367screenW 0.7680, (screenH 0.2633) - 1tocolor(5425427222), 1false)
        dxDrawRectangle(screenW 0.2328screenH 0.2633screenW 0.5352screenH 0.4733tocolor(000222), false)
        dxDrawLine(screenW 0.4039screenH 0.2633screenW 0.4039screenH 0.7400tocolor(5425427222), 1false)
        dxDrawText("Wymagania:"screenW 0.2359screenH 0.2800screenW 0.4039screenH 0.3433tocolor(255255255255), 1.20"default""center""top"falsefalsefalsefalsefalse)
        dxDrawText("-0SRP"screenW 0.2344screenH 0.3433screenW 0.4039screenH 0.4050tocolor(255255255255), 1.00"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("-Du?o wolnego czasu"screenW 0.2336screenH 0.4050screenW 0.4039screenH 0.4750tocolor(255255255255), 1.00"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("-Wytrzyma?o?ci"screenW 0.2344screenH 0.4750screenW 0.4039screenH 0.5267tocolor(255255255255), 1.00"default""left""top"falsefalsefalsefalsefalse)
        dxDrawText("-Przede wszystkim ch?ci do pracy"screenW 0.2328screenH 0.5267screenW 0.4016screenH 0.5767tocolor(255255255255), 1.00"default""left""top"falsefalsefalsefalsefalse)
        dxDrawImage(screenW 0.4781screenH 0.2783screenW 0.2203screenH 0.2317"cos.png"000tocolor(255255255255), false)
        dxDrawText("Praca kelnera"screenW 0.4781screenH 0.5150screenW 0.6984screenH 0.5517tocolor(255255255255), 1.20"default""center""top"falsefalsefalsefalsefalse)
        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.4141screenH 0.5667screenW 0.7641screenH 0.6633tocolor(255255255255), 1.00"default""center""top"falsetruefalsefalsefalse)
        if not isMouseIn(screenW 0.5125screenH 0.6633screenW 0.1344screenH 0.0633then dxDrawRectangle(screenW 0.5125screenH 0.6633screenW 0.1344screenH 0.0633tocolor(5425427222), false)
        else dxDrawRectangle(screenW 0.5125screenH 0.6633screenW 0.1344screenH 0.0633tocolor(5024417212), falseend
        dxDrawText("Rozpocznij"screenW 0.5203screenH 0.6733screenW 0.6391screenH 0.7200tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)
       if not isMouseIn(screenW 0.2500screenH 0.6633screenW 0.1344screenH 0.0633)then  dxDrawRectangle(screenW 0.2500screenH 0.6633screenW 0.1344screenH 0.0633tocolor(5425427222), false) 
       else dxDrawRectangle(screenW 0.2500screenH 0.6633screenW 0.1344screenH 0.0633tocolor(5024417212), falseend
       dxDrawText("Zakoncz"screenW 0.1000screenH 0.6733screenW 0.5300screenH 0.7200tocolor(255255255255), 1.00"default""center""center"falsefalsefalsefalsefalse)
end
addEventHandler("onClientMarkerHit"marker1, function(hitPlayer)
    if (localPlayer == hitPlayerthen
        addEventHandler("onClientRender"rootdraw)
    end
end)

addEventHandler "onClientMarkerLeave"marker1, function(leftPlayer)
if(localPlayer == leftPlayerthen
removeEventHandler("onClientRender"rootdraw)
end
end)

addEventHandler("onClientClick"root, function(btn,state)
    local screenWscreenH guiGetScreenSize()
    if btn=="left" and state=="down" then
        if isMouseIn(screenW 0.5125screenH 0.6633screenW 0.1344screenH 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 screenWscreenH guiGetScreenSize()
    if btn=="left" and state=="down" then
        if isMouseIn(screenW 0.5125screenH 0.6633screenW 0.1344screenH 0.0633)  then
        local marker2createMarker(375.87,-118.80,1001.50-1"cylinder"1.53514235)
        setElementDimension(marker25)
        setElementInterior(marker25)
        addEventHandler("onClientMarkerHit"marker2, function(hitPlayer)
        if (localPlayer == hitPlayerthen
        local taca createObject (22160,0,0)
        setElementDimension(taca5)
        setElementInterior(taca5)
        attachElements (taca,localPlayer0.20.30.4,-30,2580)
        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 == hitPlayerthen
   rd math.random(1#markery)
  local markerss=createMarker(markery[rd][1],  markery[rd][2],  markery[rd][3],  "checkpoint"125500200)
 setElementDimension(markerss5)
 setElementInterior(markerss5)
addEventHandler("onClientMarkerHit"markerss, function(hitPlayer)
if (localPlayer == hitPlayerthen
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 screenWscreenH guiGetScreenSize()
    if btn=="left" and state=="down" then
        if isMouseIn(screenW 0.2500screenH 0.6633screenW 0.1344screenH 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: 32
Na forum: 4395 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

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: 3316 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 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