View difference between Paste ID: LWNaBRDf and v84Q9wC1
SHOW: | | - or go back to the newest paste.
1-
-- BANCOMAT V2 aggiornato 2025 copyright lego11
1+
--BANCOMAT DIAMANTE V2 copyright lego11
2
--VARIABILI
3
local lbl = "BN Credit"
4-
function clear()
4+
5-
    term.clear()
5+
6-
    term.setCursorPos(1, 1)
6+
function clear() 
7
term.clear()
8
term.setCursorPos(1,1)
9
end
10-
    clear()
10+
11-
    print("Errore di verifica del PIN")
11+
12-
    print("")
12+
13-
    print("Premere un tasto per uscire")
13+
print("Errore di verifica del PIN")
14-
    os.pullEvent("key")
14+
15-
    os.reboot()
15+
print("Premere un tasto per uscire")
16
os.pullEvent("key")
17
os.reboot()
18
end
19-
    clear()
19+
20-
    print("Carta non valida o corrotta.")
20+
21-
    print("")
21+
22-
    print("Premere un tasto per uscire")
22+
23-
    os.pullEvent("key")
23+
print("Carta non valida o corrotta.")
24-
    os.reboot()
24+
25
print("Premere un tasto per uscire")
26
os.pullEvent("key")
27
os.reboot()
28-
    clear()
28+
29-
    print("Carta smagnetizzata o vuota.")
29+
30-
    print("")
30+
31-
    print("Premere un tasto per uscire")
31+
32-
    os.pullEvent("key")
32+
print("Carta smagnetizzata o vuota.")
33-
    os.reboot()
33+
34
print("Premere un tasto per uscire")
35
os.pullEvent("key")
36-
function cartaNoSIB()
36+
37-
    clear()
37+
38-
    print("Carta non in sistema interbancario.")
38+
39-
    print("")
39+
function preleva()
40-
    print("Premere un tasto per uscire")
40+
tabr.t = tab.t
41-
    os.pullEvent("key")
41+
tabr.e = tab.e
42-
    os.reboot()
42+
tabr.p = tab.p
43
tabr.v = tostring(credito - prelievo)
44
45-
function sibFail()
45+
ncr = textutils.serialize(tabr)
46-
    clear()
46+
47-
    print("Errore connessione sistema interbancario")
47+
48-
    print("")
48+
m.beginWrite(ncr,lbl)
49-
    print("Premere un tasto per uscire")
49+
os.pullEvent("mag_write_done")
50-
    os.pullEvent("key")
50+
51-
    os.reboot()
51+
52
53
54-
function cartaVecchia()
54+
m = peripheral.wrap("right") 
55-
    clear()
55+
56-
    print("CARTA NON SICURA. Convertire la carta presso lo sportello situato in:\n")
56+
57-
    print("\n Banco di Nebraska - P.zza Affari 3, New Radeon")
57+
58-
    print("")
58+
59-
    print("Premere un tasto per uscire")
59+
60-
    os.pullEvent("key")
60+
61-
    os.reboot()
61+
62
print("Inserire la carta")
63
m.setInsertCardLight(true)
64-
function preleva(prelievo, uuid)
64+
za,rawcarta = os.pullEvent("mag_swipe")
65-
    clear()
65+
66-
    erogati = 0
66+
67-
    sibRaw = http.get("http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=addebito&valore=" .. prelievo ..
67+
68-
                          "&uuid=" .. uuid).readAll()
68+
cartaVuota()
69-
    sib = textutils.unserialize(sibRaw)
69+
70
71-
    if type(sib) ~= "table" then
71+
72-
        print("\n\n\nImpossibile comunicare con il server interbancario")
72+
73-
        sleep(5)
73+
74-
        os.reboot()
74+
cartaNonValida()
75-
    end
75+
76
77-
    if sib.stato == "DI" then
77+
if tab.t ~= "cc" then
78-
        print("Disponibilità insufficiente")
78+
cartaNonValida()
79-
        sleep(5)
79+
80-
    elseif sib.stato ~= "OK" then
80+
81-
        print(
81+
if tab.e ~= "BN" then 
82-
            "\n\n\nLa carta non risulta nel sistema interbancario, potrebbe essere stata disabilitata per uso fraudolento")
82+
cartaNonValida()
83-
        sleep(5)
83+
84-
        os.reboot()
84+
85-
    else
85+
if tab.p ~= "0000" then
86-
        print("Ritirare il denaro")
86+
87-
        print("")
87+
print("Inserire il PIN e premere ENTER")
88-
        for i = prelievo, 1, -64 do
88+
89-
            redstone.setOutput("bottom", true)
89+
local pinUtente = read("#")
90-
            sleep(0.25)
90+
if pinUtente ~= tab.p then
91-
            erogati = erogati + 64
91+
pinErrato()
92-
            print("Erogati " .. erogati .. " IC")
92+
93-
            redstone.setOutput("bottom", false)
93+
94-
        end
94+
95-
        print("")
95+
credito = tonumber(tab.v)
96-
        term.setBackgroundColor(colors.white)
96+
97-
        term.setTextColor(colors.black)
97+
98-
        clear()
98+
print("La carta ha una disponibilità di "..credito.." IC.")
99-
        print("Prelievo effettuato\n")
99+
100-
        print("Tra poco sarà possibile eseguire un'altra operazione.")
100+
print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
101
print("")
102-
        term.setTextColor(colors.white)
102+
print("[1] Preleva   512 IC")
103
print("[2] Preleva  1024 IC")
104-
        shell.run("pastebin get v84Q9wC1 startup2") -- Inserire paste di nPay
104+
print("[3] Preleva  2048 IC")
105-
        if fs.exists("startup2") then
105+
print("[4] Preleva  4096 IC")
106-
            shell.run("rm startup")
106+
print("[5] Preleva 32768 IC")
107-
            shell.run("mv startup2 startup")
107+
print("[6] Cambia il PIN")
108-
        end
108+
print("[7] Esci senza prelevare")
109-
    end
109+
num=tonumber(read())
110
if num == 1 then
111
prelievo=512
112-
m = peripheral.wrap("right")
112+
if prelievo > credito then
113
clear()
114
print("Disponibilità insufficiente")
115
sleep(5)
116
os.reboot()
117
end
118
clear()
119
print("Inserire nuovamente la carta per confermare il prelievo")
120-
za, rawcarta = os.pullEvent("mag_swipe")
120+
preleva()
121
print("Ritirare il denaro")
122
print("")
123
redstone.setOutput("bottom", true)
124-
    cartaVuota()
124+
sleep(0.25)
125
print("Erogati 512 IC")
126
redstone.setOutput("bottom", false)
127
print("")
128
print("Prelievo effettuato!")
129
print("")
130-
    cartaNonValida()
130+
131
sleep(5)
132
os.reboot()
133-
if tab.t == "cc" then
133+
134-
    cartaVecchia()
134+
elseif num == 2 then
135
136
prelievo=1024
137-
if tab.t ~= "cd" then
137+
if prelievo > credito then
138-
    cartaNonValida()
138+
139
print("Disponibilità insufficiente")
140
sleep(5)
141-
if tab.e ~= "BN" then
141+
142-
    cartaNonValida()
142+
143
clear()
144
print("Inserire nuovamente la carta per confermare il prelievo")
145-
sibRaw = http.get("http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=verifica&uuid=" .. tab.v).readAll()
145+
preleva()
146-
sib = textutils.unserialize(sibRaw)
146+
print("Ritirare il denaro")
147
print("")
148-
if type(sib) ~= "table" then
148+
redstone.setOutput("bottom", true)
149-
    sibFail()
149+
sleep(0.25)
150
print("Erogati 512 IC")
151-
if sib.stato ~= "OK" then
151+
redstone.setOutput("bottom", false)
152-
    cartaNoSIB()
152+
sleep(0.25)
153
redstone.setOutput("bottom", true)
154
sleep(0.25)
155-
credito = tonumber(sib.saldo)
155+
print("Erogati 1024 IC")
156-
carta = string.sub(tostring(tab.v), -4)
156+
redstone.setOutput("bottom", false)
157
print("")
158
print("Prelievo effettuato!")
159
print("")
160
print("Tra poco sarà possibile eseguire un'altra operazione.")
161-
    print("La carta *" .. carta .. " ha una disponibilità di " .. credito .. " IC.")
161+
sleep(5)
162-
    print("")
162+
163-
    print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
163+
 
164-
    print("")
164+
elseif num == 3 then
165-
    print("[1] Preleva   64 IC")
165+
166-
    print("[2] Preleva  128 IC")
166+
prelievo=2048
167-
    print("[3] Preleva  256 IC")
167+
if prelievo > credito then
168-
    print("[4] Preleva  512 IC")
168+
169-
    print("[5] Preleva 4096 IC")
169+
print("Disponibilità insufficiente")
170-
    print("[6] Esci senza prelevare")
170+
sleep(5)
171-
    num = tonumber(read())
171+
172-
    if num == 1 then
172+
173-
        preleva(64, tab.v)
173+
174-
        break
174+
print("Inserire nuovamente la carta per confermare il prelievo")
175-
    elseif num == 2 then
175+
preleva()
176-
        preleva(128, tab.v)
176+
print("Ritirare il denaro")
177-
        break
177+
178-
    elseif num == 3 then
178+
redstone.setOutput("bottom", true)
179-
        preleva(256, tab.v)
179+
sleep(0.25)
180-
        break
180+
print("Erogati 512 IC")
181-
    elseif num == 4 then
181+
redstone.setOutput("bottom", false)
182-
        preleva(512, tab.v)
182+
sleep(0.25)
183-
        break
183+
redstone.setOutput("bottom", true)
184-
    elseif num == 5 then
184+
sleep(0.25)
185-
        preleva(4096, tab.v)
185+
print("Erogati 1024 IC")
186-
        break
186+
redstone.setOutput("bottom", false)
187-
    elseif num == 6 then
187+
sleep(0.25)
188-
        clear()
188+
redstone.setOutput("bottom", true)
189-
        break
189+
sleep(0.25)
190-
    end
190+
print("Erogati 1536 IC")
191
redstone.setOutput("bottom", false)
192
sleep(0.25)
193-
term.setBackgroundColor(colors.white)
193+
redstone.setOutput("bottom", true)
194-
term.setTextColor(colors.black)
194+
sleep(0.25)
195
print("Erogati 2048 IC")
196
redstone.setOutput("bottom", false)
197
print("")
198-
term.setTextColor(colors.white)
198+
print("Prelievo effettuato!")
199
print("")
200-
shell.run("pastebin get v84Q9wC1 startup2") -- Inserire paste di nPay
200+
201-
if fs.exists("startup2") then
201+
202-
    shell.run("rm startup")
202+
sleep(5)
203-
    shell.run("mv startup2 startup")
203+
204
205
elseif num == 4 then
206
 
207-
207+
prelievo=4096
208
if prelievo > credito then
209
clear()
210
print("Disponibilità insufficiente")
211
sleep(5)
212
os.reboot()
213
end
214
clear()
215
print("Inserire nuovamente la carta per confermare il prelievo")
216
preleva()
217
print("Ritirare il denaro")
218
print("")
219
redstone.setOutput("bottom", true)
220
sleep(0.25)
221
print("Erogati 512 IC")
222
redstone.setOutput("bottom", false)
223
sleep(0.25)
224
redstone.setOutput("bottom", true)
225
sleep(0.25)
226
print("Erogati 1024 IC")
227
redstone.setOutput("bottom", false)
228
sleep(0.25)
229
redstone.setOutput("bottom", true)
230
sleep(0.25)
231
print("Erogati 1536 IC")
232
redstone.setOutput("bottom", false)
233
sleep(0.25)
234
redstone.setOutput("bottom", true)
235
sleep(0.25)
236
print("Erogati 2048 IC")
237
redstone.setOutput("bottom", false)
238
sleep(0.25)
239
redstone.setOutput("bottom", true)
240
sleep(0.25)
241
print("Erogati 2560 IC")
242
redstone.setOutput("bottom", false)
243
sleep(0.25)
244
redstone.setOutput("bottom", true)
245
sleep(0.25)
246
print("Erogati 3072 IC")
247
redstone.setOutput("bottom", false)
248
sleep(0.25)
249
redstone.setOutput("bottom", true)
250
sleep(0.25)
251
print("Erogati 3584 IC")
252
redstone.setOutput("bottom", false)
253
sleep(0.25)
254
redstone.setOutput("bottom", true)
255
sleep(0.25)
256
print("Erogati 4096 IC")
257
redstone.setOutput("bottom", false)
258
print("")
259
print("Prelievo effettuato!")
260
print("")
261
print("Tra poco sarà possibile eseguire un'altra operazione.")
262
sleep(5)
263
os.reboot()
264
265
elseif num == 5 then
266
prelievo=32768
267
erogati = 0
268
if prelievo > credito then
269
clear()
270
print("Disponibilità insufficiente")
271
sleep(5)
272
os.reboot()
273
end
274
clear()
275
print("Inserire nuovamente la carta per confermare il prelievo")
276
preleva()
277
print("Ritirare il denaro")
278
print("")
279
for i=prelievo,512,-512 do
280
redstone.setOutput("bottom", true)
281
sleep(0.25)
282
erogati = erogati + 512
283
print("Erogati "..erogati.." IC")
284
redstone.setOutput("bottom", false)
285
end
286
print("")
287
print("Prelievo effettuato!")
288
print("")
289
print("Tra poco sarà possibile eseguire un'altra operazione.")
290
sleep(5)
291
os.reboot()
292
293
elseif num == 6 then
294
clear()
295
print("Cambio PIN della carta di credito")
296
print("")
297
print("Nota: Impostare il PIN a '0000' per disabilitarlo")
298
print("")
299
print("Inserire il PIN e premere ENTER:")
300
tab.p = read("#")
301
clear()
302
print("Inserire la carta per confermare il cambiamento")
303
prelievo=0
304
preleva()
305
print("")
306
if tab.p == "0000" then
307
print("PIN disabilitato correttamente")
308
else
309
print("PIN cambiato correttamente")
310
end
311
print("")
312
print("Premere un tasto qualsiasi per ritorare al menu' principale")
313
os.pullEvent("key")
314
elseif num == 7 then clear() break end
315
clear()
316
sleep(2)
317
clear()
318
end
319
clear()
320
print("Tra poco sarà possibile eseguire un'altra operazione.")
321
sleep(1)
322
os.reboot()