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: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

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"resourceRootfalse)
        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"resourceRootfalse)
        return
    end
    local sr=sr[1]
    triggerClientEvent(client,"doFillATMInfo"resourceRoottruetonumber(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>and kwota>getPlayerMoney(clientthen 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(clientkwota)
        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"rootstring.format("WPLATA %d DO bankomatu (UID : %d) STAN KONTA %d",math.abs(tonumber(kwota)),dbid,sr))
        --triggerEvent("broadcastCaptionedEvent"clientgetPlayerName(client).." wp?aca pieni?dze do bankomatu"320true)
        outputChatBox("* Wplaciles pieni?dze"client128,255,0)
    elseif kwota<0 then
        if (sr<math.abs(kwota)) then
            outputChatBox("* Nie masz tyle ?rodk?w na koncie!"client128,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"rootstring.format("WYPLATA %d z bankomatu (UID : %d) STAN KONTA %d",math.abs(tonumber(kwota)),dbid,sr))
        outputChatBox("* Wyplaciles pieni?dze"client128,255,0)
        givePlayerMoney(clientmath.abs(kwota))
    end
    

end)

C:
local bankomaty={
--x,y,zrxryrzINTDIM,
{-1914.99872.8835.41-0.35, -0.000.00270.16}, -- Spawn.
{-1915.00893.8835.41-0.35, -0.000.00268.96}, -- Spawn.
{-1859.65, -145.7611.91-0.35, -0.000.00180.49}, -- Praca Sweepery.
{-2032.97162.6529.04-0.35, -0.000.0090.50}, -- Mechanik Doherty.
{-1964.86291.7235.47-0.35, -0.000.0089.13}, -- Salon Doherty.
{-1712.48399.237.42-0.35, -0.000.00223.78}, -- Praca Cysterny.
{-1648.901202.507.25-0.35, -0.000.00180.47}, -- Salon Downtown.
{-1603.62710.2713.87-0.35, -0.000.00178.86}, -- Komenda G??wna Policji.
{-1971.48620.4735.17-0.35, -0.000.000.40}, -- Przechowalnia Pojazd?w.
{-2114.78,3.59,35.32-0.35, -0.000.00179.26}, -- Pa?stwowa StraPo?arna.
{-2271.49, -132.4535.32-0.35, -0.000.00359.55}, -- Tuner Garcia.
{-2404.54697.5535.17-0.35, -0.000.00268.06}, -- Praca Koszenia Traw.
{-2420.15983.4445.30-0.35, -0.000.0090.56}, -- Stacja Juniper Hollow.
{-1874.00, -219.9818.38-0.35, -0.000.0088.42}, -- Parking Policyjny Doherty.
{-2637.05632.1514.45-0.35, -0.000.00269.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.obiektfalse )

--    v.mapicon=createBlip(v[1],v[2],v[3], 522255,255,255,255, -1000300)
    --v.mapicon=createBlip(v[1],v[2],v[3], 5215,255,5,255, -10000150)
    setElementInterior(v.mapicon,v[7] or 0)
    setElementDimension(v.mapicon,v[8] or 0)

    v.cs=createColSphere(v[1],v[2],v[3]+11)
    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.lbl1font0_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.winfont1_money)
guiSetFont(bw.lbl2font1_money)
guiSetFont(bw.edt1font1_money)
guiSetFont(bw.btn_wplacfont1_money)
guiSetFont(bw.lbl3font1_money)
guiSetFont(bw.edt2font1_money)
guiSetFont(bw.btn_wyplacfont1_money)
guiSetFont(bw.btn_zamknijfont1_money)


guiSetVisible(bw.winfalse)



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.wintrue)
        guiSetEnabled(bw.btn_wyplacfalse)
        guiSetEnabled(bw.btn_wplacfalse)
        guiSetText(bw.lbl1,"Trwa otwieranie konta bankowego...")
        triggerServerEvent("onPlayerRequestATMInfo"resourceRoot)
--showCursor(true,true)
        guiSetInputMode("no_binds_when_editing")
            guiSetText(bw.winstring.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_wyplactrue)
            guiSetPosition(bw.btn_wplac0.0717,0.4427true)
--    end
end)

local function closeATMWin()
    if guiGetVisible(bw.winthen
        guiSetVisible(bw.winfalse)
--showCursor(false)
    end
end

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

-- triggerClientEvent(client,"doFillATMInfo"resourceRoottruesr.bank_money)
addEvent("doFillATMInfo"true)
addEventHandler("doFillATMInfo"resourceRoot, function(successbalance)
    if not success then
        guiSetText(bw.lbl1,"Testowany.")   --Musisz byzarejestrowanym graczem aby skorzystaz 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_wyplactrue)
    end

    guiSetText(bw.edt1,balance)
    guiSetEnabled(bw.btn_wplactrue)
end)

addEventHandler("onClientPlayerSpawn"localPlayercloseATMWin)


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_wyplacthen --normalna wplata

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

        closeATMWin()
        triggerServerEvent("doATMOperation"resourceRootkwota)
    end

endfalse)

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)

endfalse)

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(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 bus createVehicle(4311795.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(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)

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)

addEvent("onPlayerQuit"true)
addEventHandler "onPlayerQuit"getRootElement(), function()
     if vehs[sourcethen
          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(t1799.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(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)
        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"localPlayer100)
    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"4,128,255,0)
    
    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)
    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(plrseat)
    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: 3880 dni
Posty: 3191
Nick w MP: Emm

Piwa: 6162

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(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)
        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"resourceRoot10)
    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"4,128,255,0)
    
    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)
    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(plrseat)
    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: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

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(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)
        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"resourceRoot10)
    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"4,128,255,0)
    
    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)
    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(plrseat)
    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: 27
Na forum: 4289 dni
Posty: 311
Nick w MP: Inspektor

Piwa: 201

Respekt: 130
Respekt: 130

triggerServerEvent("doATMOperation",root10)


Sprawdz

Postaw piwo autorowi tego posta
 

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


zabijaka2000







Wiek: 26
Na forum: 4983 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: 27
Na forum: 4289 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: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

Respekt: 576,3
Respekt: 576,3

"Loop" napisał/a:

triggerServerEvent("doATMOperation",root10)


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: 4401 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: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

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: 3728 dni
Posty: 476
Nick w MP: Rodzaje

Piwa: 878

Respekt: 70,5

Ostrzeżeń: 40%

        takePlayerMoney(clientkwota)

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: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

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>and kwota>getPlayerMoney(clientthen 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(clientkwota)
        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"rootstring.format("WPLATA %d DO bankomatu (UID : %d) STAN KONTA %d",math.abs(tonumber(kwota)),dbid,sr))
        --triggerEvent("broadcastCaptionedEvent"clientgetPlayerName(client).." wp?aca pieni?dze do bankomatu"320true)
        --outputChatBox("* Wplaciles pieni?dze"client128,255,0)
    elseif kwota<0 then
        if (sr<math.abs(kwota)) then
            --outputChatBox("* Nie masz tyle ?rodk?w na koncie!"client128,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"rootstring.format("WYPLATA %d z bankomatu (UID : %d) STAN KONTA %d",math.abs(tonumber(kwota)),dbid,sr))
        --outputChatBox("* Wyplaciles pieni?dze"client128,255,0)
        givePlayerMoney(clientmath.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: 4401 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: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

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: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

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: 25
Na forum: 3771 dni
Posty: 448
Nick w MP: STOPseba

Piwa: 5014

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