Forum

> > CS2D > Scripts > Select button Function ([2])
Forums overviewCS2D overview Scripts overviewLog in to reply

English Select button Function ([2])

9 replies
To the start Previous 1 Next To the start

old Select button Function ([2])

Leonidas12
User Off Offline

Quote
guys there is my Teleport script:

1
2
3
4
5
6
7
8
9
10
11
12
function telemsg()
     msg("©255000000Lua Made By Neomage")
end

function telego(id,src,wpn)
     if wpn == 6 then
          -- I assume the position given are in tiles, so...
          local rx = (tilex*32)+16
          local ry = (tiley*32)+16
          parse("setpos "..id.." "..rx.." "..ry)
     end
end

im not stopping t's retry join t end exiting my jail

old Re: Select button Function ([2])

TimeQuesT
User Off Offline

Quote
tilex is undefined. You have to call the player function that returns the wanted value :

local x = player(id,"x");
or
local x = player(id,"tilex");

old Re: Select button Function ([2])

Leonidas12
User Off Offline

Quote
This is my way:

[code]-- hooks
addhook("startround","telemsg")
addhook("hit","telego")
addhook("spawn")
-- variables
tilex = 130
tiley = 60

-- functions
function telemsg()
msg("©255000000Lua Made By Neomage")
end

function telego(id,src,wpn)
if wpn == 6 then
-- I assume the position given are in tiles, so...
local rx = (tilex*32)+16
local ry = (tiley*32)+16
parse("setpos "..id.." "..rx.." "..ry)
end
end
function spawn()(id,src,wpn)
if wpn == 6 then
spawn tilex =130
spawn tiley =60

old Re: Select button Function ([2])

Bowlinghead
User Off Offline

Quote
Bug report:

× the addhook "spawn" has no function(-variable).

× The addhook "spawn" has only 1 parameter "id".

× "spawn =" is completly wrong. You need "parse("setpos <id> <x> <y>")"

× You forgot some "end"s

old Re: Select button Function ([2])

Kel9290
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
-- hooks
addhook("startround","telemsg")
addhook("hit","telego")
addhook("spawn","_spawn")
-- variables
tile_x = 130
tile_y = 60

-- functions
function telemsg()
	msg("©255000000Lua Made By Neomage")
end

function telego(id,src,wpn)
	if wpn == 6 then
		-- I assume the position given are in tiles, so...
		local rx = (tile_x*32)+16
		local ry = (tile_y*32)+16
		parse("setpos "..id.." "..rx.." "..ry)
	end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview