Forum
CS2D Scripts Lua Scripts/Questions/Help1
2
3
4
5
6
2
3
4
5
6
addhook([[hit]],[[hitteer]]) function hitteer(id,src,wpn,hpd,apd) 	if wpn == 30 then 		parse([[explosion ]]..player(id,"x")..[[ ]]..player(id,"y")..[[ 1 1000 ]]..src) 	end end
BureX has written
okay... i setted the barricade (window location for nazi zombies) location
can u show me how to make them attack it with lua ?
heres the code :
can u show me how to make them attack it with lua ?
heres the code :
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
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
function ai_gotot(id,x,y) if player(id,"bot") then if player(id,"team") == 1 then local c=math.random(1,13) if c==1 then ai_goto(id,12,6) elseif c==2 then ai_goto(id,8,16) elseif c==3 then ai_goto(id,18,20) elseif c==4 then ai_goto(id,25,19) elseif c==5 then ai_goto(id,21,6) elseif c==6 then ai_goto(id,35,6) elseif c==7 then ai_goto(id,51,19) elseif c==8 then ai_goto(id,46,31) elseif c==9 then ai_goto(id,35,21) elseif c==10 then ai_goto(id,30,19) elseif c==11 then ai_goto(id,30,20) elseif c==12 then ai_goto(id,30,21) elseif c==13 then ai_goto(id,25,11) end end end end
1
2
3
2
3
ai_aim(id,x,y)--x and y in pixels ai_attack(id)--primitive attack ai_iattack(id)--intelligent attack
Yasday has written idk if it works, did it from scratch.
for "sfx/thesound.ogg" insert the path of your sound file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
function sv_sound3(x,y,sound) 	for i,id in pairs(player(0,"table")) do 		if math.sqrt((x - player(id,"x"))^2 + (y- player(id,"y"))^2) < 300 then 			parse([[sv_sound2 ]]..id..[[ ]]..sound) 		end 	end end addhook([[attack]],[[attacker]]) function attacker(id) 	local wpn = player(id,"weapontype") 	if wpn == 1 then --USP? 		sv_sound3(player(id,"x"),player(id,"y"),"sfx/thesound.ogg") 	end end
for "sfx/thesound.ogg" insert the path of your sound file
Ty Yasday works perfectly and if i want a greater x place? I only need to edit "300" to a X one?
edited 1×, last 28.12.10 02:55:02 am
You can use the file:write method which writes a certain amount of text to a file.
1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
function fileWrite(path,data) local file = io.open(path,"a") if type(data) == "table" then for i,v in ipairs(data) do 		 file:write(v) end else file:write(data) end file:close() end
once that's done, you can call that using the file read methods provided by the lua library.
1
2
2
for lines in io.lines("sys/lua/text.txt") do 	--manipulate data here
Yasday has written
Use
1
2
3
2
3
ai_aim(id,x,y)--x and y in pixels ai_attack(id)--primitive attack ai_iattack(id)--intelligent attack
it works but they dont stand to the window and destroy it
Picture :
Script :
we now have SUBFORUMS and there is an extra forum for all Lua questions! feel free to create new threads there:
http://www.unrealsoftware.de/forum_threads.php?forum=105&sub=2