Forum

> > CS2D > Scripts > ATM script
Forums overviewCS2D overview Scripts overviewLog in to reply

English ATM script

2 replies
To the start Previous 1 Next To the start

old ATM script

Moogurn
BANNED Off Offline

Quote
Hello!I saw the script ATM (user THEMUD) (thread cs2d How to create ATM? ) and tried to make a ATM machine using this script. However, nothing came of it. Why?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
ATM = {};
ATM.x =114 --ATM X coordination
ATM.y =121 --ATM Y coordination

addhook("use", "_use")
function _use(id, event, data, x, y)
     if event == 100 then
          if x == ATM.x and y == ATM.y then
- SUPPLY --
addhook('objectdamage', '_objectdamageHook')

function _objectdamageHook(dynid, dmg)
if object(dynid, 'typename') == 'Super Supply' and dmg > 0 then
return 1
end
end

-- BANK --
addhook("use","supp6")
function supp6(id,x,y)
      if player(id,"tilex") == 32 and player(id,"tiley") == 34 or player(id,"tilex") == 33 and player(id,"tiley") == 33 or player(id,"tilex") == 34 and player(id,"tiley") == 34 or player(id,"tilex") == 63 and player(id,"tiley") == 16 or player(id,"tilex") == 62 and player(id,"tiley") == 17 or player(id,"tilex") == 63 and player(id,"tiley") == 18 or player(id,"tilex") == 63 and player(id,"tiley") == 45 or player(id,"tilex") == 62 and player(id,"tiley") == 46 or player(id,"tilex") == 63 and player(id,"tiley") == 47 then
     menu(id,"Automatic Banking Machine,CheckBalance,Deposit...,Withdraw...")
     end
end

addhook("menu","potatosauces")
function potatosauces(id,title,button)
if title == "Automatic Banking Machine" then
if button == 1 then
     msg("©000255000Money on your bank account: $0@C")
elseif button == 2 then
     menu(id,"Deposit...,$100,$500,$1000,$5000,$10000,$16000")
elseif button == 3 then
     menu(id,"Withdraw...,$100,$500,$1000,$5000,$10000,$16000")
          end
     end
end

parse("spawnobject 15 33 34 0 0 0 0")
parse("spawnobject 15 63 17 0 0 0 0")
parse("spawnobject 15 63 46 0 0 0 0")

-- BOMB SHOP --
addhook("use","supp5")
function supp5(id,x,y)
      if player(id,"tilex") == 22 and player(id,"tiley") == 33 or player(id,"tilex") == 23 and player(id,"tiley") == 32 or player(id,"tilex") == 24 and player(id,"tiley") == 33 or player(id,"tilex") == 46 and player(id,"tiley") == 60 or player(id,"tilex") == 47 and player(id,"tiley") == 61 or player(id,"tilex") == 48 and player(id,"tiley") == 60 then
     menu(id,"Bomb Shop,He Grenade|$1 000,FlashBang|$2 000,Smoke Grenade|$5 000,Flare|$6 000,Air Strike|$10 000,Bomb|$15 000,Gas Mask|$15 000,,Nukes...")
     end
end

addhook("menu","potatosauce")
function potatosauce(id,title,button)
if title == "Bomb Shop" then
if button == 1 then
     if rp_money[id]>=1000 then
     parse("spawnitem 51 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-1000
else
nmn(id)
end
elseif button == 2 then
     if rp_money[id]>=2000 then
     parse("spawnitem 52 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-2000
else
nmn(id)
end
elseif button == 3 then
     if rp_money[id]>=5000 then
     parse("spawnitem 53 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-5000
else
nmn(id)
end
elseif button == 4 then
     if rp_money[id]>=6000 then
     parse("spawnitem 54 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-6000
else
nmn(id)
end
elseif button == 5 then
     if rp_money[id]>=10000 then
     parse("spawnitem 76 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-10000
else
nmn(id)
end
elseif button == 6 then
     if rp_money[id]>=15000 then
     parse("spawnitem 55 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-15000
else
nmn(id)
end
elseif button == 7 then
     if rp_money[id]>=15000 then
     parse("spawnitem 60 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-15000
else
nmn(id)
end     
elseif button == 9 then
     menu(id,"Bomb Shop - Nuke,50 kt|$7 000,100 kt|$15 000,200 kt|$25 000,500 kt|$35 000,1 mt|$100 000,2 mt|$200 000,5 mt|$500 000,10 mt|$1 000 000")
          end
     end
end

parse("spawnobject 15 23 33 0 0 0 0")
parse("spawnobject 15 47 60 0 0 0 0")

 

-- ARMOR SHOP --
addhook("use","supp4")
function supp4(id,x,y)
      if player(id,"tilex") == 29 and player(id,"tiley") == 20 or player(id,"tilex") == 29 and player(id,"tiley") == 18 or player(id,"tilex") == 30 and player(id,"tiley") == 19 then
     menu(id,"Armor Store,Light Armor|$1 000,Tactical Shield|$5 000,Armor|$10 000,Heavy Armor|$25 000,Stealth Armor|$50 000,Super Armor|$500 000,,Medic Armor|$1 000 000")
     end
end

addhook("menu","potatosa")
function potatosa(id,title,button)
if title == "Armor Store" then
if button == 1 then
     if rp_money[id]>=1000 then
     parse("spawnitem 79 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-1000
else
nmn(id)
end
elseif button == 2 then
     if rp_money[id]>=5000 then
     parse("spawnitem 41 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-5000
else
nmn(id)
end
elseif button == 3 then
     if rp_money[id]>=10000 then
     parse("spawnitem 80 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-10000
else
nmn(id)
end
elseif button == 4 then
     if rp_money[id]>=25000 then
     parse("spawnitem 81 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-25000
else
nmn(id)
end
elseif button == 5 then
     if rp_money[id]>=50000 then
     parse("spawnitem 84 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-50000
else
nmn(id)
end
elseif button == 6 then
     if rp_money[id]>=500000 then
     parse("spawnitem 83 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-500000
else
nmn(id)
end
elseif button == 8 then
     if rp_money[id]>=1000000 then
     parse("spawnitem 82 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-1000000
else
nmn(id)
               end
          end
     end
end

parse("spawnobject 15 29 19 0 0 0 0")

-- WEAPON SHOP --
addhook("use","supp3")
function supp3(id,x,y)
      if player(id,"tilex") == 58 and player(id,"tiley") == 34 or player(id,"tilex") == 59 and player(id,"tiley") == 35 or player(id,"tilex") == 58 and player(id,"tiley") == 36 or player(id,"tilex") == 76 and player(id,"tiley") == 60 or player(id,"tilex") == 77 and player(id,"tiley") == 61 or player(id,"tilex") == 78 and player(id,"tiley") == 60 then
     menu(id,"Weapon Shop,AWP|$1 000,FlameThrower|$5 000,Grenade Launcher|$10 000,RPG Launcher|$25 000,FN 2000|$30 000,M134|$40 000,Laser|$100 000,,AmmoPack|$500")
     end
end

addhook("menu","potato")
function potato(id,title,button)
if title == "Weapon Shop" then
if button == 1 then
     if rp_money[id]>=1000 then
     parse("spawnitem 35 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-1000
else
nmn(id)
end
elseif button == 2 then
     if rp_money[id]>=5000 then
     parse("spawnitem 46 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-5000
else
nmn(id)
end
elseif button == 3 then
     if rp_money[id]>=10000 then
     parse("spawnitem 49 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-10000
else
nmn(id)
end
elseif button == 4 then
     if rp_money[id]>=25000 then
     parse("spawnitem 47 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-25000
else
nmn(id)
end
elseif button == 5 then
     if rp_money[id]>=30000 then
     parse("spawnitem 91 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-30000
else
nmn(id)
end
elseif button == 6 then
     if rp_money[id]>=40000 then
     parse("spawnitem 90 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-40000
else
nmn(id)
end
elseif button == 7 then
     if rp_money[id]>=100000 then
     parse("spawnitem 45 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-100000
else
nmn(id)
end
elseif button == 9 then
     if rp_money[id]>=500 then
     parse("spawnitem 61 "..player(id,"tilex").." "..player(id,"tiley"))
     rp_money[id]=rp_money[id]-500
else
nmn(id)
               end
          end
     end
end

parse("spawnobject 15 58 35 0 0 0 0")
parse("spawnobject 15 77 60 0 0 0 0")

-- HP STORE --
addhook("use","supp1")
function supp1(id,x,y)
      if player(id,"tilex") == 20 and player(id,"tiley") == 19 or player(id,"tilex") == 19 and player(id,"tiley") == 20 or player(id,"tilex") == 20 and player(id,"tiley") == 21 or player(id,"tilex") == 51 and player(id,"tiley") == 28 or player(id,"tilex") == 53 and player(id,"tiley") == 28 or player(id,"tilex") == 52 and player(id,"tiley") == 29 then
     menu(id,"Drug Store,Fast Speed|$7 000,Limit Speed|$15 000,High Speed|$50 000,Turbo Speed|$90 000,,HP Burst|$5 000,Big HP Burst|$15 000")
     end
end

addhook("menu","xd")
function xd(id,title,button)
if title == "Drug Store" then
if button == 1 then
     if rp_money[id]>=7000 then
     parse("speedmod "..id.." 20")
     rp_money[id]=rp_money[id]-7000
else
nmn(id)
end
elseif button == 2 then
     if rp_money[id]>=15000 then
     parse("speedmod "..id.." 35")
     rp_money[id]=rp_money[id]-15000
else
nmn(id)
end
elseif button == 3 then
     if rp_money[id]>=50000 then
     parse("speedmod "..id.." 65")
     rp_money[id]=rp_money[id]-50000
else
nmn(id)
end
elseif button == 4 then
     if rp_money[id]>=90000 then
     parse("speedmod "..id.." 100")
     rp_money[id]=rp_money[id]-90000
else
nmn(id)
end
elseif button == 6 then
     if rp_money[id]>=5000 then
     parse("setmaxhealth "..id.." 150")
     rp_money[id]=rp_money[id]-5000
else
nmn(id)
end
elseif button == 7 then
     if rp_money[id]>=15000 then
     parse("setmaxhealth "..id.." 250")
     rp_money[id]=rp_money[id]-15000
else
nmn(id)
               end
          end
     end
end

parse("spawnobject 15 20 20 0 0 0 0")
parse("spawnobject 15 52 28 0 0 0 0")               --Do your script here
          end
     end
end

old Re: ATM script

GeoB99
Moderator Off Offline

Quote
From 5 till 7 line it's the problem. If you don't get it, I've took that snippet of code:
1
2
3
4
addhook("use", "_use")
function _use(id, event, data, x, y)
     if event == 100 then
          if x == ATM.x and y == ATM.y then
You basically didn't define what you SHOULD do after the if statement it's meet. With that said, since an ATM script works as long if there is a cs2d lua cmd menu Lua function to manipulate your money (depositing, withdrawing, etc..) then you could have put the menu function after if statement. This is what you should do.
1
2
3
4
5
6
7
8
addhook("use", "_use")
function _use(id, event, data, x, y)
	if event == 100 then
		if x == ATM.x and y == ATM.y then
			menu(id,"Automatic Banking Machine, Check Balance, Deposit..., Withdraw...")
		end
	end
end
P.S.: You left cs2d lua cmd menu function forgotten.

old Atm ? Whoa :O Best script

Amanda and Friends
User Off Offline

Quote
Huh , share the atm script ? I think , some players like server .....C-4..... But, she is like rp_amstria_v0.4 then he ask how to created ATM Script , next he will make server using same of rp_amstria_v0.4 . I Don't know where this Code Correct
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview