Forum

> > CS2D > Scripts > Select button Function ([2])
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Select button Function ([2])

9 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Select button Function ([2])

Leonidas12
User Off Offline

Zitieren
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

alt Re: Select button Function ([2])

TimeQuesT
User Off Offline

Zitieren
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");

alt Re: Select button Function ([2])

Leonidas12
User Off Offline

Zitieren
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

alt Re: Select button Function ([2])

Bowlinghead
User Off Offline

Zitieren
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

alt Re: Select button Function ([2])

Kel9290
User Off Offline

Zitieren
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
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht