Forum

> > CS2D > Scripts > Scipt that shows x,y coordinates
Forums overviewCS2D overview Scripts overviewLog in to reply

English Scipt that shows x,y coordinates

4 replies
To the start Previous 1 Next To the start

old Scipt that shows x,y coordinates

Cmrocker500
User Off Offline

Quote
Hello everyone! I'm here to ask if anyone could make a script where it shows your x,y coordinates and the tile coordinates using a say command like /coords or something. Thank you! and have a good day

old Re: Scipt that shows x,y coordinates

Joni And Friends
User Off Offline

Quote
1
2
3
4
addhook("move","_move")
function _move(id,x,y)
      parse('hudtxt2 '..id..' 1 "X: '..x..' | Y: '..y..'" 0 400')
end
1
2
3
4
5
6
7
8
addhook("say","_say")
function _say(id,txt)
x,y=player(id,"x"),player(id,"y")
       if txt=="!mypos" then
           msg2(id,"My possition X: "..x.." | Y: "..y)
          return 1
      end
end
edited 2×, last 21.12.14 09:15:35 am

old Re: Scipt that shows x,y coordinates

Cmrocker500
User Off Offline

Quote
Thanks for helping me out with this and I also tested your lua already but I also want the option to turn it off somehow and to also show the x/y coordinates the shorter one or whatever it's called

old Re: Scipt that shows x,y coordinates

_Yank
User Off Offline

Quote
That should work (didn't tested though)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pi = {}
pi.maxplayers = tonumber(game("sv_maxplayers"))
for id = 1, pi.maxplayers do pi[id] = true end

addhook("move","pi.move")
function pi.move(id,x,y)
	if pi[id] then
		parse("hudtxt2 "..id.." 30 \"X: "..math.floor((x-16)/32 + 0.5).." Y: "..math.floor((y-16)/32 + 0.5) .."\" 5 115")
	else
				parse("hudtxt2 "..id.." 30 \"\" 5 115")
	end 
end

addhook("say","pi.say")
function pi.say(id, txt)
	if txt == "!coords" then if pi[id] then pi[id]=false else pi[id]=true end end
end
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview