local banks={
{pozATM={1465.83, -1749.91, 15.45,180},typ="bankomat"},
{pozATM={-2665.41, -12.46, 6.13,-90},typ="bankomat"},
{pozATM={-2058.65, -101.89, 35.17,-535},typ="bankomat"},
{pozATM={-1894.82, -510.55, 24.98,0},typ="bankomat"},
{pozATM={-2032.98, 164.66, 28.84,90},typ="bankomat"},
{pozATM={-1974.29, 309.36, 35.17,0},typ="bankomat"},
{pozATM={-1798.35, 1200.63, 25.12,0},typ="bankomat"},
{pozATM={-1653.16, 1206.55, 7.25,-535},typ="bankomat"},
{pozATM={-2715.56, 223.22, 4.33,90},typ="bankomat"},
{pozATM={-1851.98, 1421.64, 7.18,-90},typ="bankomat"},
{pozATM={-1711.88, -64.47, 3.55,-50},typ="bankomat"},
{pozATM={-1535.35, 524.95, 7.18,-88},typ="bankomat"},
{pozATM={-2930.80, 457.34, 4.91,88},typ="bankomat"},
{pozATM={-2297.92, -172.53, 35.32,127},typ="bankomat"},
{pozATM={-1561.48, 132.19, 3.55,135},typ="bankomat"},
{pozATM={-1693.15, 415.17, 7.18,45},typ="bankomat"},
{pozATM={-2374.56, 905.03, 45.45,270},typ="bankomat"},
{pozATM={-1982.63, 620.47, 35.17,360},typ="bankomat"},
{pozATM={-1745.74, 771.45, 24.89,360},typ="bankomat"},
{pozATM={-924.91, -519.22, 25.95,470},typ="bankomat"},
{pozATM={-1061.09, -1192.22, 129.22,90},typ="bankomat"},
{pozATM={-2670.92, 636.53, 14.45,90},typ="bankomat"},
{pozATM={-1625.36, 717.60, 14.61,90},typ="bankomat"},
{pozATM={-1018.41, -698.41, 32.01,90},typ="bankomat"},
{pozATM={-2203.24, -2332.91, 30.63,230},typ="bankomat"},
{pozATM={-2354.78, -1632.96, 486.01,90},typ="bankomat"},
{pozATM={-2338.77, -1636.21, 484.75,90},typ="bankomat"},
{pozATM={2798.90, 973.50, 10.75,0},typ="bankomat"},
{pozATM={2117.71, 2362.37, 10.82,90},typ="bankomat"},
{poz={-3418.92, 402.67, 17.91},typ="bank",int=0,dim=69},
}
for i,v in ipairs(banks) do
if v.typ=="bankomat" then
v.atm=createObject(2942,v.pozATM[1],v.pozATM[2],v.pozATM[3]-0.4,0,0,v.pozATM[4])
setElementDimension(v.atm,v.dim or 0)
setElementInterior(v.atm,v.int or 0)
local x,y,z=getElementPosition(v.atm)
local _,_,rz=getElementRotation(v.atm)
local rrz=math.rad(rz)
local px=x-(0.8*math.sin(-rrz))
local py=y-(0.8*math.cos(-rrz))
v.marker=createMarker(px,py,v.pozATM[3]-1,'cylinder',1.1, 255, 255, 0)
setElementDimension(v.marker,v.dim or 0)
setElementInterior(v.marker,v.int or 0)
local t=createElement("text")
setElementPosition(t,v.pozATM[1],v.pozATM[2],v.pozATM[3]-0.05)
setElementData(t,"name","Bankomat 24/7")
setElementDimension(t,v.dim or 0)
setElementInterior(t,v.int or 0)
else
v.marker=createMarker(v.poz[1],v.poz[2],v.poz[3]-1,'cylinder',1.1,255, 255, 0)
setElementDimension(v.marker,v.dim or 0)
setElementInterior(v.marker,v.int or 0)
local t=createElement("text")
setElementPosition(t,v.poz[1],v.poz[2],v.poz[3]-0.05)
setElementData(t,"name","MazeBank\nStarLife")
setElementDimension(t,v.dim or 0)
setElementInterior(t,v.int or 0)
end
end
function ifMandaty(plr)
if not plr then return end
if getElementData(plr,"player:mandate")>=500000 then return true
else return false end
end
addEventHandler("onMarkerHit",resourceRoot,function(plr,dim)
if not dim then return end
if getElementType(plr)=="player" then
if isPedInVehicle(plr) then return end
local z_m=nil
for i,v in ipairs(banks) do
if v.marker==source then z_m=v end
end
if not z_m then return end
for i,v in ipairs(banks) do
if v.marker==source then
if v.typ=="bankomat" then
if not getElementData(plr,"bank:karta") then
outputChatBox("Nie posiadasz karty bankomatowo-p?atniczej!",plr)
outputChatBox("Udaj si? do najbli?szej plac?wki banku, aby j? naby?.",plr)
return
end
end
local zap=exports["DB2"]:pobierzWyniki("SELECT bank_money FROM pystories_users WHERE id=?",getElementData(plr,"player:sid"))
if not zap then return end
triggerClientEvent(plr,"panelBanku_c",resourceRoot,"showWindow",true,tostring(tonumber(zap.bank_money)),v.typ)
end
end
end
end)
addEvent("panelBanku",true)
addEventHandler("panelBanku",resourceRoot,function(cmd,d,d2,d3,d4)
if cmd=="wplacaniePieniedzy" then
if(d>0) then
if (d)<=getPlayerMoney(client) then
local kwota=tostring(d)
kwota=(kwota)
kwota=kwota
takePlayerMoney(client,kwota)
exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money+? WHERE id=? LIMIT 1",kwota,getElementData(client,"player:sid"))
exports["pystories-db"]:dbSet("INSERT INTO psrpg_przelewy_bank SET typ=?,dbid_n=?,nadawca=?,kwota=?, data=NOW()","wplata",getElementData(client,"player:sid"),getPlayerName(client),kwota)
local zap=exports["DB2"]:pobierzWyniki("SELECT bank_money FROM pystories_users WHERE id=? LIMIT 1",getElementData(client,"player:sid"))
if not zap then return end
triggerClientEvent(client,"panelBanku_c",resourceRoot,"odswiezPanel",tonumber(zap.bank_money))
if d2=="bank" then --exports["es-logi"]:outputUcho("BANK WPLATA: "..getPlayerName(client).." kwota: "..string.format("%.2f",kwota/100).." PLN")
else --exports["es-logi"]:outputUcho("BANKOMAT WPLATA: "..getPlayerName(client).." kwota: "..string.format("%.2f",kwota/100).." PLN") end
end
outputChatBox("Wp?ata zosta?a wykonana pomy?lnie.",client)
else outputChatBox("Nie posiadasz tyle got?wki.",client) end
else outputChatBox("Kwota musi by? wi?ksza ni? 0 PLN.",client) end
elseif cmd=="wyplacaniePieniedzy" then
if(d>0) then
local zap=exports["DB2"]:pobierzWyniki("SELECT bank_money FROM pystories_users WHERE id=? LIMIT 1",getElementData(client,"player:sid"))
if not zap then return end
local kwota=d
kwota=(kwota)
if(zap.bank_money>=0) then
if (getPlayerMoney(client)+kwota>99999999) then outputChatBox("Mo?esz mie? przy sobie maksymalnie 999 ty? PLN.",client)
else
givePlayerMoney(client,kwota)
exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money-? WHERE id=? LIMIT 1",kwota,getElementData(client,"player:sid"))
exports["pystories-db"]:dbSet("INSERT INTO psrpg_przelewy_bank SET typ=?,dbid_n=?,nadawca=?,kwota=?, data=NOW()","wyplata",getElementData(client,"player:sid"),getPlayerName(client),kwota)
triggerClientEvent(client,"panelBanku_c",resourceRoot,"odswiezPanel",tonumber((zap.bank_money-kwota)))
outputChatBox("Wyp?ata zosta?a wykonana pomy?lnie.",client)
if d2=="bank" then --exports["es-logi"]:outputUcho("BANK WYPLATA: "..getPlayerName(client).." kwota: "..string.format("%.2f",kwota/100).." PLN")
else --exports["es-logi"]:outputUcho("BANKOMAT WYPLATA: "..getPlayerName(client).." kwota: "..string.format("%.2f",kwota/100).." PLN") end
end
end
else outputChatBox("Nie posiadasz takiej ilo?ci ?rodk?w na koncie.",client) end
else outputChatBox("Kwota musi by? wi?ksza ni? 0PLN.",client) end
zap=nil
elseif cmd=="wyrabianieKarty" then
if not getElementData(client,"bank:karta") then
if getPlayerMoney(client)<(2500000) then
outputChatBox("Nie posiadasz tyle got?wki - 2,500,000PLN.",client)
triggerClientEvent(client,"panelBanku_c",resourceRoot,"unlock")
return
end
takePlayerMoney(client,(2500000))
setElementData(client,"bank:karta",true)
exports["pystories-db"]:dbSet("UPDATE pystories_users SET karta_bank='tak' WHERE id=?",getElementData(client,"player:sid"))
outputChatBox("Wyrobiono kart? bankomatowo-p?atnicz?.",client)
outputChatBox("Od teraz mo?esz wp?aca? i wyp?aca? got?wk? w bankomatach.",client)
--exports["es-logi"]:outputUcho("BANK KARTA: "..getPlayerName(client).." aktywuje now? kart? bankomatowo-p?atnicz? za 150PLN.")
zap=nil
else
removeElementData(client,"bank:karta")
exports["pystories-db"]:dbSet("UPDATE pystories_users SET karta_bank=NULL WHERE id=?",getElementData(client,"player:sid"))
outputChatBox("Dezaktywowano kart? bankomatowo-p?atnicz?.",client)
outputChatBox("Nie mo?esz ju? wp?aca? i wyp?aca? got?wki poprzez bankomaty.",client)
--exports["es-logi"]:outputUcho("BANK KARTA: "..getPlayerName(client).." dezaktywuje swoj? kart? bankomatowo-p?atnicz?.")
zap=nil
end
triggerClientEvent(client,"panelBanku_c",resourceRoot,"odswiezPanel",getElementData(client,"bank:karta"))
elseif cmd=="przelewaniePieniedzy" then
local odbiorca=exports["DB2"]:pobierzWyniki("SELECT login FROM pystories_users WHERE id=? LIMIT 1",d)
if odbiorca then
local kwota=d2
kwota=(kwota)
triggerClientEvent(client,"panelBanku_c",resourceRoot,"przelewaniePieniedzy_2",odbiorca.login,kwota,d)
else outputChatBox("Nie znaleziono gracza w bazie danych o takim ID.",client) end
elseif cmd=="przelewaniePieniedzy_2" then
local kwota=d3
local zap=exports["DB2"]:pobierzWyniki("SELECT bank_money FROM pystories_users WHERE id=?",getElementData(client,"player:sid"))
if zap.bank_money>=kwota then
if not ifMandaty(client) then
exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money-? WHERE id=? LIMIT 1",kwota,getElementData(client,"player:sid"))
exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money+? WHERE id=? LIMIT 1",kwota,d)
--exports["es-logi"]:outputUcho("BANK PRZELEW: "..getPlayerName(client).." do DBIDu: "..d.." kwota: "..string.format("%.2f",kwota/100).." PLN")
if kwota then exports["pystories-db"]:dbSet("INSERT INTO psrpg_przelewy_bank SET typ=?,dbid_o=?,nadawca=?,dbid_n=?,odbiorca=?,kwota=?, data=NOW()","przelew",getElementData(client,"player:sid"),getPlayerName(client),d,d2,kwota) end
outputChatBox("Przelew wykonany pomy?lnie.",client)
else outputChatBox("Bank wstrzyma? tw?j przelew, poniewa? masz nieop?acone mandaty.",client) end
else outputChatBox("Brak wystarczaj?cej ilo?ci ?rodk?w na koncie.",client) end
local zap=exports["DB2"]:pobierzWyniki("SELECT bank_money FROM pystories_users WHERE id=?",getElementData(client,"player:sid"))
triggerClientEvent(client,"panelBanku_c",resourceRoot,"odswiezPanel",zap.bank_money)
elseif cmd=="przelewaniePieniedzy_3" then
local odbiorca=exports["DB2"]:pobierzWyniki("SELECT nazwa FROM es_biznesy_stacje_paliw WHERE id=? LIMIT 1",d)
if odbiorca then
local kwota=d2
kwota=(kwota)
triggerClientEvent(client,"panelBanku_c",resourceRoot,"przelewaniePieniedzy_4",odbiorca.nazwa,kwota,d)
else outputChatBox("Nie znaleziono biznesu w bazie danych o takim ID.",client) end
elseif cmd=="przelewaniePieniedzy_4" then
local kwota=d3
local zap=exports["DB2"]:pobierzWyniki("SELECT bank_money FROM pystories_users WHERE id=?",getElementData(client,"player:sid"))
if zap.kasa_bank>=kwota then
if not ifMandaty(client) then
exports["pystories-db"]:dbSet("UPDATE pystories_users SET bank_money=bank_money-? WHERE id=? LIMIT 1",kwota,getElementData(client,"player:sid"))
exports["pystories-db"]:dbSet("UPDATE es_biznesy_stacje_paliw SET kasa=kasa+? WHERE id=? LIMIT 1",kwota,d)
exports["pystories-db"]:dbSet("INSERT INTO es_biznesy_stacje_paliw_historia SET bid=?,typ=?,data=NOW(),operacja=?",d,"zarobek",kwota,getPlayerName(client))
--exports["es-logi"]:outputUcho("BANK PRZELEW BIZNES: "..getPlayerName(client).." do biznesu: "..d2.."[ID:"..d.."] kwota: "..string.format("%.2f",kwota/100).." PLN")
if kwota>=10000 then exports["pystories-db"]:dbSet("INSERT INTO psrpg_przelewy_bank SET typ=?,dbid_o=?,nadawca=?,dbid_n=?,odbiorca=?,kwota=?","przelew",getElementData(client,"player:sid"),getPlayerName(client),d,d2,kwota) end
exports["es-komunikaty"]:komunikat("Przelew wykonany pomy?lnie.",client)
else exports["es-komunikaty"]:komunikat("Bank wstrzyma? tw?j przelew, poniewa? masz nieop?acone mandaty.",client) end
else exports["es-komunikaty"]:komunikat("Brak wystarczaj?cej ilo?ci ?rodk?w na koncie.",client) end
local zap=exports["pystories-db"]:dbSet("SELECT bank_money FROM pystories_users WHERE id=?",getElementData(client,"player:sid"))
triggerClientEvent(client,"panelBanku_c",resourceRoot,"odswiezPanel",zap.kasa_ban)
elseif cmd=="pobierzHistorie" then
local zap=exports["pystories-db"]:dbSet("SELECT * FROM psrpg_przelewy_bank WHERE dbid_n=? OR dbid_o=? ORDER BY data DESC",getElementData(client,"player:sid"),getElementData(client,"player:sid"))
if not zap then return end
triggerClientEvent(client,"panelBanku_c",resourceRoot,"pobierzHistorie",zap)
zap=nil
end
end)