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

Wysłany: 2019-02-21, 12:00


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Witam ot?? mam prace zwi?zan? z paliwem, i gdy oddaje zape?niony pojazd nie daje pieni?dzy. KOD

pojazdy.lua
local positionVehicles = {
    {283.18,1398.05,11.10,0.0,360.0,93.2},
    {283.18,1392.86,11.17,0.3,359.4,92.5},
    {283.18,1387.11,11.23,0.0,360.0,92.4},
    {283.18,1375.06,11.23,0.2,359.7,92.9},
    {283.18,1370.69,11.27,3.0,0.2,93.1},
    {283.18,1364.50,11.24,0.2,359.9,89.4},
    {283.18,1358.91,11.14,0.0,360.0,89.7},
    {283.18,1381.49,11.24,0.0,0.0,91.5},
}

for i,v in ipairs(positionVehicles) do
    local pojazd = createVehicle(573, v[1], v[2], v[3], v[4], v[5], v[6])
    setElementData(pojazd, "pojazd_opis", "Praca dorywcza\nRopa")
    setElementData(pojazd, "pojazd_paliwo", 50)
    setElementFrozen(pojazd, true)
end

addEventHandler("onVehicleEnter", resourceRoot, function(plr, seat)
    if seat == 0 then
        setElementFrozen(source, false)
        setElementData(plr, "gracz_praca", true)
        outputChatBox("* Rozpocz??e?/a? prac?.", plr)
        triggerClientEvent(plr, "STARTJobTrash", resourceRoot)
        setElementData(source, "pojazd_opis", "Ropa: 0%")
    end
end)

function respawnVehicles()
    for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
        if not getVehicleOccupant(v) then
            respawnVehicle(v)
            setElementFrozen(v, true)
            setElementData(v, "pojazd_opis", "Praca dorywcza\nRopa")
        end
    end
end
setTimer(respawnVehicles, 60000, 0)


praca.lua
createBlip(252.35,1396.23,10.59-0.8,52, 2, 255,0,0,255,0,400)

local jobMarker
local jobVehicle
local jobOdbieranie = createMarker(252.35,1396.23,10.59-0.8, "cylinder", 6, 0, 0, 255)


local positionTrash = {
    {613.74,1687.55,7.92},
    {-1328.99,2682.39,50.98},
    {-1473.05,1862.97,33.56},
    {2116.06,920.37,11.76},
    {1380.75,455.35,20.84},
    {-1033.89,-625.48,32.93},
    {-2311.95,-128.00,36.24},
    {-2023.37,160.61,29.76},

}

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("givePlayerMoney", 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)


B??dy z DB3


Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-21, 22:24


amited







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

Piwa: 512

Respekt: 466
Respekt: 466

nie masz dodanego eventu ktory daje kase nie pamietam czy mozna eventy exportowac w mecie ale jak nie to sobie dodaj taki event w server sdie

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

 
Wysłany: 2019-02-22, 00:01


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Doda?by? bo zielony w to jestem b?agam.

Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-22, 09:34


BlueCry

ŚĆRIPTER LUJA






Wiek: 25
Na forum: 4147 dni
Posty: 78
Nick w MP: BlueCry

Piwa: 2178

Respekt: 110
Respekt: 110

Masz tutaj kod, dodaj go do strony serwera:
addEvent("givePlayerMoney", true)
addEventHandler("givePlayerMoney", root, function(value)
    if not tonumber(value) then return end
    givePlayerMoney(source,value)
end)


Postaw piwo autorowi tego posta
 

 
Więcej szczegółów
Wystawiono 1 piw(a):
Pyrek24
Wysłany: 2019-02-22, 10:15


Pyrek24







Wiek: 26
Na forum: 3579 dni
Posty: 546
Nick w MP: Pyrek

Piwa: 10

Respekt: 50

Dzieki ! Dzia?a !

Podpis
amta
Postaw piwo autorowi tego posta
 

 
Wysłany: 2019-02-22, 17:52


Adis.exe

LUA Developer






Wiek: 24
Na forum: 3639 dni
Posty: 292
Nick w MP: Adiś.exe

Piwa: 996

Respekt: 110,3
Respekt: 110,3

[clo]

Podpis

KONTAKT:
GG: 60968224
Discord: Adiś.exe#3828

Użytkownik: 05.11.2016
GTAO Member: 20.02.2019
Support-Team: 25.07.2018
Support-Team: 19.01.2019
Test Mod: 08.02.2019

Postaw piwo autorowi tego posta
 

 
Tagi: serverside :: nie :: daje :: pieniędzy :: prace
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