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

Wysłany: 2016-08-31, 00:12


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

mam problem mam skrypt na autobusy i chia? zrobi? taki sam w innym miescie ale dawa?o za duzo kasy usuno?em ten drugi
i tera? daje mi 3 razy wieczej np zamiast 20 daje 60
dodam ze w innych pracach tam samo
mam

co mam zrobi?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-31, 00:16


awfesa







Wiek: 29
Na forum: 4846 dni
Posty: 563

Piwa: 223

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

"Aidis" napisał/a:



co mam zrobi?


Najlepiej to pokaza? kod

Podpis

Cokolwiek robicie w swoim życiu, nie będzie to legendarne,
jeżeli wasi przyjaciele nie będą mogli tego zobaczyć.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-31, 00:18


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

ale wszendzie daje 3 razy wieczej
kod
server
local blip = createBlip ( 1767.89,-1897.67, 24.88, 52 )

local m1 = createMarker(1767.89,-1902.67, 12.84, "cylinder", 4.0, 255, 0, 0)
vehs = {}


function removePreviousVehicles(plr)
    for i,v in ipairs(getElementsByType("vehicle", resourceRoot)) do
        local sby = getElementData(v, "zrespilGracz")
        if sby and sby == plr and getPedOccupiedVehicle(plr) ~= v then
            destroyElement(v)
        end
    end
end

addEventHandler("onMarkerHit", m1, function(el, md)
    if getElementData(el, "zrespilGracz") then
        outputChatBox("praca w trakcie poprawek", el)
        return
    end
    
    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(el) then return end
    
    local x,y,z = getElementPosition(el)
    local bus = createVehicle(437, 1785.8,-1886.5,13.3,0.0, 360.0, 269.9)
    
    setElementData(bus, "zrespilGracz", el)
    setElementData(bus, "vehicle:fuel", 100)
    setElementData(bus, "pojazd_przebieg", 100)

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

    vehs[el] = bus
end)

addEvent("STOPJobBus", true)
addEventHandler("STOPJobBus", resourceRoot, function()
    local pojazd = getPedOccupiedVehicle(localPlayer)
    if pojazd then
        destroyElement(pojazd)
    end
end)

addEvent("destroyVeh", true)
addEventHandler("destroyVeh", getRootElement(),
function()
     if vehs[source] then
          if isElement(vehs[source]) then destroyElement(vehs[source]) end
     end
end)

addEvent("givePlayerMoney", true) 
addEventHandler("givePlayerMoney", root, function(ile) 
givePlayerMoney (source,(ile))
outputChatBox("Otrzymales 20 PLN", source)
end)


clinet


local districtsBus = {
{ 1797.36,-1890.33,13.40},
{1814.41,-1889.07,13.41},
{1822.82,-1870.89,13.39},
{1823.17,-1619.58,13.82},
{1851.40,-1477.65,13.82},
{1905.44,-1466.38,13.82},
{2111.02,-1470.14,24.26},
{2111.45,-1666.39,14.55},
{2080.24,-1805.99,13.82},
{2079.34,-1928.40,13.74},
{1965.45,-1931.92,13.82},
{1960.06,-1994.64,13.83},
{1959.79,-2155.71,13.82},
{1909.05,-2165.42,13.82},
{1683.48,-2164.35,17.85},
{1532.18,-2022.28,29.19},
{1536.13,-1874.19,13.81},
{1638.42,-1874.69,13.38},
{1690.63,-1819.34,13.83},
{1676.91,-1730.81,13.82},
{1532.56,-1730.84,13.82},
{1430.29,-1725.17,13.82},
{1437.80,-1593.63,13.78},
{1553.58,-1594.12,13.81},
{1712.44,-1595.84,13.79},
{1819.93,-1620.27,13.83},
{1820.00,-1870.70,13.84},
{1804.37,-1926.48,13.83},
}

local jobTarget
local jobMarker
local jobVehicle
local maxTarget = #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    if jobTarget and isElement(jobTarget) then
        destroyElement(jobTarget)
        jobTarget = nil
        jobTarget = 0
        
    end
    
triggerServerEvent("destroyVeh", localPlayer)

end


function busDriver(el, md)
    if el ~= localPlayer or not md then return end
    if jobTarget > maxTarget and getPedOccupiedVehicle(el) then return end
    if jobTarget == maxTarget and not getPedOccupiedVehicle(el) then return end
    
    if jobTarget == #districtsBus then
        finishJob()
        playSoundFrontEnd(5)
        outputChatBox("* Zako?czy?e?/a? prac?.")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 20, 0)
    end
end

function showMarker()
    if jobMarker and isElement(jobMarker) then
        destroyElement(jobMarker)
        jobMarker = nil
    end
    
    jobTarget = jobTarget + 1
    jobMarker = createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint", 4, 0, 0, 255)
    
    if districtsBus[jobTarget+1] then
        ile = districtsBus[jobTarget+1]
        setMarkerTarget(jobMarker, ile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit", jobMarker, busDriver)
end

addEvent("STARTJobBus", true)
addEventHandler("STARTJobBus", resourceRoot, function(veh)
    outputChatBox("* Rozpocz??e?/a? prac?.")
    jobVehicle = veh
    jobTarget = 0
    showMarker()
end)

addEventHandler("onClientResourceStop", resourceRoot, function()
    if jobVehicle and getElementData(localPlayer, "gracz_praca") then
        setElementData(localPlayer, "gracz_praca", false)
    end
end)

addEventHandler("onClientVehicleExit", resourceRoot, function(plr, seat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* Zako?czy?e? prac?")
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-31, 01:13


Emm

***** ***






Wiek: 32
Na forum: 4021 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6171

Respekt: 1580
Respekt: 1580Respekt: 1580


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .
Bo pewnie w ka?dej pracy, po stronie servera masz dodany event
addEvent("givePlayerMoney", true) 
addEventHandler("givePlayerMoney", root, function(ile) 
givePlayerMoney (source,(ile))
outputChatBox("Otrzymales 20 PLN", source)
end)

i dlatego wykonuje on si? potr?jnie, bo nazywa si? w ka?dej pracy tak samo.

Podpis

Użytkownik: 20.10.2015r
GTAO Member: 06.03.2016r
Support-Team: 20.01.2016r
Moderator: 30.03.2016r
Mod-Team: 08.10.2016r
Vice Admin: 04.05.2018r
Administrator: 03.05.2022r


! Koniecznie zapoznaj się z regulaminem forum.
Pamiętaj, aby zawsze go przestrzegać, nie mniej ważne są również regulaminy działów, w których się wypowiadasz!
Zamiast zakładać temat po kilka razy, bo jest usuwany przez Administrację, przejrzyj regulamin i napisz poprawnie temat!
Sprawy z administracją możesz załatwiać anonimowo w tym dziale.
Najważniejsze informacje od Administracji możesz przeczytać tutaj oraz tutaj.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-31, 20:46


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

czyli co mam zmieni?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-31, 21:08


awfesa







Wiek: 29
Na forum: 4846 dni
Posty: 563

Piwa: 223

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

np. Zmieni? nazw? z givePlayerMoney na givePlayerBusMoney

Pami?taj ?e musisz zmieni? nazw? po stronie serwera jak i klienta

Podpis

Cokolwiek robicie w swoim życiu, nie będzie to legendarne,
jeżeli wasi przyjaciele nie będą mogli tego zobaczyć.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-08-31, 21:48


P.Wiśnia

Programista LUA






Wiek: 25
Na forum: 4185 dni
Posty: 568
Nick w MP: P.Wiśnia

Piwa: 378

Respekt: 100
Respekt: 100

ale eventa?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-09-01, 01:07


awfesa







Wiek: 29
Na forum: 4846 dni
Posty: 563

Piwa: 223

Respekt: 280
Respekt: 280Respekt: 280Respekt: 280

tak

Podpis

Cokolwiek robicie w swoim życiu, nie będzie to legendarne,
jeżeli wasi przyjaciele nie będą mogli tego zobaczyć.
Postaw piwo autorowi tego posta
 

 
Tagi: daje :: duzo :: pln
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