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

Wysłany: 2016-03-20, 20:04


sasik12







Wiek: 27
Na forum: 3904 dni
Posty: 182

Piwa: 7

Respekt: 60

Witam pomocy nie wiem czemu nie dzia?a . Wgra?em kawa?ek kodu od mlodyasnygo i markery mi znikly i opisu na aucie dalej niema.
c-side

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    if jobBlip and isElement(jobBlip) then
        destroyElement(jobBlip)
        jobBlip = nil
    end
end

function hideNextPoint(el, md)
    if el ~= localPlayer or not md then return end
    if not getPedOccupiedVehicle(el) then return end
    local pojazd = getPedOccupiedVehicle(el)
    if not getElementData(pojazd, "pojazd_smieci") then setElementData(pojazd, "pojazd_smieci", 100) 
    end
     
    if getElementData(pojazd, "pojazd_smieci") > 100 then
    outputChatBox("* Posiadasz 100% ropy, odwie? je.")
        return
    end
    
    local smieci = getElementData(pojazd, "pojazd_smieci") + math.random(10, 23)
    
    finishJob()
    showNextPoint()
    playSoundFrontEnd(12)
    setElementData(pojazd, "pojazd_smieci", smieci)
    setElementData(pojazd, "pojazd_opis", "Ropa: "..smieci.."%")
end


function showNextPoint()
    jobRandom = math.random(1, #positionTrash)

    jobMarker = createMarker(positionTrash[jobRandom][1], positionTrash[jobRandom][2], positionTrash[jobRandom][3], "checkpoint", 4, 0, 0, 255)
    jobBlip = createBlipAttachedTo(jobMarker, 41)
    
    addEventHandler("onClientMarkerHit", jobMarker, hideNextPoint)
end

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* Zak?czy?e? prace")
            setElementData(source, "pojazd_smieci", 0)
            setElementData(plr, "gracz_praca", false)
        end
    end
end)

addEventHandler("onClientMarkerHit", jobOdbieranie, function(el, md)
    if not md or getElementType(el) ~= "player" then return end
    if el ~= localPlayer then return end
    if not getPedOccupiedVehicle(el) then return end
    local pojazd = getPedOccupiedVehicle(el)
    if getElementData(pojazd, "pojazd_smieci") and tonumber(60) <= getElementData(pojazd, "pojazd_smieci") then
        smieci = getElementData(pojazd, "pojazd_smieci") * 0.5
        
        setElementData(pojazd, "pojazd_smieci", 0)
        triggerServerEvent("giveMoney", el, smieci, 1)
        setElementData(pojazd, "pojazd_opis", "Paliwo: 0%")
    else
        outputChatBox("* Nie posiadasz min. 80% ropy")
    end
end)

addEvent("STARTJobTrash", true)
addEventHandler("STARTJobTrash", resourceRoot, function()
    showNextPoint()
end)


addEventHandler("onClientRender", root, function()
    local rootx,rooty,rootz=getCameraMatrix()
    for i,vehicle in ipairs(getElementsByType("vehicle")) do
        local x,y,z=getElementPosition(vehicle)
        local sx,sy=getScreenFromWorldPosition(x,y,z)
        if sx and sy then
            local opis=getElementData(vehicle,"pojazd_opis") -- Element data na opis, ustaw swoj?, chyba ze masz system pojazd?w by pan prezes
            if opis then
                local distance=getDistanceBetweenPoints3D(rootx,rooty,rootz,x,y,z)
                if distance <= 40 then -- odleg?o?? widoczno?ci opisu
                    dxDrawText(opis, sx-(string.len(opis)/2), sy, sx+100, sy, tocolor(255, 255, 255, 255), 1, "default-bold", "center", "center", false, true, false , false)
                end
            end
        end
    end
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-20, 21:29


mlodasnygo







Wiek: 17
Na forum: 4114 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

Skoro znikn?ly Ci markery, to podaj stron? servera.
Je?li chodzi o opis, to masz system pojazd?w by pan prezes? Bo je?li nie masz to musisz dostosowa? wszystkie element daty pod sw?j system. :)
Pozdrawiam

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-21, 05:49


sasik12







Wiek: 27
Na forum: 3904 dni
Posty: 182

Piwa: 7

Respekt: 60

W stronie serwera mam tylko event na dawanie kasy . Mam system PanaPrezesa

Podpis
Uczeń LUA . Mapper MTA.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-22, 15:13


mlodasnygo







Wiek: 17
Na forum: 4114 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

To nie masz pe?nego kodu :)

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-03-22, 22:10


sasik12







Wiek: 27
Na forum: 3904 dni
Posty: 182

Piwa: 7

Respekt: 60

Przed dodaniem twojego kodu markery by?y tylko w?a?nie nieby?o opisu auta widac te Ropa 0%

Podpis
Uczeń LUA . Mapper MTA.
Postaw piwo autorowi tego posta
 

 
Tagi: praca :: nie :: działa
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Praca nie działa 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