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

Wysłany: 2020-08-07, 21:43


xyzzzikk

.gg






Wiek: 18
Na forum: 2774 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6499

Respekt: 30,5

Czesc, mam problem z bankomatami, tzn. wp?acaj? pieni?dze na konto lecz nie ma ich na koncie, kod:

s.lua
--[[
Skrypt zostawykonany 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.151.15)
    local obj createObject(2942v[1]-0.05v[2]+0.05v[3]-0.400v[4])

    local blip createBlip(v[1], v[2], v[3], 012551500)
    setBlipVisibleDistance(blip500)

    if v[5then
        setElementDimension(objv[5])
        setElementDimension(cspv[5])
    end
end

function getBankMoney(player)
    local q db:dbGet('select * from pystories_users where login=? limit 1'getPlayerName(player))
    if 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 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 and #q > 0 then
        return q[1]['konto_bankowe']
    end
    return 0
end

addEventHandler('onColShapeHit'resourceRoot, function(hitdim)
    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'resourceRootgetBankMoney(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
        moneystring.gsub(money'^(-?%d+)(%d%d%d)''%1,%2')
        if == 0 then
            break
        end
    end
    return money
end

addEvent('bankomat:akcja'true)
addEventHandler('bankomat:akcja'resourceRoot, function(actionmoneylogin)
    if action == 'WPLAC' then
        if string.len(money) < 1 then
            noti:addNotification(client'Najpierw wprowad? sum?.''error')
            return
        elseif string.len(money) > 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(clientmoney)
            db:dbSet('update pystories_users set bank_money=bank_money+?, money=? where login=?'moneygetPlayerMoney(client), getPlayerName(client))
            duty:addLogs('przelew'formatMoney(money)..'$'client'WPLATA')
            triggerClientEvent(client'update:saldo'resourceRootgetBankMoney(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) > 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(clientmoney)
            db:dbSet('update pystories_users set bank_money=bank_money-?, money=? where login=?'moneygetPlayerMoney(client), getPlayerName(client))
            duty:addLogs('przelew'formatMoney(money)..'$'client'WYPLATA')
            triggerClientEvent(client'update:saldo'resourceRootgetBankMoney(client))
        else
            noti:addNotification(client'Brak wystarczaj?cych ?rodk?w.''error')
        end
    end
end)


c.lua
--[[
Skrypt zostawykonany 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 dxLibary exports['dxLibaryWest']
local anim exports['anim']

local swsh guiGetScreenSize()
local scale Vector2(sw 1920 and math.min(21920 sw) or 1sh 1080 and math.min(21080 sh) or 1)

local tick getTickCount()
local type 'join'
local lived false

function isMouseIn(xywh)
    if not isCursorShowing() then return end

    local pos = {getCursorPosition()}
    pos[1],pos[2] = (pos[1]*sw),(pos[2]*sh)

    if pos[1] >= and pos[1] <= (x+w) and pos[2] >= and pos[2] <= (y+hthen
        return true
    end
    return false
end

local bankomat = {
    saldo 0,
    icon dxLibary:createTexture(':pystories-bankomaty/images/w-icon.png''dxt5'false'clamp'),
    code 'math.random(0,99)',
    balance 0,
}

function formatMoney(money)
    while true do
        moneystring.gsub(money'^(-?%d+)(%d%d%d)''%1,%2')
        if == 0 then
            break
        end
    end
    return money
end

function guiBankomat()
    if type == 'join' then
        a,lived anim:animation(tick0255500'Linear')
        a2 anim:animation(tick0230500'Linear')
    elseif type == 'quit' then
        a,lived anim:animation(tick2550250'Linear')
        a2 anim:animation(tick2300250'Linear')

        if not lived then
            removeEventHandler('onClientRender'rootguiBankomat)
        end
    end
     
    local siddgracz getElementData(localPlayer"player:sid")
    local srl getPlayerSerial(localPlayer)
    dxLibary:dxLibary_createWindowAlpha(606/scale.x244/scale.y709/scale.x593/scale.ya)

    dxDrawImage(600/scale.x200/scale.y45/scale.x33/scale.ybankomat['icon'], 000tocolor(255255255a), false)
    dxLibary:dxLibary_text('WestBank'650/scale.x184/scale.y819/scale.x234/scale.ytocolor(237237237a), 10'default''left''bottom'falsefalsefalsefalsefalse)

    dxLibary:dxLibary_text(getPlayerName(localPlayer), 637/scale.x244/scale.y819/scale.x294/scale.ytocolor(237237237a), 6'default''left''bottom'falsefalsefalsetruefalse)
    dxLibary:dxLibary_text('W?A?CICIEL KARTY'637/scale.x294/scale.y768/scale.x319/scale.ytocolor(237237237a), 1'default''left''top'falsefalsefalsefalsefalse)

    dxLibary:dxLibary_text(''..siddgracz..'9162'..siddgracz..' 2020'637/scale.x334/scale.y819/scale.x384/scale.ytocolor(237237237a), 6'default''left''bottom'falsefalsefalsefalsefalse)
    dxLibary:dxLibary_text('NUMER KARTY'637/scale.x384/scale.y768/scale.x409/scale.ytocolor(237237237a), 1'default''left''top'falsefalsefalsefalsefalse)

    dxLibary:dxLibary_createButtonAlpha('Wp?a?'629/scale.x650/scale.y215/scale.x50/scale.y3a2)
    dxLibary:dxLibary_createButtonAlpha('Wyp?a?'629/scale.x707/scale.y215/scale.x50/scale.y3a2)
    dxLibary:dxLibary_createButtonAlpha('Anuluj'629/scale.x765/scale.y215/scale.x50/scale.y3a2)

    dxLibary:dxLibary_text('$'..formatMoney(getPlayerMoney(localPlayer)), 1002/scale.x265/scale.y1128/scale.x305/scale.ytocolor(02550a), 8'default''center''center'falsefalsefalsefalsefalse)
    dxLibary:dxLibary_text('$'..formatMoney(bankomat['saldo']), 1157/scale.x265/scale.y1283/scale.x305/scale.ytocolor(0100255a), 8'default''center''center'falsefalsefalsefalsefalse)
    dxLibary:dxLibary_text('GOT?WKA'1002/scale.x300/scale.y1128/scale.x328/scale.ytocolor(237237237a), 1'default''center''top'falsefalsefalsefalsefalse)
    dxLibary:dxLibary_text('SALDO BANKOWE'1157/scale.x300/scale.y1283/scale.x328/scale.ytocolor(237237237a), 1'default''center''top'falsefalsefalsefalsefalse)

    dxDrawRectangle(1012/scale.x347/scale.y261/scale.x54/scale.ytocolor(303030a), false)
    dxLibary:dxLibary_text('$'1022/scale.x347/scale.y1114/scale.x401/scale.ytocolor(0100255a), 8'default''left''center'falsefalsefalsefalsefalse)
    dxLibary:dxLibary_text(bankomat['balance'], 1171/scale.x347/scale.y1263/scale.x401/scale.ytocolor(207206206a), 8'default''right''center'falsefalsefalsefalsefalse)

    for 1,do
        local sX 0
        local sY 75/scale.* (1)

        if >= and <= 6 then
            sX 75/scale.y
            sY 75/scale.* (4)
        elseif >= and <= 9 then
            sX = (75 2)/scale.y
            sY 75/scale.* (7)
        end

        dxDrawRectangle(1033/scale.sY420/scale.sX64/scale.x64/scale.ytocolor(303030a), false)
        dxLibary:dxLibary_text(i1033/scale.sY420/scale.sX64/scale.1033/scale.sY64/scale.420/scale.sXtocolor(207206206a), 5'default''center''center'falsefalsefalsefalsefalse)
    end

    local sX = (75 3)/scale.y
    dxDrawRectangle(1033/scale.x420/scale.sX64/scale.x64/scale.ytocolor(303030a), false)
    dxLibary:dxLibary_text('0'1033/scale.x420/scale.sX64/scale.1033/scale.x64/scale.420/scale.sXtocolor(207206206a), 5'default''center''center'falsefalsefalsefalsefalse)

    local sY 75/scale.x
    dxDrawRectangle(1033/scale.sY420/scale.sX64/scale.x64/scale.ytocolor(303030a), false)
    dxLibary:dxLibary_text('C'1033/scale.sY420/scale.sX64/scale.1033/scale.sY64/scale.420/scale.sXtocolor(207206206a), 5'default''center''center'falsefalsefalsefalsefalse)

    local sY = (75 2)/scale.x
    dxDrawRectangle(1033/scale.sY420/scale.sX64/scale.x64/scale.ytocolor(303030a), false)
    dxLibary:dxLibary_text('&#8592;'1033/scale.sY420/scale.sX64/scale.1033/scale.sY64/scale.420/scale.sXtocolor(207206206a), 5'default''center''center'falsefalsefalsefalsefalse)
end

function key(keypress)
    if press then
        if tonumber(key) and tonumber(key) >= and tonumber(key) <= 9 then
            if tonumber(bankomat['balance']) == 0 then
                bankomat['balance'] = ''
            end

            if bankomat['balance']:len() < 8 then
                bankomat['balance'] = bankomat['balance'] .. tonumber(key)
            end
        elseif key == 'backspace' then
            bankomat['balance'] = string.sub(bankomat['balance'], 1string.len(bankomat['balance']) - 1)

            if bankomat['balance'] == '' then
                bankomat['balance'] = 0
            end
        elseif key == 'c' then
            bankomat['balance'] = 0
        end
    end
end

function clicked(btnstate)
    if btn ~= 'state' and state ~= 'down' then return end

    for 1,do
        local sX 0
        local sY 75/scale.* (1)

        if >= and <= 6 then
            sX 75/scale.y
            sY 75/scale.* (4)
        elseif >= and <= 9 then
            sX = (75 2)/scale.y
            sY 75/scale.* (7)
        end

        if isMouseIn(1033/scale.sY420/scale.sX64/scale.x64/scale.ythen
            if tonumber(bankomat['balance']) == 0 then
                bankomat['balance'] = ''
            end

            if bankomat['balance']:len() < 8 then
                bankomat['balance'] = bankomat['balance'] .. i
            end
        end
    end

    local sX = (75 3)/scale.y
    local sY 75/scale.x
    local _sY = (75 2)/scale.x
    if isMouseIn(1033/scale.x420/scale.sX64/scale.x64/scale.ythen
        if tonumber(bankomat['balance']) == 0 then
            bankomat['balance'] = ''
        end

        if bankomat['balance']:len() < and tonumber(bankomat['balance']) ~= 0 then
            bankomat['balance'] = bankomat['balance'] .. '0'
        end
    elseif isMouseIn(1033/scale.sY420/scale.sX64/scale.x64/scale.ythen
        bankomat['balance'] = 0
    elseif isMouseIn(1033/scale._sY420/scale.sX64/scale.x64/scale.ythen
        bankomat['balance'] = string.sub(bankomat['balance'], 1string.len(bankomat['balance']) - 1)

        if bankomat['balance'] == '' then
            bankomat['balance'] = 0
        end
    elseif isMouseIn(629/scale.x765/scale.y215/scale.x50/scale.ythen
        type 'quit'
        tick getTickCount()
        setElementFrozen(localPlayerfalse)
        showChat(true)
        showCursor(false)
        removeEventHandler('onClientClick'rootclicked)
        removeEventHandler('onClientKey'rootkey)
        setElementData(localPlayer'grey_shader'0)
        setElementData(localPlayer'pokaz:hud'true)
        guiSetInputEnabled(false)
    elseif isMouseIn(1183/scale.35/scale.x646/scale.y64/scale.20/scale.x35/scale.ythen
        bankomat['balance'] = string.sub(bankomat['balance'], 1string.len(bankomat['balance'])-1)

        if bankomat['balance'] == '' then
            bankomat['balance'] = 0
        end
    elseif isMouseIn(1033/scale.15/scale.x646/scale.y64/scale.20/scale.x35/scale.ythen
        bankomat['balance'] = 0
    elseif isMouseIn(629/scale.x650/scale.y215/scale.x50/scale.ythen
        triggerServerEvent('bankomat:akcja'resourceRoot'WPLAC'tonumber(bankomat['balance']), false)
    elseif isMouseIn(629/scale.x707/scale.y215/scale.x50/scale.ythen
        triggerServerEvent('bankomat:akcja'resourceRoot'WYPLAC'tonumber(bankomat['balance']), false)
    end
end

addEvent('goBankomat'true)
addEventHandler('goBankomat'resourceRoot, function(money)
    if lived then return end

    if money then
        bankomat['saldo'] = money
    end

    addEventHandler('onClientRender'rootguiBankomat)
    setElementData(localPlayer'grey_shader'1)
    setElementData(localPlayer'pokaz:hud'false)
    setElementFrozen(localPlayertrue)
    addEventHandler('onClientClick'rootclicked)
    addEventHandler('onClientKey'rootkey)
    showChat(false)
    showCursor(true)
    tick getTickCount()
    type 'join'

    guiSetInputEnabled(true)

    if bankomat['code'] == '?' then
        bankomat['code'] = getPlayerName(localPlayer)--string.sub(getPlayerSerial(localPlayer), 14)..' '..string.sub(getElementData(localPlayer'player:registerdate'), 14)..' '..string.format('%04d'string.sub(getElementData(localPlayer'player:sid'), 14))..' 2020'
    end

    bankomat['balance'] = 0
end)

addEvent('update:saldo'true)
addEventHandler('update:saldo'resourceRoot, function(saldo)
    bankomat['saldo'] = saldo
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-07, 22:53


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Kolumny w bazie i element daty lub nazwa gracza si? zgadza? B??dy db3?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-07, 23:06


xyzzzikk

.gg






Wiek: 18
Na forum: 2774 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6499

Respekt: 30,5

"Wilq" napisał/a:

Kolumny w bazie i element daty lub nazwa gracza si? zgadza? B??dy db3?


Tak, zgadzaj? si? a b??d?w w DB3 nie ma

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-07, 23:10


Wilq







Wiek: 24
Na forum: 4428 dni
Posty: 3410

Piwa: 739

Respekt: 1225,8
Respekt: 1225,8

Pieni?dze dodaj? si? do kolumny bank_money, a nie ma ich w kolumnie money (lub vice versa)?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-07, 23:21


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Znajdz sobie i sprobuj podmienic ten u?amek kodu


if getPlayerMoney(source) >= tonumber(moneythen
    noti:addNotification(source'Pomy?lnie wp?acono '..formatMoney(money)..'$ na konto bankowe.''success')
    takePlayerMoney(sourcetonumber(money))
    db:dbSet('UPDATE pystories_users SET bank_money=bank_money+?, money=? WHERE login=?'tonumber(money), getPlayerMoney(source), getPlayerName(source))
    duty:addLogs('przelew'formatMoney(money)..'$'source'WPLATA')
    triggerClientEvent(source'update:saldo'resourceRootgetBankMoney(source))
else
    noti:addNotification(source'Brak wystarczaj?cych ?rodk?w.''error')
end


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-08, 12:15


xyzzzikk

.gg






Wiek: 18
Na forum: 2774 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6499

Respekt: 30,5

"Wilq" napisał/a:

Pieni?dze dodaj? si? do kolumny bank_money, a nie ma ich w kolumnie money (lub vice versa)?

S? w kolumnie money, ale nie ma w bank_money,


"Shuffle" napisał/a:

if getPlayerMoney(source) >= tonumber(money) then
noti:addNotification(source, 'Pomy?lnie wp?acono '..formatMoney(money)..'$ na konto bankowe.', 'success')
takePlayerMoney(source, tonumber(money))
db:dbSet('UPDATE pystories_users SET bank_money=bank_money+?, money=? WHERE login=?', tonumber(money), getPlayerMoney(source), getPlayerName(source))
duty:addLogs('przelew', formatMoney(money)..'$', source, 'WPLATA')
triggerClientEvent(source, 'update:saldo', resourceRoot, getBankMoney(source))
else
noti:addNotification(source, 'Brak wystarczaj?cych ?rodk?w.', 'error')
end


Da?em to, i potym nawet wp?acanie nie dzia?a, a wczesniej wp?aca?o ale nie by?o tego w banku.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-08, 13:38


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

Dobra widz? ju? b??d za chwile ci podesle kod.

[ Dodano: 2020-08-08, 13:40 ]
Podmien i testuj

--[[
Skrypt zostawykonany 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.151.15)
    local obj createObject(2942v[1]-0.05v[2]+0.05v[3]-0.400v[4])

    local blip createBlip(v[1], v[2], v[3], 012551500)
    setBlipVisibleDistance(blip500)

    if v[5then
        setElementDimension(objv[5])
        setElementDimension(cspv[5])
    end
end

function getBankMoney(player)
    local q db:dbGet('select * from pystories_users where login=? limit 1'getPlayerName(player))
    if 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 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 and #q > 0 then
        return q[1]['konto_bankowe']
    end
    return 0
end

addEventHandler('onColShapeHit'resourceRoot, function(hitdim)
    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'resourceRootgetBankMoney(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
        moneystring.gsub(money'^(-?%d+)(%d%d%d)''%1,%2')
        if == 0 then
            break
        end
    end
    return money
end

addEvent('bankomat:akcja'true)
addEventHandler('bankomat:akcja'resourceRoot, function(actionmoneylogin)
    if action == 'WPLAC' then
        if string.len(money) < 1 then
            noti:addNotification(client'Najpierw wprowad? sum?.''error')
            return
        elseif string.len(money) > 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(clientmoney)
            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=?'bankgetPlayerMoney(client), getPlayerName(client))
            duty:addLogs('przelew'formatMoney(money)..'$'client'WPLATA')
            triggerClientEvent(client'update:saldo'resourceRootgetBankMoney(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) > 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(clientmoney)
            db:dbSet('update pystories_users set bank_money=bank_money-?, money=? where login=?'moneygetPlayerMoney(client), getPlayerName(client))
            duty:addLogs('przelew'formatMoney(money)..'$'client'WYPLATA')
            triggerClientEvent(client'update:saldo'resourceRootgetBankMoney(client))
        else
            noti:addNotification(client'Brak wystarczaj?cych ?rodk?w.''error')
        end
    end
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-08, 20:51


xyzzzikk

.gg






Wiek: 18
Na forum: 2774 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6499

Respekt: 30,5

"Shuffle" napisał/a:

Dobra widz? ju? b??d za chwile ci podesle kod.

[ Dodano: 2020-08-08, 13:40 ]
Podmien i testuj

--[[
Skrypt zostawykonany 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.151.15)
    local obj createObject(2942v[1]-0.05v[2]+0.05v[3]-0.400v[4])

    local blip createBlip(v[1], v[2], v[3], 012551500)
    setBlipVisibleDistance(blip500)

    if v[5then
        setElementDimension(objv[5])
        setElementDimension(cspv[5])
    end
end

function getBankMoney(player)
    local q db:dbGet('select * from pystories_users where login=? limit 1'getPlayerName(player))
    if 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 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 and #q > 0 then
        return q[1]['konto_bankowe']
    end
    return 0
end

addEventHandler('onColShapeHit'resourceRoot, function(hitdim)
    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'resourceRootgetBankMoney(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
        moneystring.gsub(money'^(-?%d+)(%d%d%d)''%1,%2')
        if == 0 then
            break
        end
    end
    return money
end

addEvent('bankomat:akcja'true)
addEventHandler('bankomat:akcja'resourceRoot, function(actionmoneylogin)
    if action == 'WPLAC' then
        if string.len(money) < 1 then
            noti:addNotification(client'Najpierw wprowad? sum?.''error')
            return
        elseif string.len(money) > 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(clientmoney)
            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=?'bankgetPlayerMoney(client), getPlayerName(client))
            duty:addLogs('przelew'formatMoney(money)..'$'client'WPLATA')
            triggerClientEvent(client'update:saldo'resourceRootgetBankMoney(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) > 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(clientmoney)
            db:dbSet('update pystories_users set bank_money=bank_money-?, money=? where login=?'moneygetPlayerMoney(client), getPlayerName(client))
            duty:addLogs('przelew'formatMoney(money)..'$'client'WYPLATA')
            triggerClientEvent(client'update:saldo'resourceRootgetBankMoney(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.

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-08, 21:32


MeeShuffle

Programista/Grafik






Wiek: 32
Na forum: 4394 dni
Posty: 2758
Nick w MP: Shuffle

Piwa: 8575

Respekt: 535,3
Respekt: 535,3

1. Sprawdz przez outputchatbox/print co zwraca zmienna "bank" ktora ci dalem.
2. Sprawdz czy typ tabeli bank_money to INTEGER

Postaw piwo autorowi tego posta
 

 
Wysłany: 2020-08-08, 21:38


xyzzzikk

.gg






Wiek: 18
Na forum: 2774 dni
Posty: 175
Nick w MP: aspyk

Piwa: 6499

Respekt: 30,5

Troche poszpera?em, i b??d naprawi?em ten b??d, do zamkni?cia

Postaw piwo autorowi tego posta
 

 
Tagi: bankomaty
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA » Bankomaty 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