Gerne können hier auch Fragen erstellt werden, welche dann einfach beantwortet werden. (ähnlich dem Scripting Thread im SII Bereich: http://www.unrealsoftware.de/forum_posts.php?post=11434&start=0)
Hier die lua Readme welche CS2D beiliegen wird (Stand: 24.02)
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
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
Counter-Strike 2D supports Lua scripts since Beta 0.1.1.4 It uses the Lua engine Version 5.1.2 Please visit the Lua homepage for a documentation www.lua.org Lua scripting in CS2D is based on events/hooks Hooks work only SERVERSIDE and NOT CLIENTSIDE! (due to security reasons) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ CS2D will automatically load and execute "sys\lua\server.lua" when hosting a server ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The following hooks are available. You can create them as Lua functions and CS2D will execute these function whenever the corresponding action occurs. CS2D will pass parameters to most functions. You can use these parameters but you don't have to! Some of the hook-functions can have a return value! This return value influences the way how CS2D behaves. Call updatehooks() after defining all hook-functions! Please make sure that you define every hook function only once. Otherwise you will overwrite existing functions. hook_second() each second hook_minute() each minute hook_always() always (each frame) hook_join(id) on join -id: player id hook_leave(id, reason) on leave -id: player id -reason: reason id (0 normal, >0 kick/ban/timeout) hook_team(id, team, look) on teamchange -id: player id -team: 0 spec, 1 t, 2 ct -look: look id 0,1,2 or 3 >return: 0 - proceed normally 1 - don't change team + close menu hook_spawn(id) on spawn -id: player id hook_startround(mode) on start of round -mode: start round mode id hook_name(id, oldname, newname) on name change -id: player id -oldname: old player name -newname: new player name hook_mapchange(newmap) on map change -newmap: name of new map hook_parse(text) on parse (console/binds/rcon) -text: text/commands to parse >return: 0 - proceed normally 1 - normal parsing, ignore unknown cmds 2 - skip CS2D parsing hook_buy(id, weapon) on buy -id: player id -weapon: type id of bough weapon hook_collect(id,iid,type,ain,a,mode) on collect -id: player id -iid: item id -type: item type -ain: ammo in weapon / item count -a: additional ammo -mode: item mode hook_drop(id,iid,type,ain,a,mode,x,y) on drop -id: player id -iid: item id -type: item type -ain: ammo in weapon / item count -a: additional ammo -mode: item mode -x: drop x position -y: drop y position hook_select(id,type,mode) on select weapon -id: player id -type: item type -mode: item mode hook_reload(id,mode) on reload -id: player id -mode: reload action (1 start, 2 finish) hook_attack(id) on attack -id: player id hook_attack2(id,mode) on attack2 -id: player id -mode: weapon mode hook_hit(id,source,weapon) on hit/damage -id: player id -source: source player id or 0 -weapon: weapon type / source type id hook_kill(killer,victim,weapon,x,y) on kill -killer: player id -victim: player id -weapon: weapon type id -x: death x -y: death y hook_die(victim,killer,weapon,x,y) on death -victim: player id -killer: player id -weapon: weapon type id -x: death x -y: death y hook_use(id, event, data, x, y) on use -id: player id -event: use event type -data: additonal data -x: use x tile position -y: use y tile position hook_say(id, message) on say -id: player id -message: actual chat message hook_sayteam(id, message) on sayteam -id: player id -message: actual chat message hook_radio(id, message) on radio -id: player id -message: radio message type id hook_spray(id) on spray -id: player id hook_vote(id,mode,param) on vote -id: player id -mode: vote mode (1 kick, 2 map) -param: player id or map hook_build(id,type,x,y,mode,objectid) on build -id: player id -type: building type -x: building x -y: building y -mode: building mode -objectid: id of new object ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can use all Lua functions in your CS2D Lua scripts Moreover CS2D has the following own Lua functions: [BASIC] - print("text") show "text" in console - msg("text") send "text" as server message - msg2(id,"text") send "text" to certain player - parse("commands") execute CS2D script commands - vars() show all Lua variables - funcs() show all Lua functions - updatehooks() update all Lua-CS2D hooks [GAME] - game("value") Return a game state/setting You can use ALL settings like sv_name to get their current value as string(!). Moreover you can get the following values: version, dedicated, phase, round, score_t, score_ct, winrow_t, winrow_ct [PLAYER] - player(id,"value") Return a value of a player exists, name, ip, port, usgn, ping, idle, bot, team, look, x, y, rot, tilex, tiley, health, armor, money, score, deaths, teamkills, hostagekills, teambuildingkills, weaponid, weapontype, nightvision, defusekit, bomb, flag, reloading, process, sprayname, spraycolor, votekick, votemap, favteam [ITEM] - item(id,"value") Return a value of an item exists, name, type, player, ammo, ammoin, mode, x, y, dropped, droptimer - itemtype(type,"value") Return a value of an item type name, dmg, dmz_z1, dmg_z2, rate, reload, ammo, ammoin, price, range, dispersion, slot, recoil
Diese gibt einen kurzen Überblick über das was möglich sein wird.
edited 1×, last 05.03.09 11:08:53 pm