--[[
Skrypt zosta? wykonany przez:
-Asper (nezymr69@gmail.com).
Na potrzeby serwera:
-WestRPG (2018).
Jedyne i wy??czone prawo do u?ywania kodu ma serwer WestRPG oraz autor skryptu. (Asper)
]]
local db = exports['pystories-db']
local noti = exports['n_noti']
local duty = exports['pystories-admin']
local bankomaty = {
{1254.51,740.46,10.82},
}
for i,v in ipairs(bankomaty) do
local csp = createColSphere(v[1], v[2], v[3]-0.15, 1.15)
local obj = createObject(2942, v[1]-0.05, v[2]+0.05, v[3]-0.4, 0, 0, v[4])
local blip = createBlip(v[1], v[2], v[3], 0, 1, 255, 150, 0)
setBlipVisibleDistance(blip, 500)
if v[5] then
setElementDimension(obj, v[5])
setElementDimension(csp, v[5])
end
end
function getBankMoney(player)
local q = db:dbGet('select * from pystories_users where login=? limit 1', getPlayerName(player))
if q and #q > 0 then
return q[1]['bank_money']
end
return 0
end
function getNewsPay(player)
local q = db:dbGet('select * from pystories_users where login=? limit 1', getPlayerName(player))
if q and #q > 0 then
return q[1]['nowe_przelewy']
end
return 0
end
function getBankAccount(player)
local q = db:dbGet('select * from pystories_users where login=? limit 1', getPlayerName(player))
if q and #q > 0 then
return q[1]['konto_bankowe']
end
return 0
end
addEventHandler('onColShapeHit', resourceRoot, function(hit, dim)
if not hit or hit and not isElement(hit) or hit and isElement(hit) and getElementType(hit) ~= 'player' or hit and isElement(hit) and getElementType(hit) == 'player' and isPedInVehicle(hit) or not dim then return end
if getBankAccount(hit) == 0 then
triggerClientEvent(hit, 'goBankomat', resourceRoot, getBankMoney(hit), getNewsPay(hit))
db:dbSet('update pystories_users set nowe_przelewy=0 where login=?', getPlayerName(hit))
else
noti:noti("Nie posidasz konta bankowanego.","error",3000,hit)
end
end)
function formatMoney(money)
while true do
money, i = string.gsub(money, '^(-?%d+)(%d%d%d)', '%1,%2')
if i == 0 then
break
end
end
return money
end
addEvent('bankomat:akcja', true)
addEventHandler('bankomat:akcja', resourceRoot, function(action, money, login)
if action == 'WPLAC' then
if string.len(money) < 1 then
noti:addNotification(client, 'Najpierw wprowad? sum?.', 'error')
return
elseif string.len(money) > 8 or not tonumber(money) or tonumber(money) and tonumber(money) < 1 then
return
end
money = tonumber(money)
money = math.floor(money)
if getPlayerMoney(client) >= money then
noti:addNotification(client, 'Pomy?lnie wp?acono '..formatMoney(money)..'$ na konto bankowe.', 'success')
takePlayerMoney(client, money)
x=db:dbGet("SELECT * FROM pystories_users WHERE login=?",getPlayerName(client))
w=dbPoll(x,-1)
bank=tonumber(x[1].bank_money)+tonumber(money)
db:dbSet('update pystories_users set bank_money=?, money=? where login=?', bank, getPlayerMoney(client), getPlayerName(client))
duty:addLogs('przelew', formatMoney(money)..'$', client, 'WPLATA')
triggerClientEvent(client, 'update:saldo', resourceRoot, getBankMoney(client))
else
noti:addNotification(client, 'Brak wystarczaj?cych ?rodk?w.', 'error')
end
elseif action == 'WYPLAC' then
if string.len(money) < 1 then
noti:addNotification(client, 'Najpierw wprowad? sum?.', 'error')
return
elseif string.len(money) > 8 or not tonumber(money) or tonumber(money) and tonumber(money) < 1 then
return
end
money = tonumber(money)
money = math.floor(money)
if getBankMoney(client) >= money then
noti:addNotification(client, 'Pomy?lnie wyp?acono '..formatMoney(money)..'$ z konta bankowego.', 'success')
givePlayerMoney(client, money)
db:dbSet('update pystories_users set bank_money=bank_money-?, money=? where login=?', money, getPlayerMoney(client), getPlayerName(client))
duty:addLogs('przelew', formatMoney(money)..'$', client, 'WYPLATA')
triggerClientEvent(client, 'update:saldo', resourceRoot, getBankMoney(client))
else
noti:addNotification(client, 'Brak wystarczaj?cych ?rodk?w.', 'error')
end
end
end)
--[[
Skrypt zosta? wykonany przez:
-Asper (nezymr69@gmail.com).
Na potrzeby serwera:
-WestRPG (2018).
Jedyne i wy??czone prawo do u?ywania kodu ma serwer WestRPG oraz autor skryptu. (Asper)
]]
local db = exports['pystories-db']
local noti = exports['n_noti']
local duty = exports['pystories-admin']
local bankomaty = {
{1254.51,740.46,10.82},
}
for i,v in ipairs(bankomaty) do
local csp = createColSphere(v[1], v[2], v[3]-0.15, 1.15)
local obj = createObject(2942, v[1]-0.05, v[2]+0.05, v[3]-0.4, 0, 0, v[4])
local blip = createBlip(v[1], v[2], v[3], 0, 1, 255, 150, 0)
setBlipVisibleDistance(blip, 500)
if v[5] then
setElementDimension(obj, v[5])
setElementDimension(csp, v[5])
end
end
function getBankMoney(player)
local q = db:dbGet('select * from pystories_users where login=? limit 1', getPlayerName(player))
if q and #q > 0 then
return q[1]['bank_money']
end
return 0
end
function getNewsPay(player)
local q = db:dbGet('select * from pystories_users where login=? limit 1', getPlayerName(player))
if q and #q > 0 then
return q[1]['nowe_przelewy']
end
return 0
end
function getBankAccount(player)
local q = db:dbGet('select * from pystories_users where login=? limit 1', getPlayerName(player))
if q and #q > 0 then
return q[1]['konto_bankowe']
end
return 0
end
addEventHandler('onColShapeHit', resourceRoot, function(hit, dim)
if not hit or hit and not isElement(hit) or hit and isElement(hit) and getElementType(hit) ~= 'player' or hit and isElement(hit) and getElementType(hit) == 'player' and isPedInVehicle(hit) or not dim then return end
if getBankAccount(hit) == 0 then
triggerClientEvent(hit, 'goBankomat', resourceRoot, getBankMoney(hit), getNewsPay(hit))
db:dbSet('update pystories_users set nowe_przelewy=0 where login=?', getPlayerName(hit))
else
noti:noti("Nie posidasz konta bankowanego.","error",3000,hit)
end
end)
function formatMoney(money)
while true do
money, i = string.gsub(money, '^(-?%d+)(%d%d%d)', '%1,%2')
if i == 0 then
break
end
end
return money
end
addEvent('bankomat:akcja', true)
addEventHandler('bankomat:akcja', resourceRoot, function(action, money, login)
if action == 'WPLAC' then
if string.len(money) < 1 then
noti:addNotification(client, 'Najpierw wprowad? sum?.', 'error')
return
elseif string.len(money) > 8 or not tonumber(money) or tonumber(money) and tonumber(money) < 1 then
return
end
money = tonumber(money)
money = math.floor(money)
if getPlayerMoney(client) >= money then
noti:addNotification(client, 'Pomy?lnie wp?acono '..formatMoney(money)..'$ na konto bankowe.', 'success')
takePlayerMoney(client, money)
x=db:dbGet("SELECT * FROM pystories_users WHERE login=?",getPlayerName(client))
w=dbPoll(x,-1)
bank=tonumber(x[1].bank_money)+tonumber(money)
db:dbSet('update pystories_users set bank_money=?, money=? where login=?', bank, getPlayerMoney(client), getPlayerName(client))
duty:addLogs('przelew', formatMoney(money)..'$', client, 'WPLATA')
triggerClientEvent(client, 'update:saldo', resourceRoot, getBankMoney(client))
else
noti:addNotification(client, 'Brak wystarczaj?cych ?rodk?w.', 'error')
end
elseif action == 'WYPLAC' then
if string.len(money) < 1 then
noti:addNotification(client, 'Najpierw wprowad? sum?.', 'error')
return
elseif string.len(money) > 8 or not tonumber(money) or tonumber(money) and tonumber(money) < 1 then
return
end
money = tonumber(money)
money = math.floor(money)
if getBankMoney(client) >= money then
noti:addNotification(client, 'Pomy?lnie wyp?acono '..formatMoney(money)..'$ z konta bankowego.', 'success')
givePlayerMoney(client, money)
db:dbSet('update pystories_users set bank_money=bank_money-?, money=? where login=?', money, getPlayerMoney(client), getPlayerName(client))
duty:addLogs('przelew', formatMoney(money)..'$', client, 'WYPLATA')
triggerClientEvent(client, 'update:saldo', resourceRoot, getBankMoney(client))
else
noti:addNotification(client, 'Brak wystarczaj?cych ?rodk?w.', 'error')
end
end
end)
Tak jak na pocz?tku, zabiera pieni?dze lecz nie dodaje do banku.
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