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

Wysłany: 2015-05-24, 13:25


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4386 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

Po stronie Servera
addEvent("obiektMagazynier", true)
addEventHandler("obiektMagazynier", root, function()
    local obiekt = createObject(3800,0,0,1)
    setElementData(source, "obiekt", obiekt)
    setElementData(source, "wlasnosc", getPlayerName(source))
    exports.bone_attach:attachElementToBone(obiekt, source, 1,0, 0.5, -0.5, 0, 0, 0)
    setPedAnimation(source, "CARRY", "crry_prtial", 1, true, true, false)
    setObjectScale(obiekt, 0.6)
end)

addEvent("delete_obiektMagazynier", true)
addEventHandler("delete_obiektMagazynier", root, function()
    if getElementData(source, "wlasnosc") == getPlayerName(source) then
        if getElementData(source, "obiekt") then
            local obiekt = getElementData(source, "obiekt")
            destroyElement(obiekt) 
            setPedAnimation(source, false)
        end
    end
end)

addEventHandler("onPlayerQuit", root, function()
    if getElementData(source, "wlasnosc") == getPlayerName(source) then
        if getElementData(source, "obiekt") then
            local obiekt = getElementData(source, "obiekt")
            destroyElement(obiekt)
        end
    end
end)
addEvent("givePlayerMoney",true)addEventHandler("givePlayerMoney", root, function(ile)givePlayerMoney(source, tonumber(ile))end)


Po stronie Clienta
local jobPoints = {
{-1267.96, 2734.17, 50.10},
{-1258.07, 2718.28, 50.10},
{-1268.22, 2730.54, 50.10},
{-1260.36, 2719.89, 50.10},
{-1262.46, 2715.74, 50.10},
{-1273.58, 2730.91, 50.10},
{-1268.06, 2712.52, 50.10},
{-1279.14, 2727.72, 50.10},
}

local x,y,z=-1282.31, 2705.07, 49.10 -- pozycja gdzie ma sta? marker

local jobMarker
local jobStartMarker=createMarker(x,y,z, "cylinder", 4, 0, 0, 255)
local jobStartBlip=createBlipAttachedTo(jobStartMarker, 52)

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

local function showMarker()
    rnd=math.random(1, #jobPoints)
    jobMarker=createMarker(jobPoints[rnd][1], jobPoints[rnd][2], jobPoints[rnd][3], "checkpoint", 1, 0, 0, 255)
    
    addEventHandler("onClientMarkerHit", jobMarker, function()
        if el~=localPlayer or not md then return end
        if not getPedOccupiedVehicle(el) then
            setElementFrozen(el, true)
            outputChatBox("* K?adziesz karton na regale.")
            setTimer(function()
                finishJob()
                playSoundFrontEnd(1)
                setElementFrozen(el, false)
                toggleControl("jump", true)
                toggleControl("sprint", true)
                toggleControl("enter_exit", true)
                setElementData(el, "player_job", false)
                triggerServerEvent("givePlayerMoney", el, 3, 0.4)
                triggerServerEvent("delete_obiektMagazynier", el)
            end, 5000, 1)
        end
    end)
end

bindKey("e", "down", function()
    if isElementWithinMarker(localPlayer, jobStartMarker) then
        if not getElementData(localPlayer, "player_job") then
            --[[if getPlayerName(localPlayer) ~= "Terr" then
                outputChatBox("* Praca w trakcie poprawek.")
                return
            end]]
            outputChatBox("* Odnie? karton na wybrane miejsce.", 0, 128, 0)
            triggerServerEvent("obiektMagazynier", localPlayer)
            setElementData(localPlayer, "player_job", true)
            toggleControl("enter_exit", false)
            toggleControl("sprint", false)
            toggleControl("jump", false)
            showMarker()
        else
            outputChatBox("* Ju? posiadasz aktywn? prac?.", 255, 0, 0)
        end
    end
end)


co zrobi? aby dostawa? pieni?dze oraz aby jak oddaje karton on znika? a nie zostawa? w r?kach prosz? o poprawienie kodu :(

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-24, 13:28


Loop

Inspektor






Wiek: 28
Na forum: 4430 dni
Posty: 311
Nick w MP: Inspektor

Piwa: 201

Respekt: 130
Respekt: 130

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-24, 13:32


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4386 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

addEvent("obiektMagazynier", true)
addEventHandler("obiektMagazynier", root, function()
    local obiekt = createObject(3800,0,0,1)
    setElementData(source, "obiekt", obiekt)
    setElementData(source, "wlasnosc", getPlayerName(source))
    exports.bone_attach:attachElementToBone(obiekt, source, 1,0, 0.5, -0.5, 0, 0, 0)
    setPedAnimation(source, "CARRY", "crry_prtial", 1, true, true, false)
    setObjectScale(obiekt, 0.6)
end)

addEvent("delete_obiektMagazynier", true)
addEventHandler("delete_obiektMagazynier", root, function()
    if getElementData(source, "wlasnosc") == getPlayerName(source) then
        if getElementData(source, "obiekt") then
            local obiekt = getElementData(source, "obiekt")
            destroyElement(obiekt) 
            setPedAnimation(source, false)
        end
    end
end)

addEventHandler("onPlayerQuit", root, function()
    if getElementData(source, "wlasnosc") == getPlayerName(source) then
        if getElementData(source, "obiekt") then
            local obiekt = getElementData(source, "obiekt")
            destroyElement(obiekt)
        end
    end
end)
addEvent("givePlayerMoney",true)
addEventHandler("givePlayerMoney", root,function(ile)
givePlayerMoney(source, tonumber(ile))
end)


Tak ??

Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-24, 13:34


Loop

Inspektor






Wiek: 28
Na forum: 4430 dni
Posty: 311
Nick w MP: Inspektor

Piwa: 201

Respekt: 130
Respekt: 130

Tak i teraz powinno dziala?.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-24, 13:36


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4386 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

addEvent("givePlayerMoney",true)
addEventHandler("givePlayerMoney", root,function(ile)
givePlayerMoney(source, tonumber(ile))
end)


A gdzie tu pisze ile si? zarabia za 1 karton ??


Podpis
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-24, 13:41


Loop

Inspektor






Wiek: 28
Na forum: 4430 dni
Posty: 311
Nick w MP: Inspektor

Piwa: 201

Respekt: 130
Respekt: 130

tu
 triggerServerEvent("givePlayerMoney", el, 3, 0.4)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-05-24, 13:49


OskarYT

Mapper MTA






Wiek: 26
Na forum: 4386 dni
Posty: 267
Nick w MP: Kaczorek2306

Piwa: 1230

Respekt: 85,3

No i jak odnosze ten karton to nie dostaje pieni?dzy ani nie bierze mi kartona o co chodzi pomocy :(



Podpis
Postaw piwo autorowi tego posta
 

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