Forum
CS2D Scripts Random kills..Random kills..
11 Antworten 1
source = 1 -- triggering player
posx = math.random(1,map("sizex")*32);
posy = math.random(1,map("sizey")*32);
parse ("explosion "..x.." "..y.." 10000 1 "..source);
[/Kot]
1
2
3
4
2
3
4
local source = 1 -- triggering player local x = math.random(0,map("xsize")*32) local y = math.random(0,map("ysize")*32) parse("explosion "..x.." "..y.." 1000 1 "..source)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
addhook("serveraction","sa") function sa(id,act) 	if act==1 then 		menu(id,"Airstrike,Airstrike") 	end end addhook("menu","idlemenu") function idlemenu(id,menu,sel) 	if menu=="Airstrike" then 		if sel==1 then 			math.randomseed(os.time()) 			x = math.random(1,map("xsize")) 			y = math.random(1,map("ysize")) 			parse("explosion "..x*32+16.." "..y*32+16.." 32 100 "..id) 		end 	end end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("serveraction","sa") function sa(id,act) if act==1 then menu(id,"Airstrike,Airstrike,Helicopter") end end addhook("menu","call") function idlemenu(id,menu,sel) if menu=="Airstrike" then if sel==1 then math.randomseed(os.time()) x = math.random(1,map("xsize")) y = math.random(1,map("ysize")) parse("explosion "..x*32+16.." "..y*32+16.." 32 100 "..id) end elseif sel==2 then .. end end end
Edit:Didn't Work it said "EXCEPTION_ACCES_VIOLATION"
DrL hat geschrieben
Thanks,Let me try what you did MikuAuahDark ,So if I add more commands , I'll put it like this?
Like that? I added ".." Cos' i don't know that too
Edit:Didn't Work it said "EXCEPTION_ACCES_VIOLATION"
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
addhook("serveraction","sa") function sa(id,act) if act==1 then menu(id,"Airstrike,Airstrike,Helicopter") end end addhook("menu","call") function idlemenu(id,menu,sel) if menu=="Airstrike" then if sel==1 then math.randomseed(os.time()) x = math.random(1,map("xsize")) y = math.random(1,map("ysize")) parse("explosion "..x*32+16.." "..y*32+16.." 32 100 "..id) end elseif sel==2 then .. end end end
Edit:Didn't Work it said "EXCEPTION_ACCES_VIOLATION"
of course it didn't work, you change something at line 8
1
addhook("menu","call")
1
function idlemenu(id,menu,sel)
1
2
3
4
5
2
3
4
5
... 			parse("explosion "..x*32+16.." "..y*32+16.." 32 100 "..id) 		end 		elseif sel==2 then ...
rian, if ur going to use those unnecessary variables (x,y) make them local
also, u dont need to add 16 to each, u dont need to start randomseed from 1, and u shouldnt run randomseed each time as it is a waste of time
its probably better to just not use the unnecessary variables and replace them with the values
ur code wont work because the compiler will think the +16.." is +16.0 ." and will give an error
omg hat geschrieben
ur code wont work because the compiler will think the +16.." is +16.0 ." and will give an error
Since when has lua had a compiler?
Just add a space after the 16 or enclose it in brackets.
1
2
3
2
3
parse("explosion "..x*32+16 .." "..y*32+16 .." 32 100 "..id) -- or (looks nicer) parse("explosion "..(x*32+16).." "..(y*32+16).." 32 100 "..id)
@ MikuAuahDark:
You should make the x and y variables local.
1
2
2
local x = ... local y = ...
omg hat geschrieben
i give x*32+16 because x are in tile and i add +16 to make the expolsion on center u dont need to add 16 to each
1