Forum

> > CS2D > Scripts > can anyone fix this script
Forums overviewCS2D overview Scripts overviewLog in to reply

English can anyone fix this script

4 replies
To the start Previous 1 Next To the start

old can anyone fix this script

xSkyLordx
User Off Offline

Quote
Hello guys , today i tried to copy a lua hl2d mod. i looked th original one and tried to copy for my self but its not working can anyone help pls sry for bad english btw.

its not even give me an error code nothing happens

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
hornets={}

function spawnhornet(id)
local x,y,rot = player(id,"x"), player(id,"y"), player(id,"rot")
local tbl = {x = x,y = y, rot = rot,img = image("gfx/rocket.bmp",x,y,0),id = id,dmg = math.random(8,12),destroy = 55}
imagepos(tbl.img,x,y,rot)
table.insert(hornets,tbl)
end

timer(1,"movehornets","",0)

function movehornets()
	for k,m in ipairs(hornets) do
	 
	  local rot=m.rot
	  local ang = math.rad(m.rot)
	  local x=m.x + math.sin(ang)*9
	  local y=m.y - math.cos(ang)*9
	  if tile(math.floor(x/32),math.floor(y/32),"wall") then
	  rot = -rot
	  end
	        hornets[k].x = x
		hornets[k].y = y
		hornets[k].rot = rot
		imagepos(hornets[k].img,x,y,rot)
	end
	end

addhook("say","asdasd")
function asdasd(id,t)
if t=="asd" then
spawnhornet(id)
end
end

old Re: can anyone fix this script

Masea
Super User Off Offline

Quote
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
hornets={}

function spawnhornet(id)
local x,y,rot = player(id,"x"), player(id,"y"), player(id,"rot")
local tbl = {x = x,y = y, rot = rot,img = image("gfx/rocket.bmp",x,y,0),id = id,dmg = math.random(8,12),destroy = 55}
imagepos(tbl.img,x,y,rot)
table.insert(hornets,tbl)
end

timer(1,"movehornets","",0)

function movehornets()
     for k,m in ipairs(hornets) do
      
       local rot=m.rot
       local ang = math.rad(m.rot)
       local x=m.x + math.sin(ang)*9
       local y=m.y - math.cos(ang)*9
       if tile(math.floor(x/32),math.floor(y/32),"wall") then
       rot = -rot
       end
             hornets[k].x = x
          hornets[k].y = y
          hornets[k].rot = rot
          imagepos(hornets[k].img,x,y,rot)
     end
     end
     end

addhook("say","asdasd")
function asdasd(id,t)
if t=="asd" then
spawnhornet(id)
end
end

You missed one end word for the movehornets() function.

old Re: can anyone fix this script

Talented Doge
User Off Offline

Quote
More >
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview