Forum

> > CS2D > Scripts > Error lua , help!
Forums overviewCS2D overview Scripts overviewLog in to reply

English Error lua , help!

15 replies
To the start Previous 1 Next To the start

old Error lua , help!

kalis
User Off Offline

Quote
i have lua use for maps (ct_vs_npc... ) of me
but lua run , but 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
addhook("say","say")
function say(id,txt) 
	if (txt=="!t") and player(id,"usgn") == 20157 then
		me = 1
		msg2(id,' door : '..me..' ')
	elseif (txt=="!t2") and player(id,"usgn") == 20157 then
		me = 2
		msg2(id,' door : '..me..' ')
	elseif (txt=="!t3") and player(id,"usgn") == 20157 then
		me = 3
		msg2(id,' door : '..me..' ')
	end
end


addhook("second","godie")
function godie()
for id = 1,32 do
	if me == 1 then
	local x = player(id,"x")
	local y = player(id,"y")
		if x == 96 and y == 832 then
			parse("setpos "..id.." 224 960")
		elseif x == 320 and y == 768 then
			parse("killplayer "..id)
		elseif x == 224 and y == 864 then
			parse("killplayer "..id)
		end
	end
	if me == 2 then
	local x = player(id,"x")
	local y = player(id,"y")
		if x == 96 and y == 832 then
			parse("killplayer "..id)
		elseif x == 224 and y == 864 then
			parse("setpos "..id.." 224 960")
		elseif x == 320 and y == 768 then
			parse("killplayer "..id)
		end
	end
	if me == 3 then
	local x = player(id,"x")
	local y = player(id,"y")
		if x == 96 and y == 832 then
			parse("killplayer "..id)
		elseif x == 224 and y == 864 then
			parse("killplayer "..id)
		elseif x == 320 and y == 768 then
			parse("setpos "..id.." 224 960")
		end
	end
end
end

old Re: Error lua , help!

kalis
User Off Offline

Quote
i dont know the error =.=!
the Lua run , not appear error
but i go play lua not work in func godie()
when i go in x :320and y = 768 and me == 1
but me not die ! =.=

old Re: Error lua , help!

Yates
Reviewer Off Offline

Quote
But me not help if me no no error.
Soz, I was taking the piss.

Is there any error in the console? You know. A red line saying LUA ERROR at the beginning?

old Re: Error lua , help!

Yasday
User Off Offline

Quote
If you use "x" as the second parameter, the function will return the x position of the player in pixels. So, it wouldn't be easy to stand exactly on those pixels.

old Re: Error lua , help!

kalis
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
36
37
38
addhook("say","say_pos")
function say_pos(id,txt) 
	if (txt=="!t") and player(id,"usgn") == 20157 then
		local me = math.random(1,3)
		msg2(id,' dame : '..me..' ')
	end
end


addhook("move","godie")
function godie(id)
	local x = player(id,"tilex")
	local y = player(id,"tiley")
	if me == 1 then
		if x == 3 and y == 26 then
			parse("setpos "..id.." 224 960")
		elseif x == 10 and y == 24 then
			parse("killplayer "..id)
		elseif x == 7 and y == 27 then
			parse("killplayer "..id)
		end
	elseif me == 2 then
		if x == 3 and y == 26 then
			parse("killplayer "..id)
		elseif x == 7 and y == 27 then
			parse("setpos "..id.." 224 960")
		elseif x == 10 and y == 24 then
			parse("killplayer "..id)
		end
	elseif me == 2 then
		if x == 3 and y == 26 then
			parse("killplayer "..id)
		elseif x == 7 and y == 27 then
			parse("killplayer "..id)
		elseif x == 10 and y == 24 then
			parse("setpos "..id.." 224 960")
		end
	end
i use this lua first and i see not work
i change x pixel to player x
y to player y
but it still not work ...!
edited 2×, last 07.05.11 12:27:50 pm

old Re: Error lua , help!

EngiN33R
Moderator Off Offline

Quote
Try changing the 'move' hook to a 'movetile' hook with id, x and y parameters and remove the first two lines that define local x and y. I've NO idea how could that help, but still, try it.

old Re: Error lua , help!

Cure Pikachu
User Off Offline

Quote
The problem actually lies with two things. The missing end, and a nil variable because you made the variable me local.

old Re: Error lua , help!

J4x
User Off Offline

Quote
Then it should be like this?

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
addhook("say","say_pos")
function say_pos(id,txt)
     if (txt=="!t") and player(id,"usgn") == 20157 then
        me = math.random(1,3)
          msg2(id,' dame : '..me..' ')
     end
end


addhook("move","godie")
function godie(id)
     local x = player(id,"tilex")
     local y = player(id,"tiley")
     if me == 1 then
          if x == 3 and y == 26 then
               parse("setpos "..id.." 224 960")
          elseif x == 10 and y == 24 then
               parse("killplayer "..id)
          elseif x == 7 and y == 27 then
               parse("killplayer "..id)
          end
     elseif me == 2 then
          if x == 3 and y == 26 then
               parse("killplayer "..id)
          elseif x == 7 and y == 27 then
               parse("setpos "..id.." 224 960")
          elseif x == 10 and y == 24 then
               parse("killplayer "..id)
          end
     elseif me == 2 then
          if x == 3 and y == 26 then
               parse("killplayer "..id)
          elseif x == 7 and y == 27 then
               parse("killplayer "..id)
          elseif x == 10 and y == 24 then
               parse("setpos "..id.." 224 960")
          end
     end
end

old Re: Error lua , help!

KimKat
GAME BANNED Off Offline

Quote
Assumably because the Lua script above needs tabbing, if you've used it. Lua is very sensitive when it comes to tabbing, if I'm not mistakened.

old Re: Error lua , help!

J4x
User Off Offline

Quote
@Kimkat tabbing is not necessary, tabbing is just to have a order and to make easier to find errors.

old Re: Error lua , help!

kalis
User Off Offline

Quote
ok nice
i not see the commend of @EngiN33R
now i see and try lua owrk THANKS :D!
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview