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

Wysłany: 2015-09-01, 15:29


mlodasnygo







Wiek: 16
Na forum: 3972 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

:piwo: Witam, mam problem ze skryptem. Mianowicie chodzi o to, ?e nie dostaj? kasy za wjazd do markera.
W pracy chodzi o to, ?e je?d?? autobusem do marker?w i od ka?dego markera powinienem dostawa? hajs. Jednak tak si? nie dzieje. Pomo?e kto??
Oto kody:

-server

local m1 createMarker2122.25,2517.02,9.52"cylinder"2.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 w trakcie poprawek."el)
        return
    end
    
    if not md or getElementType(el) ~= "player" or getPedOccupiedVehicle(elthen return end
    
    local x,y,getElementPosition(el)
    local Coach createVehicle(4372143.47,2489.64,10.97,0.0,360.0,91.2)
    
    setElementData(Coach"zrespilGracz"el)
    setElementData(Coach"pojazd_paliwo"50)
    setElementData(Coach"pojazd_przebieg"1000)
    setElementData(Coach"pojazd_opis""Las Venturas - Las Venturas")
    
    warpPedIntoVehicle(el,Coach)
    removePreviousVehicles(el)
    triggerClientEvent(el"STARTJobBus"resourceRoot,Mower)

    vehs[el] = Coach
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 = {
 {2104.06567382812462.996826171910.875314712524},
 {2027.71594238282456.019042968810.886425018311},
 {2024.29577636722423.017822265610.707508087158},
 {2036.46557617192341.09179687510.481694221497},
 {2093.51611328132292.746582031310.74070930481},
 {2124.30297851562215.865478515610.681149482727},
 {2124.86450195312151.068847656310.718878746033},
 {2125.12133789062076.915771484410.728075027466},
 {2102.14477539062024.97070312510.665912628174},
 {2039.7441406252024.480102539110.718510627747},
 {1970.58728027342024.174072265610.723452568054},
 {1909.79614257812042.843383789110.694621086121},
 {1845.26879882812054.949707031310.77517414093},
 {1728.89111328132055.334960937510.754793167114},
 {1703.76330566411999.950439453110.679386138916},
 {1701.06604003911878.079345703110.477933883667},
 {1598.14025878911875.887695312510.718776702881},
 {1504.19091796881875.615844726610.721231460571},
 {1401.29345703131875.345947265610.727345466614},
 {1323.90832519531851.507324218810.752853393555},
 {1324.47680664061831.613647460910.747181892395},
 {1292.77270507811814.8476562510.983985900879},
 {1241.95446777341814.544067382813.178141593933},
 {1180.18652343751814.426879882812.311668395996},
 {1111.89941406251814.655151367210.66382598877},
 {1013.16064453131815.032470703110.881086349487},
 {1010.11242675781874.029174804710.717266082764},
 {1009.79693603521954.404785156311.167233467102},
 {1009.82745361332054.245361328110.939829826355},
 {1009.90502929692164.780273437510.727342605591},
 {1010.00317382812291.382568359411.109961509705},
 {936.19433593752296.025634765610.756624221802},
 {904.358215332032232.836181640610.713639259338},
 {969.160034179692189.606445312510.719605445862},
 {1005.86853027342156.561523437510.706065177917},
 {1005.82452392582088.825683593810.727023124695},
 {1077.94836425782050.511474609410.719020843506},
 {1131.27307128912050.640136718810.696502685547},
 {1158.76257324222051.062988281310.738959312439},
 {1200.57409667972051.247314453113.632722854614},
 {1250.81286621092051.434814453112.577436447144},
 {1315.26159667972051.525146484410.671305656433},
 {1379.82385253912051.562255859410.741990089417},
 {1452.33459472662051.307617187510.721267700195},
 {1550.22680664062050.908691406310.765179634094},
 {1565.37817382812027.434936523410.751915931702},
 {1594.56591796882010.880004882810.655198097229},
 {1643.8105468752011.244262695310.722421646118},
 {1709.13903808592011.363891601610.897157669067},
 {1709.89770507812071.047363281310.714967727661},
 {1720.24267578132170.981933593810.732128143311},
 {1795.65942382812170.163085937510.741243362427},
 {1928.01672363282170.1992187510.909242630005},
 {1930.64660644532269.89257812510.765098571777},
 {1940.58044433592278.825195312510.544052124023},
 {1985.35705566412279.243896484410.707793235779},
 {2045.42248535162280.122558593810.719228744507},
 {2109.08154296882281.062988281310.767027854919},
 {2083.52978515632308.805175781310.7126121521},
 {2046.35070800782339.087646484410.517477035522},
 {2028.67333984382422.64648437510.69776058197},
 {2051.91162109382450.600341796910.755352020264},
 {2064.58544921882461.70898437510.814205169678},
 {2151.25122070312476.176025390610.903965950012},

    
    }

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"localPlayer2.505000)
    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)


Za pomoc stawiam :piwo: :)

Pozdrawiam,
mlodygo

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-01, 16:01


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Zrob nowy folder o dowolnej nazwie, zrob mete i plik po stronie servera, po czym wypelnij go tym kodem:

addEvent("takePlayerMoney"true)
addEventHandler("takePlayerMoney"root, function(money)
    if not tonumber(moneythen return end
    takePlayerMoney(sourcetonumber(money))
end)

addEvent("givePlayerMoney"true)
addEventHandler("givePlayerMoney"root, function(moneygp)
    if not tonumber(money) or not tonumber(gpthen return end
    local sctera getElementData(source"GP") or 0

    givePlayerMoney(sourcemoney)
    
    setElementData(source"GP"tonumber(sctera) + tonumber(gp))

    exports.notification:showBox(source"info","* Na twoje konto zostalo dodane: (+ "..money.." z?‚ i "..gp.." GP)")
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-01, 16:02


Kurczak23







Wiek: 32
Na forum: 5032 dni
Posty: 30

Piwa: 499

Respekt: 115,3
Respekt: 115,3

addEvent("givePlayerMoney"true)
addEventHandler("givePlayerMoney"root, function(hajsy)
    if not tonumber(hajsythen return end
    givePlayerMoney(client,hajsy)
end)
dodaj sobie po stronie serwera.
Gratulacje @up je?eli wy?le triggera za pomoca resource to ma dawa? setElementData oraz pieniadze dla skryptu. My?l cz?owieku co ty mu dajesz. Nie wiem sk?d tacy ludzie si? bior?. Jak chcesz pom?c to nast?pnym razem sobie przeanalizuj co za shit wstawiasz.
@down no i co opcja edytuj boli? sam sobie nabijasz posty wstawiaj?c jaki? shit

-------- Masz doda? poprostu po stronie serwera do dowolnego skryptu

Ostatnio zmieniony przez Kurczak23 2015-09-01, 16:14, w całości zmieniany 4 razy  
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-01, 16:05


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

Kurczak23, nie wiem po co wbijasz posty, jezeli juz mu pomoglem...


Mlodasnygo, jezeli nie masz skryptu notifications to daj tak:


addEvent("takePlayerMoney"true)
addEventHandler("takePlayerMoney"root, function(money)
    if not tonumber(moneythen return end
    takePlayerMoney(sourcetonumber(money))
end)

addEvent("givePlayerMoney"true)
addEventHandler("givePlayerMoney"root, function(moneygp)
    if not tonumber(money) or not tonumber(gpthen return end
    local sctera getElementData(source"GP") or 0

    givePlayerMoney(sourcemoney)
    
    setElementData(source"GP"tonumber(sctera) + tonumber(gp))

    outputChatBox("Na twoje konto zostalo dodane: (+ "..money.." z?‚ i "..gp.." GP)")
end)




@UP wgraj sobie jego skrypt i dodaj moj plik i zobaczymy kto ma racje :)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-01, 16:08


mlodasnygo







Wiek: 16
Na forum: 3972 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

Ale po uj mi to jak ja GP nie mam?

Ps GP to GamePoints co nie? :DDD

[ Dodano: 2015-09-01, 16:10 ]
Kurczak23, zobacz?, ale mam co? w tym zmienia? czy poprostu doda??

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-01, 16:11


Fanciak

BOT






Wiek: 25
Na forum: 4446 dni
Posty: 728
Nick w MP: Fanciak

Piwa: 1572

Respekt: 500
Respekt: 500

mlodasnygo, tak.


Daj tak:


addEvent("takePlayerMoney"true)
addEventHandler("takePlayerMoney"root, function(money)
    if not tonumber(moneythen return end
    takePlayerMoney(sourcetonumber(money))
end)

addEvent("givePlayerMoney"true)
addEventHandler("givePlayerMoney"root, function(moneygp)
    if not tonumber(money)  then return end


    givePlayerMoney(sourcemoney)
    


    outputChatBox("Na twoje konto zostalo dodane: (+ "..money.." z?&#8218)")
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2015-09-01, 16:18


mlodasnygo







Wiek: 16
Na forum: 3972 dni
Posty: 205

Piwa: 518

Respekt: 161,8
Respekt: 161,8Respekt: 161,8

Dobra dzia?a, wielkie dzi?ki Kurczak23 leci piwko i repka :)

Podpis
600 dni - 10 marca 2017
:piwo: 500 piw :piwo: - 10 marca 2017
Postaw piwo autorowi tego posta
 

 
Tagi: nie :: dostaję :: hajsu...
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