View difference between Paste ID: v84Q9wC1 and mAq32Fmi
SHOW: | | - or go back to the newest paste.
1-
--made for computercraft with immibis periherals mod
1+
-- BANCOMAT V2 aggiornato 2025 copyright lego11
2-
--(minecraft)
2+
local tabr = {}
3-
--made by dragonmaster90
3+
4-
--"rfid and magcard reader/writer"
4+
function clear()
5
    term.clear()
6-
function clear() 
6+
    term.setCursorPos(1, 1)
7-
term.clear()
7+
8-
term.setCursorPos(1,1)
8+
9
function pinErrato()
10
    clear()
11-
s = peripheral.wrap("back") --speaker
11+
    print("Errore di verifica del PIN")
12-
w = peripheral.wrap("top")  --rfid writer
12+
    print("")
13-
r = peripheral.wrap("right")--rfid reader
13+
    print("Premere un tasto per uscire")
14-
m = peripheral.wrap("left") --magcard
14+
    os.pullEvent("key")
15
    os.reboot()
16-
function sdb(db)
16+
17-
s.setAttenuation(db)
17+
18
function cartaNonValida()
19
    clear()
20
    print("Carta non valida o corrotta.")
21-
print("chose option 1,2,3,4 or 5 \n[1] write a RFID card\n[2] read all RFID cards in range\n[3] write code on a magcard\n[4] read the code of a magcard\n[5] exit")
21+
    print("")
22-
num=tonumber(read())
22+
    print("Premere un tasto per uscire")
23-
if num == 1 then
23+
    os.pullEvent("key")
24-
   if w.isPresent() == true then
24+
    os.reboot()
25-
      print("enter a code for your RFID card")
25+
26-
      c=read()
26+
27-
      print("now enter a label")
27+
function cartaVuota()
28-
      l=read()
28+
    clear()
29-
      print("encoding...")
29+
    print("Carta smagnetizzata o vuota.")
30-
      w.encode(tostring(c),tostring(l))
30+
    print("")
31-
      sdb(10)
31+
    print("Premere un tasto per uscire")
32-
      s.start(2,200)
32+
    os.pullEvent("key")
33-
      os.pullEvent("rfid_written")
33+
    os.reboot()
34-
      print("done!\nplease take out your card")
34+
35-
      s.stop(2)
35+
36-
      sdb(0)
36+
function cartaNoSIB()
37-
      s.start(1,400)
37+
    clear()
38-
      sleep(1)
38+
    print("Carta non in sistema interbancario.")
39-
      s.stop(1)
39+
    print("")
40-
      clear()
40+
    print("Premere un tasto per uscire")
41
    os.pullEvent("key")
42-
      print("no RFID card inserted")
42+
    os.reboot()
43-
      s.start(1,200)
43+
44-
      sleep(0.5)
44+
45-
      s.stop(1)
45+
function sibFail()
46-
      sleep(1)
46+
    clear()
47-
      clear()
47+
    print("Errore connessione sistema interbancario")
48
    print("")
49-
elseif num == 2 then
49+
    print("Premere un tasto per uscire")
50-
  print("scanning")
50+
    os.pullEvent("key")
51-
  r.scan(5)
51+
    os.reboot()
52-
  z,x = os.pullEvent("rfid_detected")
52+
53-
  print("scanned a RFID card with the code "..x.." on it")
53+
54-
  sleep(3)
54+
function cartaVecchia()
55-
  clear()    
55+
    clear()
56-
elseif num == 3 then
56+
    print("CARTA NON SICURA. Convertire la carta presso lo sportello situato in:\n")
57-
  print("enter a code for your magcard")
57+
    print("\n Banco di Nebraska - P.zza Affari 3, New Radeon")
58-
  la=tostring(read())
58+
    print("")
59-
  print("now enter a label")
59+
    print("Premere un tasto per uscire")
60-
  oa=tostring(read())
60+
    os.pullEvent("key")
61-
  print("now swipe your magcard on the reader (left)")
61+
    os.reboot()
62-
  m.setInsertCardLight(true)
62+
63-
  m.beginWrite(la,oa)
63+
64-
  os.pullEvent("mag_write_done")
64+
function preleva(prelievo, uuid)
65-
  print("done!")
65+
    clear()
66-
  m.setInsertCardLight(false)
66+
    erogati = 0
67-
  sdb(0)
67+
    sibRaw = http.get("http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=addebito&valore=" .. prelievo ..
68-
  s.start(1,400)
68+
                          "&uuid=" .. uuid).readAll()
69-
  sleep(1)
69+
    sib = textutils.unserialize(sibRaw)
70-
  s.stop(1)
70+
71-
  clear()
71+
    if type(sib) ~= "table" then
72-
elseif num == 4 then
72+
        print("\n\n\nImpossibile comunicare con il server interbancario")
73-
  print("scanning...")
73+
        sleep(5)
74-
  za,xa = os.pullEvent("mag_swipe")
74+
        os.reboot()
75-
  print("scanned a magcard with "..xa.." on it")
75+
76-
  s.start(1,400)
76+
77-
  sleep(0.5)
77+
    if sib.stato == "DI" then
78-
  s.stop(1)
78+
        print("Disponibilità insufficiente")
79-
  sleep(3)
79+
        sleep(5)
80-
  clear()
80+
    elseif sib.stato ~= "OK" then
81-
elseif num == 5 then clear() break end
81+
        print(
82
            "\n\n\nLa carta non risulta nel sistema interbancario, potrebbe essere stata disabilitata per uso fraudolento")
83
        sleep(5)
84-
print("bye bye!")
84+
        os.reboot()
85-
sleep(1)
85+
86-
clear()
86+
        print("Ritirare il denaro")
87
        print("")
88
        for i = prelievo, 1, -64 do
89
            redstone.setOutput("bottom", true)
90
            sleep(0.25)
91
            erogati = erogati + 64
92
            print("Erogati " .. erogati .. " IC")
93
            redstone.setOutput("bottom", false)
94
        end
95
        print("")
96
        term.setBackgroundColor(colors.white)
97
        term.setTextColor(colors.black)
98
        clear()
99
        print("Prelievo effettuato\n")
100
        print("Tra poco sarà possibile eseguire un'altra operazione.")
101
102
        term.setTextColor(colors.white)
103
104
        shell.run("pastebin get v84Q9wC1 startup2") -- Inserire paste di nPay
105
        if fs.exists("startup2") then
106
            shell.run("rm startup")
107
            shell.run("mv startup2 startup")
108
        end
109
    end
110
end
111
112
m = peripheral.wrap("right")
113
lbl = "BN Credit"
114
115
clear()
116
print("Banco di NEBRASKA - Sistema BANCOMAT(R)")
117
print("")
118
print("Inserire la carta")
119
m.setInsertCardLight(true)
120
za, rawcarta = os.pullEvent("mag_swipe")
121
m.setInsertCardLight(false)
122
123
if rawcarta == nil then
124
    cartaVuota()
125
end
126
127
tab = textutils.unserialize(rawcarta)
128
129
if type(tab) ~= "table" then
130
    cartaNonValida()
131
end
132
133
if tab.t == "cc" then
134
    cartaVecchia()
135
end
136
137
if tab.t ~= "cd" then
138
    cartaNonValida()
139
end
140
141
if tab.e ~= "BN" then
142
    cartaNonValida()
143
end
144
145
sibRaw = http.get("http://luanet.rgbcraft.com/servlets/carte_debito.php?richiesta=verifica&uuid=" .. tab.v).readAll()
146
sib = textutils.unserialize(sibRaw)
147
148
if type(sib) ~= "table" then
149
    sibFail()
150
end
151
if sib.stato ~= "OK" then
152
    cartaNoSIB()
153
end
154
155
credito = tonumber(sib.saldo)
156
carta = string.sub(tostring(tab.v), -4)
157
158
clear()
159
160
while true do
161
    print("La carta *" .. carta .. " ha una disponibilità di " .. credito .. " IC.")
162
    print("")
163
    print("Per favore scegliere un'opzione utilizzando i tasti numerici e confermare con ENTER:")
164
    print("")
165
    print("[1] Preleva   64 IC")
166
    print("[2] Preleva  128 IC")
167
    print("[3] Preleva  256 IC")
168
    print("[4] Preleva  512 IC")
169
    print("[5] Preleva 4096 IC")
170
    print("[6] Esci senza prelevare")
171
    num = tonumber(read())
172
    if num == 1 then
173
        preleva(64, tab.v)
174
        break
175
    elseif num == 2 then
176
        preleva(128, tab.v)
177
        break
178
    elseif num == 3 then
179
        preleva(256, tab.v)
180
        break
181
    elseif num == 4 then
182
        preleva(512, tab.v)
183
        break
184
    elseif num == 5 then
185
        preleva(4096, tab.v)
186
        break
187
    elseif num == 6 then
188
        clear()
189
        break
190
    end
191
end
192
193
term.setBackgroundColor(colors.white)
194
term.setTextColor(colors.black)
195
clear()
196
print("Tra poco sarà possibile eseguire un'altra operazione.")
197
198
term.setTextColor(colors.white)
199
200
shell.run("pastebin get v84Q9wC1 startup2") -- Inserire paste di nPay
201
if fs.exists("startup2") then
202
    shell.run("rm startup")
203
    shell.run("mv startup2 startup")
204
end
205
206
os.reboot()
207