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
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
-------------------------------------------------------------------
-- Wrapper functions for easy usage of CS2D commands in Lua --
-- 25.03.2011 - www.UnrealSoftware.de --
-------------------------------------------------------------------
-------------------------------------------------------------------
-- These functions make it easier to use CS2D commands in Lua --
-- They call the parse functions with the fitting parameters --
-- --
-- Example without wrapper function: --
-- parse("spawnplayer "..id.." "..x.." " ..y) --
-- --
-- Example with wrapper function: --
-- spawnplayer(id,x,y) --
-- --
-- Both examples do exactly the same but using the wrapper --
-- function is much easier and not as error-prone as using parse.--
-- Therefore it is recommended to use the wrapper functions. --
-- --
-- Use the following line to include the wrapper in your script: --
-- if wrapper~=TRUE then dofile("sys/lua/wrapper.lua") end --
-------------------------------------------------------------------
-- Set Wrapper state to LOADED/TRUE!
wrapper=TRUE
-- Functions
function bot_add()
	parse("bot_add")
end
function bot_add_ct()
	parse("bot_add_ct")
end
function bot_add_t()
	parse("bot_add_t")
end
function bot_count(count)
	parse("bot_count "..count)
end
function bot_jointeam(team)
	parse("bot_jointeam "..team)
end
function bot_kill()
	parse("bot_kill")
end
function bot_prefix(prefix)
	parse("bot_prefix "..prefix)
end
function bot_remove()
	parse("bot_remove")
end
function bot_remove_all()
	parse("bot_remove_all")
end
function bot_remove_ct()
	parse("bot_remove_ct")
end
function bot_remove_t()
	parse("bot_remove_t")
end
function bot_skill(skill)
	parse("bot_skill "..skill)
end
function bot_weapons(weapons)
	parse("bot_weapons "..weapons)
end
function customkill(killer,weaponname,victim)
	parse("customkill "..killer.." "..weaponname.." "..victim)
end
function deathslap(player)
	parse("deathslap "..player)
end
function effect(effect,x,y,p1,p2,r,g,b)
	parse("effect "..effect.." "..x.." "..y.." "..p1.." "..p2.." "..r.." "..g.." "..b)
end
function equip(player,weapon)
	parse("equip "..player.." "..weapon)
end
function explosion(x,y,size,damage,sourceplayer)
	parse("explosion "..x.." "..y.." "..size.." "..damage.." "..sourceplayer)
end
function flashplayer(player,intensity)
	parse("flashplayer "..player.." "..intensity)
end
function flashposition(x,y,intensity)
	parse("flashposition "..x.." "..y.." "..intensity)
end
function hudtxt(id,text,x,y,align)
	parse("hudtxt "..id.." "..text.." "..x.." "..y.." "..align)
end
function hudtxt2(player,id,text,x,y,align)
	parse("hudtxt2 "..player.." "..id.." "..text.." "..x.." "..y.." "..align)
end
function hudtxtalphafade(player,id,duration,alpha)
	parse("hudtxtalphafade "..player.." "..id.." "..duration.." "..alpha)
end
function hudtxtcolorfade(player,id,duration,red,green,blue)
	parse("hudtxtcolorfade "..player.." "..id.." "..duration.." "..red.." "..green.." "..blue)
end
function hudtxtmove(player,id,duration,x,x)
	parse("hudtxtmove "..player.." "..id.." "..duration.." "..x.." "..x)
end
function items()
	parse("items")
end
function kick(player,reason)
	parse("kick "..player.." "..reason)
end
function killobject(objectid)
	parse("killobject "..objectid)
end
function killplayer(player)
	parse("killplayer "..player)
end
function listbans()
	parse("listbans")
end
function listplayers()
	parse("listplayers")
end
function logaddress_add(address)
	parse("logaddress_add "..address)
end
function logaddress_remove(address)
	parse("logaddress_remove "..address)
end
function logaddress_removeall()
	parse("logaddress_removeall")
end
function lua(script)
	parse("lua "..script)
end
function luareset()
	parse("luareset")
end
function makect(player)
	parse("makect "..player)
end
function makespec(player)
	parse("makespec "..player)
end
function maket(player)
	parse("maket "..player)
end
function map(map)
	parse("map "..map)
end
function maps()
	parse("maps")
end
function mp_antispeeder(antispeederprotection)
	parse("mp_antispeeder "..antispeederprotection)
end
function mp_autogamemode(autogamemode)
	parse("mp_autogamemode "..autogamemode)
end
function mp_autoteambalance(balance)
	parse("mp_autoteambalance "..balance)
end
function mp_building_health(building,price)
	parse("mp_building_health "..building.." "..price)
end
function mp_building_limit(building,limit)
	parse("mp_building_limit "..building.." "..limit)
end
function mp_building_price(building,price)
	parse("mp_building_price "..building.." "..price)
end
function mp_buytime(_time)
	parse("mp_buytime ".._time)
end
function mp_c4timer(_time)
	parse("mp_c4timer ".._time)
end
function mp_curtailedexplosions(curtailed)
	parse("mp_curtailedexplosions "..curtailed)
end
function mp_damagefactor(factor)
	parse("mp_damagefactor "..factor)
end
function mp_deathdrop(drop)
	parse("mp_deathdrop "..drop)
end
function mp_dispenser_health(health)
	parse("mp_dispenser_health "..health)
end
function mp_dispenser_money(money)
	parse("mp_dispenser_money "..money)
end
function mp_dmspawnmoney(money)
	parse("mp_dmspawnmoney "..money)
end
function mp_dropgrenades(drop)
	parse("mp_dropgrenades "..drop)
end
function mp_floodprot(floodprotection)
	parse("mp_floodprot "..floodprotection)
end
function mp_freezetime(_time)
	parse("mp_freezetime ".._time)
end
function mp_grenaderebuy(allowed)
	parse("mp_grenaderebuy "..allowed)
end
function mp_hostagepenalty(kills)
	parse("mp_hostagepenalty "..kills)
end
function mp_idleaction(action)
	parse("mp_idleaction "..action)
end
function mp_idlekick(idleaction)
	parse("mp_idlekick "..idleaction)
end
function mp_idletime(_time)
	parse("mp_idletime ".._time)
end
function mp_infammo(infiniteammo)
	parse("mp_infammo "..infiniteammo)
end
function mp_kevlar(percent)
	parse("mp_kevlar "..percent)
end
function mp_kickpercent(percent)
	parse("mp_kickpercent "..percent)
end
function mp_killbuildingmoney(money)
	parse("mp_killbuildingmoney "..money)
end
function mp_killbuildings(kill)
	parse("mp_killbuildings "..kill)
end
function mp_killinfo(info)
	parse("mp_killinfo "..info)
end
function mp_killteambuildings(mode)
	parse("mp_killteambuildings "..mode)
end
function mp_lagcompensation(maxcompensationtime)
	parse("mp_lagcompensation "..maxcompensationtime)
end
function mp_localrconoutput(output)
	parse("mp_localrconoutput "..output)
end
function mp_luamap(use)
	parse("mp_luamap "..use)
end
function mp_luaserver(file)
	parse("mp_luaserver "..file)
end
function mp_mapgoalscore(score)
	parse("mp_mapgoalscore "..score)
end
function mp_mapvoteratio(percent)
	parse("mp_mapvoteratio "..percent)
end
function mp_maxclientsip(clients)
	parse("mp_maxclientsip "..clients)
end
function mp_maxrconfails(maxfails)
	parse("mp_maxrconfails "..maxfails)
end
function mp_natholepunching(allowpunching)
	parse("mp_natholepunching "..allowpunching)
end
function mp_pinglimit(limit)
	parse("mp_pinglimit "..limit)
end
function mp_radar(radar)
	parse("mp_radar "..radar)
end
function mp_randomspawn(_random)
	parse("mp_randomspawn ".._random)
end
function mp_reservations(reservations)
	parse("mp_reservations "..reservations)
end
function mp_respawndelay(delay)
	parse("mp_respawndelay "..delay)
end
function mp_roundlimit(rounds)
	parse("mp_roundlimit "..rounds)
end
function mp_roundtime(_time)
	parse("mp_roundtime ".._time)
end
function mp_startmoney(money)
	parse("mp_startmoney "..money)
end
function mp_supply_items(itemlist)
	parse("mp_supply_items "..itemlist)
end
function mp_teamkillpenalty(kills)
	parse("mp_teamkillpenalty "..kills)
end
function mp_teleportreload(reloadtime)
	parse("mp_teleportreload "..reloadtime)
end
function mp_tempbantime(_time)
	parse("mp_tempbantime ".._time)
end
function mp_timelimit(_time)
	parse("mp_timelimit ".._time)
end
function mp_tkpunish(kill)
	parse("mp_tkpunish "..kill)
end
function mp_trace(accuracy)
	parse("mp_trace ".."accuracy")
end
function mp_turretdamage(damage)
	parse("mp_turretdamage "..damage)
end
function mp_unbuildable(buildings)
	parse("mp_unbuildable "..buildings)
end
function mp_unbuyable(unbuyable)
	parse("mp_unbuyable "..unbuyable)
end
function mp_vulnerablehostages(vulnerable)
	parse("mp_vulnerablehostages "..vulnerable)
end
function mp_winlimit(wins)
	parse("mp_winlimit "..wins)
end
function mp_wpndmg(name,damage)
	parse("mp_wpndmg "..name.." "..damage)
end
function mp_wpndmg_z1(name,damage)
	parse("mp_wpndmg_z1 "..name.." "..damage)
end
function mp_wpndmg_z2(name,damage)
	parse("mp_wpndmg_z2 "..name.." "..damage)
end
function mp_zombiedmg(percentageofdamage)
	parse("mp_zombiedmg "..percentageofdamage)
end
function mp_zombiekillequip(weapon)
	parse("mp_zombiekillequip "..weapon)
end
function mp_zombiekillscore(killscore)
	parse("mp_zombiekillscore "..killscore)
end
function mp_zombierecover(recover)
	parse("mp_zombierecover "..recover)
end
function mp_zombiespeedmod(speedmod)
	parse("mp_zombiespeedmod "..speedmod)
end
function msg(message)
	parse("msg "..message)
end
function rcon(commands)
	parse("rcon "..commands)
end
function rcon_password(password)
	parse("rcon_password "..password)
end
function rcon_pw(password)
	parse("rcon_pw "..password)
end
function removeitem(item)
	parse("removeitem "..item)
end
function reroute(player,address)
	parse("reroute "..player.." "..address)
end
function restart(delay)
	parse("restart "..delay)
end
function restartround(delay)
	parse("restartround "..delay)
end
function setarmor(player,armor)
	parse("setarmor "..player.." "..armor)
end
function setdeaths(player,deaths)
	parse("setdeaths "..player.." "..deaths)
end
function sethealth(player,health)
	parse("sethealth "..player.." "..health)
end
function setmaxhealth(player,maxhealth)
	parse("setmaxhealth "..player.." "..maxhealth)
end
function setmoney(player,money)
	parse("setmoney "..player.." "..money)
end
function setname(player,name)
	parse("setname "..player.." "..name)
end
function setpos(player,x,y)
	parse("setpos "..player.." "..x.." "..y)
end
function setscore(player,score)
	parse("setscore "..player.." "..score)
end
function setweapon(player,weapon)
	parse("setweapon "..player.." "..weapon)
end
function shake(player,power)
	parse("shake "..player.." "..power)
end
function slap(player)
	parse("slap "..player)
end
function spawnitem(item,x,y)
	parse("spawnitem "..item.." "..x.." "..y)
end
function spawnnpc(_type,x,y,rot)
	parse("spawnnpc ".._type.." "..x.." "..y.." "..rot)
end
function spawnobject(_type,x,y,rot,mode,team,player)
	parse("spawnobject ".._type.." "..x.." "..y.." "..rot.." "..mode.." "..team.." "..player)
end
function spawnplayer(player,x,y)
	parse("spawnplayer "..player.." "..x.." "..y)
end
function speedmod(player,speedmod)
	parse("speedmod "..player.." "..speedmod)
end
function strip(player,weapon)
	parse("strip "..player.." "..weapon)
end
function sv_fow(fow)
	parse("sv_fow "..fow)
end
function sv_friendlyfire(FF)
	parse("sv_friendlyfire "..FF)
end
function sv_gamemode(mode)
	parse("sv_gamemode "..mode)
end
function sv_gm(mode)
	parse("sv_gm "..mode)
end
function sv_hostport(port)
	parse("sv_hostport "..port)
end
function sv_lan(lan)
	parse("sv_lan "..lan)
end
function sv_map(map)
	parse("sv_map "..map)
end
function sv_maptransfer(transfer)
	parse("sv_maptransfer "..transfer)
end
function sv_maxplayers(players)
	parse("sv_maxplayers "..players)
end
function sv_msg(message)
	parse("sv_msg "..message)
end
function sv_msg2(player,message)
	parse("sv_msg2 "..player.." "..message)
end
function sv_name(name)
	parse("sv_name "..name)
end
function sv_password(password)
	parse("sv_password "..password)
end
function sv_rcon(rconpassword)
	parse("sv_rcon "..rconpassword)
end
function sv_restart(delay)
	parse("sv_restart "..delay)
end
function sv_restartround(delay)
	parse("sv_restartround "..delay)
end
function sv_sound(soundfile)
	parse("sv_sound "..soundfile)
end
function sv_sound2(player,soundfile)
	parse("sv_sound2 "..player.." "..soundfile)
end
function sv_specmode(mode)
	parse("sv_specmode "..mode)
end
function sv_spraytransfer(spraytransfer)
	parse("sv_spraytransfer "..spraytransfer)
end
function sv_usgnonly(usgnonly)
	parse("sv_usgnonly "..usgnonly)
end
function transfer_speed(speed)
	parse("transfer_speed "..speed)
end
function trigger(trigger)
	parse("trigger "..trigger)
end
function unban(banmask)
	parse("unban "..banmask)
end
function unbanall()
	parse("unbanall")
end
function usgn_addserver()
	parse("usgn_addserver")
end
function usgn_info()
	parse("usgn_info")
end
das ist die wrappper.lua1
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
print('initialising...')
dofile('sys/lua/wrapper.lua')
math.randomseed(os.time())
dir = 'sys/lua/cs2dtibia/'
dofile(dir .. 'config.lua')
dofile(dir .. 'admin.lua')
EXPTABLE = {}
for level = 1, 500 do
EXPTABLE[level] = CONFIG.EXP.CALC(level)
end
EXPTABLE.__index = function(t, k)
t[k] = CONFIG.EXP.CALC(k)
return t[k]
end
setmetatable(EXPTABLE, EXPTABLE)
ysize=map("ysize")
xsize=map("xsize")
GROUNDITEMS = {}
TILEZONE = {}
for y=0,ysize do
GROUNDITEMS[y], TILEZONE[y] = {}, {}
for x = 0, xsize do
GROUNDITEMS[y][x], TILEZONE[y][x] = {}, {}
for i, v in ipairs(SAFEZONE) do
TILEZONE[y][x].SAFE = (x >= v[1][1] and x <= v[2][1] and y >= v[1][2] and y <= v[2][2])
if TILEZONE[y][x].SAFE then break end
end
for i, v in ipairs(PVPZONE) do
TILEZONE[y][x].PVP = (x >= v[1][1] and x <= v[2][1] and y >= v[1][2] and y <= v[2][2]) and i or nil
if TILEZONE[y][x].PVP then
TILEZONE[y][x].SAFE = false
break
end
end
for i, v in ipairs(HOUSES) do
TILEZONE[y][x].HOUSE = (x >= v.pos1[1] and x <= v.pos2[1] and y >= v.pos1[2] and y <= v.pos2[2]) and i or nil
TILEZONE[y][x].HOUSEDOOR = (x == v.door[1] and y == v.door[2]) and i or nil
TILEZONE[y][x].HOUSEENT = (x == v.ent[1] and y == v.ent[2]) and i or nil
if TILEZONE[y][x].HOUSE or TILEZONE[y][x].HOUSEDOOR or TILEZONE[y][x].HOUSEENT then break end
end
end
end
PLAYERS = {}
PLAYERCACHE = {}
HUDImage = image('gfx/weiwen/1x1.png', 565, 407+#CONFIG.STATS*CONFIG.PIXELS/2, 2)
imagescale(HUDImage, 130,CONFIG.PIXELS+#CONFIG.STATS*CONFIG.PIXELS)
imagealpha(HUDImage, 0.5)
SKY = image('gfx/weiwen/1x1.png',320,240,2)
imagescale(SKY,640,480)
imagecolor(SKY,0,0,32)
MINUTES = 0
GLOBAL = {}
GLOBAL.TIME = 0
GLOBAL.RAIN = 0
dofile(dir .. 'functions.lua')
dofile(dir .. 'commands.lua')
dofile(dir .. 'items.lua')
dofile(dir .. 'npcs.lua')
if CONFIG.MAXMONSTERS > 0 then
dofile(dir .. 'monsters.lua')
end
dofile(dir .. 'hooks.lua')
HUDRadar = image("gfx/weiwen/pokeball.png", 53, 53, 2)
TMPGROUNDITEMS = {}
TMPHOUSES = {}
local file = io.open(dir .. "saves/" .. map'name' .. ".lua")
if file then
io.close(file)
dofile(dir .. "saves/" .. map'name' .. ".lua")
for y = 0, map'ysize' do
if TMPGROUNDITEMS[y] then
for x = 0, map'xsize' do
if TMPGROUNDITEMS[y][x] then
for _, j in ipairs(TMPGROUNDITEMS[y][x]) do
if j < 0 then
spawnitem(1337, x, y, -j)
else
spawnitem(j, x, y)
end
end
end
end
end
end
for i, v in pairs(TMPHOUSES) do
for k, l in pairs(v) do
HOUSES[i][k] = l
end
end
TMPGROUNDITEMS = nil
TMPHOUSES = nil
end
local file = io.open(dir .. "saves/players.lua")
if file then
io.close(file)
dofile(dir .. "saves/players.lua")
end
file = nil
parse("mp_infammo 1")
parse("mp_deathdrop 4")
parse("sv_password " .. CONFIG.PASSWORD)
print('initialisation comleted!')