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

Wysłany: 2017-07-26, 17:06


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4044 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

Mam problem poniewa? po kliknienciu rozpocznij prace nic sie nie dziej

Client

addEventHandler("onClientGUIClick"root, function(btn,state)
    if source == PracaBusLs.submit then
        showCursor(false)
    guiSetVisible(PracaBusLs.windowfalse)
    guiSetVisible(PracaBusLs.submitfalse)
    guiSetVisible(PracaBusLs.closefalse)
    guiSetVisible(PracaBusLs.textfalse)
          removeEventHandler("onClientRender",root,pracabusls)
    triggerServerEvent("PracaStartBusLs"root,localPlayer)
    end
    if source == PracaBusLs.close then
        if guiGetVisible(PracaBusLs.window) == true then
            showCursor(false)
        guiSetVisible(PracaBusLs.windowfalse)
        guiSetVisible(PracaBusLs.submitfalse)
        guiSetVisible(PracaBusLs.closefalse)
        guiSetVisible(PracaBusLs.textfalse)
              removeEventHandler("onClientRender",root,pracabusls)
        end
    end
end)


Server

addEvent("PracaStartBusLs"true)
addEventHandler("PracaStartBusLs"resourceRoot, function(elmd)
    if #getElementsWithinColShape(zone,"vehicle") >= 1 then outputChatBox("Parking zajety",el) return end
    if getElementData(el,"player:license:pjC") ~= 1 then
        outputChatBox("Nie posiadasz Prawojazdy kategori C"source)
    return
    end
    
    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(elthen return end
    
    local x,y,getElementPosition(el)
    local bus createVehicle(4371785.93,-1886.36,13.65,0.0360.0269.9)
    
    setElementData(bus"zrespilGracz"el)
    setElementData(bus"vehicle:fuel"100)
    setElementData(bus"vehicle:mileage"math.random(50000,80000))

    setVehicleHandling(bus,"maxVelocity"50.00)
    
    warpPedIntoVehicle(elbus)
    removePreviousVehicles(el)
    triggerClientEvent(el"STARTJobBus"resourceRootbus)
    setVehicleHandling(bus,"maxVelocity"50.00)

    vehs[el] = bus
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-26, 17:09


Szymczu

Programista bo tak






Wiek: 27
Na forum: 3434 dni
Posty: 194
Nick w MP: Szymczu

Piwa: 36

Respekt: 120
Respekt: 120

db3? Poka? te tablice "PracaBusLs".

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-26, 18:40


P.Wiśnia

Programista LUA






Wiek: 24
Na forum: 4044 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 376

Respekt: 100
Respekt: 100

ale jak usune
addEventHandler("PracaStartBusLs", resourceRoot, function(el, md)

te el, md
to mam ze nie mam prawka a mam.
a jak dodam to
nic nie robi.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-27, 15:25


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

Nie wiem czy w lua jest przeci??enie funkcji - mog? by? te same funkcje (tak samo nazwane) ale
r??ni?ce si? ilo?ci? argument?w i tyle ile podamy to odpowiednia funkcja si? wykona. Ale co to ma do rzeczy? W triggerze PracaStartBusLs podajesz "root" czyli source tego eventu oraz localPlayer. Za to w stronie serwera dodatkowo dodajesz argument "md" przez co mo?liwe kod si? nie wykonywa.

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-27, 23:11


Malentas

Koder mirofali w lua






Wiek: 24
Na forum: 3681 dni
Posty: 146
Nick w MP: Malentas

Piwa: 1626

Respekt: 47,3

Okej, koledzy wy?ej standardowo nabijaj? posty a i tak ci nie pomog?, masz funkcje onClientClick masz ify i my?lisz ?e b?dzie dzia?a?? Mo?e by tak uj?? gdzie trzeba klikn??? Zacznijmy od tego czy posiadasz "klawisze" z dxDraw czy jednak guiButton.
jak posiadasz guiButton czyli funkcje "guiCreateButton" to robisz


addEventHandler("onClientClick"nazwabuttona, function()
--Tu funkcja po nacisnieciu naszegobuttona
end)


Je?li masz "klawisz" w dxDrawRectangle to

-- to funckja na myszke nic tu nie ruszasz
local sxsy guiGetScreenSize()

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

-- poniez juruszasz 
addEventHandler("onClientClick"root, function(btnstate)
if btn == "left" and state == "down" then
if isMouseIn(twoje koordynaty screenWscreenH klawiszu) and okno == true then
--funkcja po nacisnieciu
end
end
end)



Okej teraz tez nie b?dzie dzialac, dlaczego? bo nie masz wysetowanego "okna" czyli to "okno"

Podczas gdy wejdziesz w marker i ci si? otwiera gui musisz wpisac "okno = true"
a gdy okno zostaje zamykane "okno = false"

?atwe? ?atwe tylko trzeba chcie? :)

Podpis
Aktualny projekt:


AntoriaMTA
Discord: https://discord.gg/TVrAddp3Wu

Najszybszy kontakt (discord): Malentas#2091
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-27, 23:29


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

Malentas, Co ty tworzysz? wida? ?e ma event "OnClientGUIClick" czyli jest normalny button z cgui... Tutaj "pomoc" to nie wklejenie gotowego kodu (poprawki w kodzie autora postu), a wyja?nienie gdzie jest b??d, wi?c je?eli przeci??anie funkcje w lua jest mo?liwe to prawdopodobnie to jest b??d.

Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-28, 01:15


Hades.

Łiiiiiiiiii






Wiek: 22
Na forum: 4699 dni
Posty: 372
Nick w MP: Hades

Piwa: 3214

Respekt: 337,8
Respekt: 337,8Respekt: 337,8Respekt: 337,8

addEventHandler("onClientGUIClick"root, function(buttonstate)
if menuBusy button == "left" and state == "down" then
    if source == PracaBusLs.submit then
        showCursor(false)
    guiSetVisible(PracaBusLs.windowfalse)
    guiSetVisible(PracaBusLs.submitfalse)
    guiSetVisible(PracaBusLs.closefalse)
    guiSetVisible(PracaBusLs.textfalse)
          removeEventHandler("onClientRender",root,pracabusls)
    triggerServerEvent("PracaStartBusLs"root,localPlayer)
    end
    if source == PracaBusLs.close then
        if guiGetVisible(PracaBusLs.window) == true then
            showCursor(false)
        guiSetVisible(PracaBusLs.windowfalse)
        guiSetVisible(PracaBusLs.submitfalse)
        guiSetVisible(PracaBusLs.closefalse)
        guiSetVisible(PracaBusLs.textfalse)
              removeEventHandler("onClientRender",root,pracabusls)
        end
      end
    end
end)
Prosz..

Podpis
Skrypty/Grafiki na zamówienie!
Kontakt: Discord R35#5507

Discord związany z pomocą: https://discord.gg/ttkQTsc
Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-07-28, 11:05


amited







Wiek: 26
Na forum: 3714 dni
Posty: 1233
Nick w MP: Amited

Piwa: 512

Respekt: 466
Respekt: 466

dla mnie powinno by?:

addEventHandler("onClientGUIClick"resourceRoot, function(btn,state)
    if source == PracaBusLs.submit then
        showCursor(false)
    guiSetVisible(PracaBusLs.windowfalse)
    guiSetVisible(PracaBusLs.submitfalse)
    guiSetVisible(PracaBusLs.closefalse)
    guiSetVisible(PracaBusLs.textfalse)
          removeEventHandler("onClientRender",root,pracabusls)
    triggerServerEvent("PracaStartBusLs"root,localPlayer)
    end
    if source == PracaBusLs.close then
        if guiGetVisible(PracaBusLs.window) == true then
            showCursor(false)
        guiSetVisible(PracaBusLs.windowfalse)
        guiSetVisible(PracaBusLs.submitfalse)
        guiSetVisible(PracaBusLs.closefalse)
        guiSetVisible(PracaBusLs.textfalse)
              removeEventHandler("onClientRender",root,pracabusls)
        end
    end
end)


Podpis
"amited" napisał/a:
Postaw piwo autorowi tego posta
 

 
Tagi: nic :: nie :: robi :: kliknięciu
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Odpowiedz do tematu

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