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

Wysłany: 2016-12-13, 22:17


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

Witam
Zastanawiam si? jak zrobi? ?eby pieni?dze z prac by?y wysy?ane na konto bankowe.


Bankomaty:
S:
addEvent("onPlayerRequestATMInfo", true)
addEventHandler("onPlayerRequestATMInfo", resourceRoot, function()
    local dbid=getElementData(client,"player:uid")
    if not dbid then
        triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
        return
    end
    local sr=exports["ogrpg-db"]:dbGet("SELECT bank_money FROM ogrpg_users WHERE id=? LIMIT 1",dbid)
    if not sr or #sr < 1 then
        triggerClientEvent(client,"doFillATMInfo", resourceRoot, false)
        return
    end
    local sr=sr[1]
    triggerClientEvent(client,"doFillATMInfo", resourceRoot, true, tonumber(sr.bank_money))
end)

addEvent("doATMOperation", true)
addEventHandler("doATMOperation", resourceRoot, function(kwota)
    -- kwota dodatnia - wplata
    -- kwota ujemna - wyplata
    if type(kwota) ~= "number" then outputDebugString("Blad bankomatu xDDDDD") return end
    if kwota>0 and kwota>getPlayerMoney(client) then return end -- komunikat bledu po stronie klienta
    local dbid=getElementData(client,"player:uid")
    local sr=exports["ogrpg-db"]:dbGet("SELECT `bank_money` FROM `ogrpg_users` WHERE id=? LIMIT 1",dbid)
    if not sr or #sr < 1 then return end
    sr=tonumber(sr[1].bank_money)
    if not dbid then return end -- nie powinno sie zdarzyc
    if kwota>0 then
        if getPlayerMoney(client)<kwota then return end
        takePlayerMoney(client, kwota)
        exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET bank_money=bank_money+?? WHERE id=? LIMIT 1",tonumber(kwota),dbid)
        local sr=exports["ogrpg-db"]:dbGet("SELECT `bank_money` FROM `ogrpg_users` WHERE id=? LIMIT 1",dbid)
        if not sr or #sr < 1 then return end
        sr=tonumber(sr[1].bank_money)
        triggerEvent("admin:logs", root, string.format("WPLATA %d DO bankomatu (UID : %d) STAN KONTA %d",math.abs(tonumber(kwota)),dbid,sr))
        --triggerEvent("broadcastCaptionedEvent", client, getPlayerName(client).." wp?aca pieni?dze do bankomatu", 3, 20, true)
        outputChatBox("* Wplaciles pieni?dze", client, 128,255,0)
    elseif kwota<0 then
        if (sr<math.abs(kwota)) then
            outputChatBox("* Nie masz tyle ?rodk?w na koncie!", client, 128,255,0)
--            triggerClientEvent(client,"onAnnouncement3", root, "Nie masz tyle ?rodk?w na koncie!", 5)
            return
        end
        exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET bank_money=bank_money-?? WHERE id=? LIMIT 1",math.abs(tonumber(kwota)),dbid)
        local sr=exports["ogrpg-db"]:dbGet("SELECT `bank_money` FROM `ogrpg_users` WHERE id=? LIMIT 1",dbid)
        if not sr or #sr < 1 then return end
        sr=tonumber(sr[1].bank_money)
        triggerEvent("admin:logs", root, string.format("WYPLATA %d z bankomatu (UID : %d) STAN KONTA %d",math.abs(tonumber(kwota)),dbid,sr))
        outputChatBox("* Wyplaciles pieni?dze", client, 128,255,0)
        givePlayerMoney(client, math.abs(kwota))
    end
    

end)

C:
local bankomaty={
--x,y,z, rx, ry, rz, INT, DIM,
{-1914.99, 872.88, 35.41-0.35, -0.00, 0.00, 270.16}, -- Spawn.
{-1915.00, 893.88, 35.41-0.35, -0.00, 0.00, 268.96}, -- Spawn.
{-1859.65, -145.76, 11.91-0.35, -0.00, 0.00, 180.49}, -- Praca Sweepery.
{-2032.97, 162.65, 29.04-0.35, -0.00, 0.00, 90.50}, -- Mechanik Doherty.
{-1964.86, 291.72, 35.47-0.35, -0.00, 0.00, 89.13}, -- Salon Doherty.
{-1712.48, 399.23, 7.42-0.35, -0.00, 0.00, 223.78}, -- Praca Cysterny.
{-1648.90, 1202.50, 7.25-0.35, -0.00, 0.00, 180.47}, -- Salon Downtown.
{-1603.62, 710.27, 13.87-0.35, -0.00, 0.00, 178.86}, -- Komenda G??wna Policji.
{-1971.48, 620.47, 35.17-0.35, -0.00, 0.00, 0.40}, -- Przechowalnia Pojazd?w.
{-2114.78,3.59,35.32-0.35, -0.00, 0.00, 179.26}, -- Pa?stwowa Stra? Po?arna.
{-2271.49, -132.45, 35.32-0.35, -0.00, 0.00, 359.55}, -- Tuner Garcia.
{-2404.54, 697.55, 35.17-0.35, -0.00, 0.00, 268.06}, -- Praca Koszenia Traw.
{-2420.15, 983.44, 45.30-0.35, -0.00, 0.00, 90.56}, -- Stacja Juniper Hollow.
{-1874.00, -219.98, 18.38-0.35, -0.00, 0.00, 88.42}, -- Parking Policyjny Doherty.
{-2637.05, 632.15, 14.45-0.35, -0.00, 0.00, 269.96}, -- Pogotowie Ratunkowe
}

for i,v in ipairs(bankomaty) do

    v.obiekt=createObject(2942,v[1],v[2],v[3],v[4],v[5],v[6])
    setElementInterior(v.obiekt,v[7] or 0)
    setElementDimension(v.obiekt,v[8] or 0)
    setElementFrozen(v.obiekt,true)
    setObjectBreakable ( v.obiekt, false )

--    v.mapicon=createBlip(v[1],v[2],v[3], 52, 2, 255,255,255,255, -1000, 300)
    --v.mapicon=createBlip(v[1],v[2],v[3], 52, 1, 5,255,5,255, -10000, 150)
    setElementInterior(v.mapicon,v[7] or 0)
    setElementDimension(v.mapicon,v[8] or 0)

    v.cs=createColSphere(v[1],v[2],v[3]+1, 1)
    setElementInterior(v.cs,v[7] or 0)
    setElementDimension(v.cs,v[8] or 0)
    v.text=createElement('text')
    setElementData(v.text,"name","Bankomat")
    setElementPosition(v.text,v[1],v[2],v[3])
    setElementInterior(v.text,v[7] or 0)
    setElementDimension(v.text,v[8] or 0)
end


local bw={}
bw.win = guiCreateWindow(0.7236,0.3398,0.2314,0.5,"Bankomat",true)
guiWindowSetMovable(bw.win,false)
guiWindowSetSizable(bw.win,false)
bw.lbl1 = guiCreateLabel(0.0633,0.0997,0.903,0.1571,"Stan konta:\n0PLN",true,bw.win)
local font0_money = guiCreateFont(":ogrpg-gui/fonts/money.ttf", 14)
guiSetFont(bw.lbl1, font0_money)
guiLabelSetVerticalAlign(bw.lbl1,"center")
guiLabelSetHorizontalAlign(bw.lbl1,"center",false)
local font1_money = guiCreateFont(":ogrpg-gui/droid-sans.ttf", 7)

bw.lbl2 = guiCreateLabel(0.0759,0.2734,0.8861,0.0695,"Wp?ata &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;",true,bw.win)


bw.edt1 = guiCreateEdit(0.0675,0.3385,0.8608,0.0859,"0",true,bw.win)
bw.btn_wplac = guiCreateButton(0.0717,0.4427,0.8608,0.0911,"Wp?a?",true,bw.win)

bw.lbl3 = guiCreateLabel(0.0759,0.5626,0.8861,0.0695,"Wyp?ata ".."&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;",true,bw.win)
bw.edt2 = guiCreateEdit(0.0675,0.6276,0.8608,0.0859,"0",true,bw.win)
bw.btn_wyplac = guiCreateButton(0.0717,0.7344,0.8608,0.0911,"Wyp?a?",true,bw.win)

bw.btn_zamknij = guiCreateButton(0.0717,0.888,0.8608,0.0859,"Zamknij",true,bw.win)
guiSetFont(bw.win, font1_money)
guiSetFont(bw.lbl2, font1_money)
guiSetFont(bw.edt1, font1_money)
guiSetFont(bw.btn_wplac, font1_money)
guiSetFont(bw.lbl3, font1_money)
guiSetFont(bw.edt2, font1_money)
guiSetFont(bw.btn_wyplac, font1_money)
guiSetFont(bw.btn_zamknij, font1_money)


guiSetVisible(bw.win, false)



addEventHandler("onClientColShapeHit", resourceRoot, function(el,md)
    if not md or el~=localPlayer then return end
--    outputChatBox("Bankomat pokazuje napis: AWARIA.")
--    if getPlayerName(localPlayer)=="Carolynn_Trench" or getPlayerName(localPlayer)=="Bob_Euler" then


        guiSetVisible(bw.win, true)
        guiSetEnabled(bw.btn_wyplac, false)
        guiSetEnabled(bw.btn_wplac, false)
        guiSetText(bw.lbl1,"Trwa otwieranie konta bankowego...")
        triggerServerEvent("onPlayerRequestATMInfo", resourceRoot)
--showCursor(true,true)
        guiSetInputMode("no_binds_when_editing")
            guiSetText(bw.win, string.format("Bankomat F3-KURSOR (UID:%d)",getElementData(el,"player:uid")))
            guiSetText(bw.lbl2, "Wp?ata &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;")
            guiSetText(bw.lbl3, "Wyp?ata &#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;")
            guiSetVisible(bw.btn_wyplac, true)
            guiSetPosition(bw.btn_wplac, 0.0717,0.4427, true)
--    end
end)

local function closeATMWin()
    if guiGetVisible(bw.win) then
        guiSetVisible(bw.win, false)
--showCursor(false)
    end
end

addEventHandler("onClientGUIClick", bw.btn_zamknij, closeATMWin, false)
addEventHandler("onClientColShapeLeave", resourceRoot, function(el,md)
    if el~=localPlayer then return end
    closeATMWin()
end)

-- triggerClientEvent(client,"doFillATMInfo", resourceRoot, true, sr.bank_money)
addEvent("doFillATMInfo", true)
addEventHandler("doFillATMInfo", resourceRoot, function(success, balance)
    if not success then
        guiSetText(bw.lbl1,"Testowany.")   --Musisz by? zarejestrowanym graczem aby skorzysta? z bankomatu.
        return
    end
    guiSetText(bw.lbl1,"Stan Twojego konta:".."\n".. balance.." PLN")
    setElementData(bw.win, "balance", tonumber(balance))
    guiSetText(bw.edt2,100 > balance and balance or 100)
    if balance>0 then
        guiSetEnabled(bw.btn_wyplac, true)
    end

    guiSetText(bw.edt1,balance)
    guiSetEnabled(bw.btn_wplac, true)
end)

addEventHandler("onClientPlayerSpawn", localPlayer, closeATMWin)


addEventHandler("onClientGUIClick", bw.btn_wplac, function()
    local kwotae=tonumber(guiGetText(bw.edt1))
    if not kwotae then return end
    local kwota=math.floor(kwotae)
    if not kwota or kwota<1 then
--        triggerEvent("onAnnouncement3", root, "Nieprawid?owa kwota wp?aty.", 4)
        outputChatBox("* Nieprawid?owa kwota wp?aty!", 128,255,0)
        return
    end

    if guiGetVisible(bw.btn_wyplac) then --normalna wplata

        if kwota>getPlayerMoney() then
            outputChatBox("* Nie masz tyle got?wki!", 128,255,0)
            return
        end

        closeATMWin()
        triggerServerEvent("doATMOperation", resourceRoot, kwota)
    end

end, false)

addEventHandler("onClientGUIClick", bw.btn_wyplac, function()
    if not tonumber(guiGetText(bw.edt2)) then return end
    local kwotae=tonumber(guiGetText(bw.edt2))
    if not kwotae then return end
    local kwota=math.floor(kwotae)
    if not kwota or kwota<1 then
--        triggerEvent("onAnnouncement3", root, "Nieprawid?owa kwota wyp?aty.", 4)
        outputChatBox("* Nieprawid?owa kwota wp?aty!", 128,255,0)
        return
    end
    if getPlayerMoney()+kwota>99999999 then
--        triggerEvent("onAnnouncement3", root, "Nie mo?esz mie? tyle got?wki przy sobie.", 4)
        outputChatBox("* Maksymalna ilo?? got?wki kt?r? mo?esz mie? przy sobie to 999999.99 PLN", 128,255,0)
        return
    end
    closeATMWin()
    triggerServerEvent("doATMOperation", resourceRoot, -kwota)

end, false)

Kod Przyk?adowej Pracy:
local m1 = createMarker(1799.74,-1934.21,13.49-0.9, "cylinder",1,0,255,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(431, 1795.26,-1930.91,13.49,359.5,360.0,0.5)
    
    setElementData(bus, "zrespilGracz", el)
    setElementData(bus, "vehicle:fuel", 100)
    setElementData(bus, "vehicle:mileage", 69000)
    setElementData(bus, "vehicle:desc", "Praca Dorywcza\nKierowca Autobusu\nCel:Gie?da")    
    
    warpPedIntoVehicle(el, bus)
    removePreviousVehicles(el)
    triggerClientEvent(el, "STARTJobBus", resourceRoot, bus)

    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("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("onPlayerQuit", true)
addEventHandler ( "onPlayerQuit", getRootElement(), function()
     if vehs[source] then
          if isElement(vehs[source]) then destroyElement(vehs[source]) end
    end
end)

local t=createElement("text")
setElementData(t, "scale", 1.2)
setElementData(t,"name","Praca Kierowcy Autobusu\n20PLN za przystanek!")
setElementPosition(t, 1799.74,-1934.21,13.49)


local districtsBus = {
    {1817.91,-1917.31,13.38},
    {1916.32,-1936.04,13.38},
    {1985.46,-1936.26,13.38},
    {2085.96,-1915.64,13.38},
    {2085.63,-1852.60,13.38},
    {2085.70,-1806.89,13.38},
    {2114.49,-1693.73,13.38},
    {2116.98,-1581.85,25.96},
    {2116.56,-1442.89,23.83},
    {2086.14,-1380.24,23.83},
    {2076.03,-1281.49,23.83},
    {2075.67,-1172.02,23.66},
    {2019.02,-1131.67,24.79},
    {1927.82,-1131.63,25.01},
    {1862.59,-1157.71,23.69},
    {1795.70,-1170.01,23.65},
    {1607.47,-1156.67,23.91},
    {1514.15,-1156.63,23.91},
    {1450.54,-1265.07,13.38},
    {1450.02,-1418.88,13.38},
    {1425.29,-1573.70,13.36},
    {1425.43,-1671.88,13.38},
    {1429.87,-1736.51,13.38},
    {1629.79,-1736.56,13.38},
    {1781.05,-1736.39,13.38},
    {1817.39,-1788.47,13.38},
    {1817.38,-1870.58,13.41},

}

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)
        exports.notification:showBox ("info","Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        --exports["rpg_noti"]:createNotification(el,"Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        outputChatBox("Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
    else
        showMarker()
        playSoundFrontEnd(12)
        triggerServerEvent("givePlayerMoney", localPlayer, 10, 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,128,255,0)
    
    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)
    exports.notification:showBox ("info","Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 20 PLN Za Przystanek!")
    --exports["rpg_noti"]:createNotification(el,"Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 10 PLN Za Przystanek!")
    outputChatBox("Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 20 PLN Za Przystanek!")
    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()
            exports.notification:showBox ("info","Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
            --exports["rpg_noti"]:createNotification(el,"Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
            outputChatBox("Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        end
    end
end)


Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-13, 22:21


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 | .
Nie wiem dok?adnie czy zadzia?a, ale spr?buj tak:

local districtsBus = {
    {1817.91,-1917.31,13.38},
    {1916.32,-1936.04,13.38},
    {1985.46,-1936.26,13.38},
    {2085.96,-1915.64,13.38},
    {2085.63,-1852.60,13.38},
    {2085.70,-1806.89,13.38},
    {2114.49,-1693.73,13.38},
    {2116.98,-1581.85,25.96},
    {2116.56,-1442.89,23.83},
    {2086.14,-1380.24,23.83},
    {2076.03,-1281.49,23.83},
    {2075.67,-1172.02,23.66},
    {2019.02,-1131.67,24.79},
    {1927.82,-1131.63,25.01},
    {1862.59,-1157.71,23.69},
    {1795.70,-1170.01,23.65},
    {1607.47,-1156.67,23.91},
    {1514.15,-1156.63,23.91},
    {1450.54,-1265.07,13.38},
    {1450.02,-1418.88,13.38},
    {1425.29,-1573.70,13.36},
    {1425.43,-1671.88,13.38},
    {1429.87,-1736.51,13.38},
    {1629.79,-1736.56,13.38},
    {1781.05,-1736.39,13.38},
    {1817.39,-1788.47,13.38},
    {1817.38,-1870.58,13.41},

}

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)
        exports.notification:showBox ("info","Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        --exports["rpg_noti"]:createNotification(el,"Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        outputChatBox("Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
    else
        showMarker()
        playSoundFrontEnd(12)
    triggerServerEvent("doATMOperation", resourceRoot, 10)
    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,128,255,0)
    
    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)
    exports.notification:showBox ("info","Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 20 PLN Za Przystanek!")
    --exports["rpg_noti"]:createNotification(el,"Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 10 PLN Za Przystanek!")
    outputChatBox("Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 20 PLN Za Przystanek!")
    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()
            exports.notification:showBox ("info","Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
            --exports["rpg_noti"]:createNotification(el,"Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
            outputChatBox("Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        end
    end
end)


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-12-13, 22:28


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"T0M4SZ" napisał/a:

Nie wiem dok?adnie czy zadzia?a, ale spr?buj tak:

local districtsBus = {
    {1817.91,-1917.31,13.38},
    {1916.32,-1936.04,13.38},
    {1985.46,-1936.26,13.38},
    {2085.96,-1915.64,13.38},
    {2085.63,-1852.60,13.38},
    {2085.70,-1806.89,13.38},
    {2114.49,-1693.73,13.38},
    {2116.98,-1581.85,25.96},
    {2116.56,-1442.89,23.83},
    {2086.14,-1380.24,23.83},
    {2076.03,-1281.49,23.83},
    {2075.67,-1172.02,23.66},
    {2019.02,-1131.67,24.79},
    {1927.82,-1131.63,25.01},
    {1862.59,-1157.71,23.69},
    {1795.70,-1170.01,23.65},
    {1607.47,-1156.67,23.91},
    {1514.15,-1156.63,23.91},
    {1450.54,-1265.07,13.38},
    {1450.02,-1418.88,13.38},
    {1425.29,-1573.70,13.36},
    {1425.43,-1671.88,13.38},
    {1429.87,-1736.51,13.38},
    {1629.79,-1736.56,13.38},
    {1781.05,-1736.39,13.38},
    {1817.39,-1788.47,13.38},
    {1817.38,-1870.58,13.41},

}

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)
        exports.notification:showBox ("info","Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        --exports["rpg_noti"]:createNotification(el,"Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        outputChatBox("Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
    else
        showMarker()
        playSoundFrontEnd(12)
    triggerServerEvent("doATMOperation", resourceRoot, 10)
    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,128,255,0)
    
    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)
    exports.notification:showBox ("info","Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 20 PLN Za Przystanek!")
    --exports["rpg_noti"]:createNotification(el,"Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 10 PLN Za Przystanek!")
    outputChatBox("Rozpocz??e? Prace Kierowyc Autobusu.Zarobki 20 PLN Za Przystanek!")
    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()
            exports.notification:showBox ("info","Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
            --exports["rpg_noti"]:createNotification(el,"Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
            outputChatBox("Gratuluje Zako?czy?e? Prace Kierowcy Autobusu!")
        end
    end
end)

Nie dzia?a

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-13, 22:38


Loop

Inspektor






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

Piwa: 201

Respekt: 130
Respekt: 130

triggerServerEvent("doATMOperation",root, 10)


Sprawdz

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-13, 22:42


zabijaka2000







Wiek: 26
Na forum: 5124 dni
Posty: 147
Nick w MP: aleks556

Piwa: 13

Respekt: 80

Ostrzeżeń: 20%
Albo zamiast root daj localPlayer.

Podpis
San Fierro Stories Roleplay
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-13, 22:44


Loop

Inspektor






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

Piwa: 201

Respekt: 130
Respekt: 130

To by musia?o by? w evencie doATMOperation source a tam jest client.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-13, 23:03


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"Loop" napisał/a:

triggerServerEvent("doATMOperation",root, 10)


Sprawdz


Dzia?a ale tak nie za bardzo wyskakuje mi * Wplaciles pieni?dze i zabiera mi z konta(nie bankowego) i wp?aca do bankomatu

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-14, 11:48


Dexnes_

Tiger






Wiek: 26
Na forum: 4542 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

STOPseba, Dzieje si? tak dlatego , ?e funkcja do ktorej triggerujesz ma zapisane aby zabiera? tobie pieni?dze i wp?aca? do bankomatu , polecam zrobi? now? funkcje wzoruj?c si? na niej i usun?? nie potrzebne elementy (takePlayerMoney , i to co ci przeszkadza.) I wtedy , jak b?dziesz robi? jak?? prac? to po prostu u?yjesz tego triggera.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-14, 16:37


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

a mog? prosi? o ja?niejsze wyt?umaczenie? :mrgreen:

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-14, 16:59


MartinPanZycia

Zielony w LUA






Wiek: 27
Na forum: 3870 dni
Posty: 477
Nick w MP: Rodzaje

Piwa: 877

Respekt: 70,5

Ostrzeżeń: 40%

        takePlayerMoney(client, kwota)

robi?c nowy triggerServerEvent usu? tylko t? linijke co wy?ej i bd git

Podpis
Cześć w MTA jestem jako Rodzaje.
Wszystko jest po staremu nie zamierzam stawiać RPG.
Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-14, 17:06


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

addEvent("WyplataPraca", true)
addEventHandler("WyplataPraca", resourceRoot, function(kwota)
    -- kwota dodatnia - wplata
    -- kwota ujemna - wyplata
    if type(kwota) ~= "number" then outputDebugString("Blad bankomatu xDDDDD") return end
    if kwota>0 and kwota>getPlayerMoney(client) then return end -- komunikat bledu po stronie klienta
    local dbid=getElementData(client,"player:uid")
    local sr=exports["ogrpg-db"]:dbGet("SELECT `bank_money` FROM `ogrpg_users` WHERE id=? LIMIT 1",dbid)
    if not sr or #sr < 1 then return end
    sr=tonumber(sr[1].bank_money)
    if not dbid then return end -- nie powinno sie zdarzyc
    if kwota>0 then
        if getPlayerMoney(client)<kwota then return end
        --takePlayerMoney(client, kwota)
        exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET bank_money=bank_money+?? WHERE id=? LIMIT 1",tonumber(kwota),dbid)
        local sr=exports["ogrpg-db"]:dbGet("SELECT `bank_money` FROM `ogrpg_users` WHERE id=? LIMIT 1",dbid)
        if not sr or #sr < 1 then return end
        sr=tonumber(sr[1].bank_money)
        triggerEvent("admin:logs", root, string.format("WPLATA %d DO bankomatu (UID : %d) STAN KONTA %d",math.abs(tonumber(kwota)),dbid,sr))
        --triggerEvent("broadcastCaptionedEvent", client, getPlayerName(client).." wp?aca pieni?dze do bankomatu", 3, 20, true)
        --outputChatBox("* Wplaciles pieni?dze", client, 128,255,0)
    elseif kwota<0 then
        if (sr<math.abs(kwota)) then
            --outputChatBox("* Nie masz tyle ?rodk?w na koncie!", client, 128,255,0)
--            triggerClientEvent(client,"onAnnouncement3", root, "Nie masz tyle ?rodk?w na koncie!", 5)
            return
        end
        exports["ogrpg-db"]:dbSet("UPDATE ogrpg_users SET bank_money=bank_money-?? WHERE id=? LIMIT 1",math.abs(tonumber(kwota)),dbid)
        local sr=exports["ogrpg-db"]:dbGet("SELECT `bank_money` FROM `ogrpg_users` WHERE id=? LIMIT 1",dbid)
        if not sr or #sr < 1 then return end
        sr=tonumber(sr[1].bank_money)
        triggerEvent("admin:logs", root, string.format("WYPLATA %d z bankomatu (UID : %d) STAN KONTA %d",math.abs(tonumber(kwota)),dbid,sr))
        --outputChatBox("* Wyplaciles pieni?dze", client, 128,255,0)
        givePlayerMoney(client, math.abs(kwota))
    end
    

end)

Takie co??

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-14, 18:03


Dexnes_

Tiger






Wiek: 26
Na forum: 4542 dni
Posty: 620
Nick w MP: Dexnes

Piwa: 1394

Respekt: 390
Respekt: 390Respekt: 390Respekt: 390Respekt: 390

Sprawdz , nie mamy tego samego gamemode co ty , chod? wydaje mi si? ?e mo?e by? jeden b??d.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-14, 18:12


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"BlackGamePL" napisał/a:

Sprawdz , nie mamy tego samego gamemode co ty , chod? wydaje mi si? ?e mo?e by? jeden b??d.

Sprawdzi?em i daje kas? za prace do bankomatu w db3 nic niema.

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-14, 19:05


luki123luki123

Place Game






Wiek: 28
Na forum: 5416 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6103

Respekt: 611
Respekt: 611Respekt: 611

STOPseba, problem rozsta? rozwi?zany i mo?na zamkn?? ? Czy dalej jest jaki? problem ?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2016-12-14, 19:18


STOPseba

Emeryt na scenie MTA






Wiek: 26
Na forum: 3912 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5016

Respekt: 576,3
Respekt: 576,3

"luki123luki123" napisał/a:

STOPseba, problem rozsta? rozwi?zany i mo?na zamkn?? ? Czy dalej jest jaki? problem ?

Problem zosta? rozwi?zany ka?dy kto pomaga? zosta? wynagrodzony mo?na zamyka?.

Podpis



Kontakt
Discord: STOPseba#7603
STOPseba na fejsie
Messenger


Postaw piwo autorowi tego posta
 

 
Tagi: zarobki :: bankomatu
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