Forum

> > CS2D > Scripts > [Lua request] On move, hudtxt.
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch [Lua request] On move, hudtxt.

13 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt [Lua request] On move, hudtxt.

Yates
Reviewer Off Offline

Zitieren
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;
Zitat
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.

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

Infinite Rain
Reviewer Off Offline

Zitieren
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!

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

Yates
Reviewer Off Offline

Zitieren
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.

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

Unknown_Soldier
User Off Offline

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

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

Anders4000
User Off Offline

Zitieren
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

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

Infinite Rain
Reviewer Off Offline

Zitieren
@ 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!
2× editiert, zuletzt 15.06.11 20:29:48

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

Yates
Reviewer Off Offline

Zitieren
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.

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

Yates
Reviewer Off Offline

Zitieren
user Infinite Rain hat geschrieben
1
if x == 5 and y == 6 and player(id, 'team') == 2 then -- or anything you want

Explain how the fuck this needs tabbing? It's just a function, one line.

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

Apache uwu
User Off Offline

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