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

Wysłany: 2018-03-15, 21:32


Rumper

Majster od pysa






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

Piwa: 592

Respekt: 180
Respekt: 180Respekt: 180

Ostrzeżeń: 20%
Witam,bo mam taki problem z prac? ?e nie ma cel?w a i sie respi kilka aut zamiast jednego,jeszcze jak sie wysiada z auta to sie nie usuwa.
KOD:
S:
addEvent("createJobCar", true)
addEventHandler("createJobCar", root, function()
    job_car = createVehicle(482, -2534.052734375, -614.11260986328, 132.54760742188)
end)

addEvent("deleteJobCar", true)
addEventHandler("deleteJobCar", root, function()
    destroyElement(job_car)
end)


addEventHandler("onVehicleDamage", root, function()
    if source == job_car then
        if getElementHealth(source) <= 350 then
            local thePlayer = getVehicleController(source)
            triggerClientEvent (thePlayer, "damageCarClient", thePlayer)
            destroyElement(job_car)
            setElementPosition(thePlayer, -2520.8732910156, -621.10137939453, 132.72)
        end
    end
end)

C:
--PRACA DORYWCZA BY ADIKOO1302--
--Autorem skryptu jest Adikoo1302--
--Pomagali mi nanKy, NeQ.--
--Zakazuj? udost?pniania oraz zmiany autora--
--Zakazuj? edycji kodu do 5 linijki--

--SKALOWANIE GUI--
local screenW, screenH = guiGetScreenSize()
local w, h = (screenW/1280), (screenH/1024)
--------------------------------------------
local job_marker = createMarker(-2520.834960937, -623.51525878906, 131.75, "cylinder", 1, 252, 69, 45)
--------------------------------------------
local guion = false
job_activate = false
--------------------------------------------
local target_possition = {
    {-2106.9226074219, -757.84686279297, 31.75},
    {-2286.3168945313, -13.998096466064, 34.75},
    {-2098.3623046875, 855.49481201172, 68.75}
}    

function isMouseInPosition ( x, y, width, height )
    if ( not isCursorShowing( ) ) then
        return false
    end
    local sx, sy = guiGetScreenSize ( )
    local cx, cy = getCursorPosition ( )
    local cx, cy = ( cx * sx ), ( cy * sy )
    if ( cx >= x and cx <= x + width ) and ( cy >= y and cy <= y + height ) then
        return true
    else
        return false
    end
end

function job_gui()
    dxDrawImage(450*w, 300*h, 453*w, 420*h, "images/background.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(575*w, 630*h, 187*w, 58*h, "images/button.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
    dxDrawImage(880*w, 305*h, 16*w, 16*h, "images/exit.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
end

addEventHandler("onClientMarkerHit", job_marker, function()
    guion = true
    addEventHandler("onClientRender", root, job_gui)
    showCursor(true)
end)

addEventHandler("onClientClick", root, function(button, state)
    if state == 'down' then
        if guion == true then
            if isMouseInPosition(880*w, 305*h, 16*w, 16*h) then
                removeEventHandler("onClientRender", root, job_gui)
                showCursor(false)
                guion = false
            end
            if isMouseInPosition(575*w, 630*h, 187*w, 58*h) then
                if job_activate == false then    
                    removeEventHandler("onClientRender", root, job_gui)
                    showCursor(false)
                    guion = false
                    job_activate = true
                    local Possition = target_possition[math.random(#target_possition)]
                    job_blip = createBlip(Possition[1], Possition[2], Possition[3], 56)
                    job_marker_target = createMarker(Possition[1], Possition[2], Possition[3], "cylinder", 1, 252, 69, 45)
                    addEventHandler("onClientMarkerHit", job_marker_target, function()
                        local job_pay = math.random(500, 2500)
                        outputChatBox("Gratulacje ! Zako?czy?e? prac? pomy?lnie !")
                        outputChatBox("Twoje wynagrodzenie to "..job_pay.."$ !")
                        setElementPosition(localPlayer, -2520.8732910156, -621.10137939453, 132.72)
                        givePlayerMoney(job_pay)
                        job_activate = false
                        destroyElement(job_marker_target)
                        destroyElement(job_blip)
                        triggerServerEvent ("deleteJobCar", localPlayer)
                    end)
                    triggerServerEvent ("createJobCar", localPlayer)
                    outputChatBox("Pami?taj, ?e w punkt docelowy musisz wej?? postaci? !")
                else
                    outputChatBox("Ju? pracujesz !")
                end
            end
        end
    end
end)

addEvent("damageCarClient", true)
addEventHandler("damageCarClient", root, function()
    if job_activate == true then
        job_activate = false
        outputChatBox("Tw?j pojazd odni?s? zbyt wielkie uszkodzenia.")
        outputChatBox("Praca zako?czona niepowodzeniem !")
        destroyElement(job_blip)
        destroyElement(job_marker_target)
    end
end)

I jak by m?g? kto? ten kod poprawi? na to co powy?ej napisa?em.
Za pomoc daje :piwo:

Postaw piwo autorowi tego posta
 

 
Tagi: zbagowana :: praca
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