Forum

> > CS2D > Scripts > [Lua request] On move, hudtxt.
Forums overviewCS2D overview Scripts overviewLog in to reply

English [Lua request] On move, hudtxt.

13 replies
To the start Previous 1 Next To the start

old [Lua request] On move, hudtxt.

Yates
Reviewer Off Offline

Quote
Please, there I said it. So don't say I never did

So. For my jail map I need a few things. One of them, is on a certain tile x y, a hudtxt appears ONLY for the Ct's. Which is also only triggered by the T's of course.
I can imagine how it would work, but I can't get my mind straight and actually script it.
if team==1 then
if tile x y is bla bla whatever then
hudtxt2 and then I lost myself.
Could someone make such a script where in I could edit the x and y and also the hudtxt. Or atleast tell me how to make it

~Thanks!

Btw, the thing I just said with;
Quote
if team==1 then
if tile x y is bla bla whatever then
hudtxt2

Was not serious, so don't say you did this wrong etc.

old Re: [Lua request] On move, hudtxt.

Infinite Rain
Reviewer Off Offline

Quote
1
2
3
4
5
6
addhook('movetile', 'move')
function move(id, x, y)
	if x == 5 and y == 6 then -- or anything you want
		parse('hudtxt2 '.. id ..' "TEXT" X Y 1')
	end
end

where X, Y choose pos in screen (I mean HUDTXT)
where TEXt choose text
Good luck Yates!

old Re: [Lua request] On move, hudtxt.

Yates
Reviewer Off Offline

Quote
Thanks, that was actually the part I could do myself. But anyway, I have an idea how I can do it now, if I fail well.. I fail, that's it.

Edit: Meh, I failed.

old Re: [Lua request] On move, hudtxt.

Unknown_Soldier
User Off Offline

Quote
to make an only CT hudtxt2 you need change the following line adding "and player(id,"team")==2"

it should be
1
if x == 5 and y == 6 and player(id,"team")==2 then -- or anything you want

(change this line of factis code)

old Re: [Lua request] On move, hudtxt.

Anders4000
User Off Offline

Quote
I'm back. And that was just what I was thinking of...
Factis's code, just with the 3rd line including the statement with the player check.
Good job guys

old Re: [Lua request] On move, hudtxt.

Infinite Rain
Reviewer Off Offline

Quote
@ unknow soldier
No u dont right it not mmy coding style
You forgot spaces and using ' but not "
1
if x == 5 and y == 6 and player(id, 'team') == 2 then -- or anything you want
Edit:
OMG IS THAT U UNKNOWN SOLDOIER WLHO MADE ESCAPE DE VIRUS K?!
OMG I LOVE
UR MAP!
edited 2×, last 15.06.11 08:29:48 pm

old Re: [Lua request] On move, hudtxt.

Yates
Reviewer Off Offline

Quote
He can use " as well, you do (Sometimes) have to use ' but if you can. Just use " instead. And why would you use a space? Sometimes it fucks the code up.

old Re: [Lua request] On move, hudtxt.

Apache uwu
User Off Offline

Quote
Yeah if you're talking about Lua stacking it's fine.


On the other hand for organization it's better to move ands to another line.

1
2
3
4
5
6
7
If x==5 then
	if y==6 then
		if player(id,"team")==2 then
			--or anything you want
		end
	end
end

That way it's easier to edit and make changes to the script.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview