Forum

> > CS2D > Scripts > Lua error
Forums overviewCS2D overview Scripts overviewLog in to reply

English Lua error

9 replies
To the start Previous 1 Next To the start

old Lua error

alluclone1
User Off Offline

Quote
hi guys. i got problem

why this not work

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
addhook("second","sec")
function sec()
if sec_var>-1 then
sec_var=sec_var-1
if sec_var>0 then
msg("©200000000"..sec_var.."@C")
end
end
if sec_var==0 then
zm_first = math.random(1,#player(0,'table'))
if (player(zm_first,"exists")) then
if (player(zm_first,"team")>0) then
parse("maket "..zm_first)
msg("©200000000"Alien have attack the World!@C")
pos_x[zm_first]=player(zm_first,"x")
pos_y[zm_first]=player(zm_first,"y")
zm_health_set[zm_first] = 0
parse("spawnplayer  "..zm_first.." "..pos_x[zm_first].." "..pos_y[zm_first])
parse('effect "flare" ' .. player(zm_first, "x") .. ' ' .. player(zm_first, "y") .. ' 32 32 000 255 000')
zm_health[zm_first] = 5000
zm_health_set[zm_first] = 5000
randspeed[zm_first] = 0
randminus[zm_first] = 0
zm_first_i[zm_first] = 1
else
sec_var = sec_var+1
end
end
end
end

addhook("startround","set")
function set(id)
if (player(id,"team")==1) then
parse("makect "..id)
end
end

and i get this error

1
LUA ERROR: sys/lua/AvP.lua:136: ')' expected near 'Alien'

old Re: Lua error

RAVENOUS
BANNED Off Offline

Quote
Spoiler >


1
msg("©200000000Alien have attack the World!@C") -- <-

old Re: Lua error

RAVENOUS
BANNED Off Offline

Quote
you just had 3 " in the line. Otherwise you should show me line 136, since I can't measure it.

old Re: Lua error

alluclone1
User Off Offline

Quote
ans one more think

1
2
3
4
5
6
addhook("startround","set")
function set(id)
if (player(id,"team")==1) then
parse("makect "..id)
end
end

why this not work?
i use bots and they not change to ct

old Re: Lua error

EngiN33R
Moderator Off Offline

Quote
Because startround doesn't have an id parameter.

1
2
3
4
5
6
7
8
addhook("startround","set")
function set()
	for id=1,32 do
		if (player(id,"exists") and player(id,"team")==1) then
			parse("makect "..id)
		end
	end
end
Should work.

old Re: Lua error

alluclone1
User Off Offline

Quote
Hey.... its work but its not work on first round.
why?
edited 1×, last 27.02.11 09:15:23 pm

old Re: Lua error

CmDark
User Off Offline

Quote
startround only applies in Standard mode,
any other mode will not be covered by startround.

old Re: Lua error

EngiN33R
Moderator Off Offline

Quote
startround is parsed on a round restart. If you restart the round, it will still be parsed, not depending on the game mode.

I don't know why doesn't it work, it must work. You may be doing something wrong.

A little fix:
More >
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview