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

Wysłany: 2015-04-29, 14:49


xDanioPLx

LuA






Wiek: 24
Na forum: 4416 dni
Posty: 24
Nick w MP: xDanioPLx

Piwa: 885

Respekt: 40

Ostrzeżeń: 100%
Witam mam prace dorywcz? i nie wiem dlaczego graczowi jak przejedzie przez marker nie daje pieni?dzy ?, Prosze o pomoc.

Server:

local m1 createMarker(-2197.47,292.96,35.12"cylinder"4.025500)
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(elmd)
    if getElementData(el"zrespilGracz"then
        outputChatBox("praca"el)
        return
    end
    
    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(elthen return end
    
    local x,y,getElementPosition(el)
    local bus createVehicle(408x,y,z,0.0360.0269.9)
    
    setElementData(bus"zrespilGracz"el)
    setElementData(bus"pojazd_paliwo"50)
    setElementData(bus"pojazd_przebieg"100)
    
    warpPedIntoVehicle(elbus)
    removePreviousVehicles(el)
    triggerClientEvent(el"STARTJobBus"resourceRootbus)

    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[sourcethen
          if isElement(vehs[source]) then destroyElement(vehs[source]) end
     end
end)


client:

local districtsBus = {
    {-2180.67,318.11,35.03},
    {-2143.91,334.44,35.09},
    {-2138.98,489.15,34.92},
    {-2048.26,501.01,34.92},
    {-2000.79,529.81,34.94},
    {-1960.24,602.40,34.95},
    {-1865.91,537.31,34.17},
    {-1851.24,433.07,16.93},
    {-1985.35,349.32,34.67},
    {-2078.84,321.09,35.02},  
    {-2196.21,310.65,35.32},
      
}
local blip createBlip(-2197.47,292.96,35.1252)
local jobTarget
local jobMarker
local jobVehicle
local maxTarget #districtsBus

function finishJob()
    if jobMarker and isElement(jobMarkerthen
        destroyElement(jobMarker)
        jobMarker nil
    end
    
    if jobTarget and isElement(jobTargetthen
        destroyElement(jobTarget)
        jobTarget nil
        jobTarget 0
        
    end
    
triggerServerEvent("destroyVeh"localPlayer)

end


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

function showMarker()
    if jobMarker and isElement(jobMarkerthen
        destroyElement(jobMarker)
        jobMarker nil
    end
    
    jobTarget jobTarget 1
    jobMarker createMarker(districtsBus[jobTarget][1], districtsBus[jobTarget][2], districtsBus[jobTarget][3], "checkpoint"400255)
    
    if districtsBus[jobTarget+1then
        ile districtsBus[jobTarget+1]
        setMarkerTarget(jobMarkerile[1], ile[2], ile[3])
    end
    
    addEventHandler("onClientMarkerHit"jobMarkerbusDriver)
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(plrseat)
    if seat == 0 then
        if plr == localPlayer then
            finishJob()
            outputChatBox("* Zako?czy?e? prac?")
        end
    end
end)


debugscript:
Kod:

ERROR: client (nick) tiggered serverside event givePlayerMoney, but event is not added serverside


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-02, 12:43


Piorun







Wiek: 32
Na forum: 6712 dni
Posty: 1837
Nick w MP: Piorun

Piwa: 516

Respekt: 480,7
Respekt: 480,7

Triggerujesz zdarzenie "givePlayerMoney" ze strony serwera natomiast skrypt nie znalaz? takiego zdarzenia po tej stronie.

Podpis
Możesz mnie znaleźć na: Facebook
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-02, 13:52


Iggy

#admin






Wiek: 26
Na forum: 4596 dni
Posty: 3469
Nick w MP: Iggy

Piwa: 1716

Respekt: 915
Respekt: 915Respekt: 915


   Administrator: Admin ma zawsze rację | REGULAMIN FORUM | REKLAMA/VIP | .

Temat został przeniesiony do prawidłowego działu.





Postaw piwo autorowi tego posta
 

 
Tagi: praca :: dorywcza-triggerserverevent
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