I think I'm too lazy
Forum
CS2D General Football lua !Football lua !
31 repliesI think I'm too lazy
You noticed that everyone in the English forum speaks English right?
I didn't do this for the forum ok? That's why I said "My football mod" I made this for my server, and posted it here because it may help someone making another mod.
If you've got a problem with that you can make your own football mod fully in english and post it here (or translate mine)
So now when I fixed it, it says "concanate y coordinates" or something. It gives me "nil value" also. I don't even know what the problem with the script is...
And when you score the scores don't change. They're just 0 all the time, and scoreboard disappears when you grab a snowball sometimes. Perhaps it's just my connection...
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
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
if not flacko then flacko={} end flacko.sjam={} ball = 75 knife = 50 function hudtext2(id,tid,color,txt,x,y) 	local toprint = ("©"..color.." "..txt) 	parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y) end addhook("spawn","flacko.sjam.spawn") function flacko.sjam.spawn(id) 	flacko.sjam.updatehud(id) 	return "x" end function flacko.sjam.updatehud(id) 	if(player(id,"exists")) then 		hudtext2(id,1,"255000000",flacko.sjam.tscore,13,179) 		hudtext2(id,2,"000128255",flacko.sjam.ctscore,13,194) 		hudtext2(id,3,"255255000","-",320,20) 		if(flacko.sjam.playerwball>0 and flacko.sjam.ballinair==false) then 			if(player(flacko.sjam.playerwball,"exists"))then 				hudtext2(id,4,"255255000",player(flacko.sjam.playerwball,"name"),13,209) 			else 				hudtext2(id,4,"255255000","",13,209) 			end 		else 			hudtext2(id,4,"255000000","No one's got the ball...",13,209) 		end 	end end addhook("die","flacko.sjam.die") function flacko.sjam.die(victim,killer,weapon,x,y) 	if(flacko.sjam.playerwball == victim) then 		parse("spawnitem "..ball.." "..pixtotile(x).." "..pixtotile(y)) 		flacko.sjam.playerwball = 0 	end 	return 1 end addhook("leave","flacko.sjam.leave") function flacko.sjam.leave(id) 	local xplayer = player(id,"xtile") 	local yplayer = player(id,"ytile") 	if(flacko.sjam.playerwball==id) then 		parse("spawnitem "..ball.." "..xplayer.." "..yplayer) 		flacko.sjam.playerwball = 0 	end end addhook("buy","flacko.sjam.buy") function flacko.sjam.buy() 	return 1 end addhook("drop","flacko.sjam.drop") function flacko.sjam.drop(id) 	if(flacko.sjam.ballinair==false) then 		flacko.sjam.playerwball = 0 		flacko.sjam.ballinair = false 	else 		return 1 	end end addhook("startround","flacko.sjam.startround") function flacko.sjam.startround() 	flacko.sjam.playerwball = 0 	parse("spawnitem "..ball.." 19 12") end addhook("minute","flacko.sjam.minute") function flacko.sjam.minute() 	if(flacko.sjam.playerwball==0) then 		tab = item(0,"table") 		if(#tab==0) then 			parse("spawnitem "..ball.." 19 12") 		end 	end end function pixtotile(pix) 	ret = math.floor(pix/32) 	return ret end function tiletopix(til) 	ret = til*32 	return ret end function flacko.sjam.checkwep(id,wep) --Returns 0 if finds weapon, otherwise it returns 1 	local weapons = playerweapons(id) 	for i = 1, #weapons do 		if weapons[i] == wep then 			return 0 		end 	end 	return 1 end flacko.sjam.ctscore = 0 flacko.sjam.tscore = 0 flacko.sjam.playerwball = 0 flacko.sjam.ballinair = false addhook("collect","flacko.sjam.collect") function flacko.sjam.collect(id,iid,typ) 	if(typ==ball and flacko.sjam.playerwball == 0) then 		giveball(id) 	else 		return 1 	end end addhook("walkover","flacko.sjam.walkover") function flacko.sjam.walkover(id,iid,typ) 	if(typ~=ball or flacko.sjam.playerwball~=0)then 		return 1 	end end function giveball(id) 	parse("equip "..id.." "..ball) 	parse("setweapon "..id.." "..ball) 	parse("strip "..id.." "..knife) 	flacko.sjam.playerwball = id 	for i=1,32 do 		if(player(i,"exists")) then 			flacko.sjam.updatehud(i) 		end 	end 	flacko.sjam.ballinair = false end function stripball(id) 	parse("equip "..id.." "..knife) 	parse("strip "..id.." "..ball) 	flacko.sjam.playerwball = 0 end addhook("hit","flacko.sjam.hit") function flacko.sjam.hit(id,src,wep) 	if(wep==knife) then 		if(flacko.sjam.playerwball==id) then 			if(flacko.sjam.ballinair==false) then 				stripball(id) 				giveball(src) 			end 		end 	elseif(wep==ball) then 		if(flacko.sjam.playerwball==src) then 			if(flacko.sjam.ballinair==false) then 				stripball(src) 				giveball(id) 			end 		end 	end 	return 1 end function check_boundbox(id,x,tx,y,ty,ptx,pty) 	if(ptx<player(id,"x")) then --If moves to left 		if(ptx<tx) then --If enters bounding box 			parse("setpos "..id.." "..(player(id,"x")+3.6).." "..(player(id,"y"))+3.6) 		end 	end end addhook("attack","flacko.sjam.attack") function flacko.sjam.attack(id) 	if(flacko.sjam.playerwball==id) then 		if(player(id,"weapontype")==ball) then 			flacko.sjam.ballinair = true 		end 	end end addhook("projectile","flacko.sjam.projectile") function flacko.sjam.projectile(id,wep,x,y) 	if(flacko.sjam.playerwball==id) then 		if(wep==ball) then 			local xplayer = player(id,"x") 			local yplayer = player(id,"y") 			if(xplayer<x) then x=x-1 elseif (xplayer>x) then x=x+1 end 			if(yplayer<y) then y=y-1 elseif (yplayer>y) then y=y+1 end 			x = pixtotile(x) 			y = pixtotile(y) 			if(y>=11 and y<=13) then 				if(x==4) then 					flacko.sjam.ctscore = flacko.sjam.ctscore + 1 					parse("msg ©000128255"..player(id,"name").." Scores for CT!@C") 					if(player(id,"team")==2) then parse("setscore "..id.." "..(player(id,"score")+1)) 					elseif(player(id,"team")==1) then parse("setscore "..id.." "..(player(id,"score")-3)) end 				elseif(x==34) then 					flacko.sjam.tscore = flacko.sjam.tscore + 1 					parse("msg ©255000000"..player(id,"name").." Scores for T!@C") 					if(player(id,"team")==2) then parse("setscore "..id.." "..(player(id,"score")-3)) 					elseif(player(id,"team")==1) then parse("setscore "..id.." "..(player(id,"score")+1)) end 				end 			end 		parse("spawnitem "..ball.." "..x.." "..y) 		stripball(id) 		flacko.sjam.ballinair = false 		for i=1,32 do flacko.sjam.updatehud(i) end 		end 	end end
Here I translated it, however, you still have to make the goal checking to fit into your map (i didn't comment it in this script bcause im lazy).
Scores should be working fine, last time I tested them they were working
This is the part I don't understand...
1
2
3
4
2
3
4
if(y>=11 and y<=13) then if(x==4) then elseif(x==34) then
###
###
###
###
Cause at the moment it's just like this...
1
2
3
4
2
3
4
if(y>=6 and y<=10) then if(x==2) then elseif(x==32) then
###
###
###
I don't understand the "elseif(x==32)" is that to duplicate the goal for the other team?
http://i29.tinypic.com/2mdlx7t.jpg
You may also want to google about bounding boxes
Edit: Plz appreciate my effort with paint
Flacko has written
That actually explained alot, although the "x==4" and "x==34" is quite strange but I assume that is the distance between the two goals so it makes sense. I'll work on the bounding boxes part. Here I explained (i tried to explain) it with a cute drawing in paint
http://i29.tinypic.com/2mdlx7t.jpg
You may also want to google about bounding boxes
Edit: Plz appreciate my effort with paint
http://i29.tinypic.com/2mdlx7t.jpg
You may also want to google about bounding boxes
Edit: Plz appreciate my effort with paint
[EDIT: I've configured the bounding box and it works properly, great script imho. It seems you've found a way to strip a Player when the snowball is thrown and/or is in the air.]
Flacko you're pretty good at this, how much time have you spent learning LUA scripting?
edited 1×, last 08.08.09 08:41:15 pm
http://www.mediafire.com/?ndquwwmmnhz
I must admit that I never finished it
Feel free to finish it by yourself
edited 1×, last 24.10.09 06:39:07 pm