English [Lua request] On move, hudtxt.

13 replies
Goto Page
To the start Previous 1 Next To the start
Up
Yates
Reviewer
Offline Off
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.
15.06.11 06:33:14 pm
Up
Anders4000
User
Offline Off
I thought you were a good programmer!
I'm gonna try and put something together when I get back from diner (:
- Shouldn't be that hard.
15.06.11 07:11:47 pm
Up
Infinite Rain
Reviewer
Offline Off
Code:
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!
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
15.06.11 07:14:21 pm
Up
Yates
Reviewer
Offline Off
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.
15.06.11 07:24:26 pm
Up
Unknown_Soldier
User
Offline Off
to make an only CT hudtxt2 you need change the following line adding "and player(id,"team")==2"

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


(change this line of factis code)
Should I come back and make one last map for CS2D?
15.06.11 07:43:16 pm
Up
Anders4000
User
Offline Off
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
15.06.11 08:24:49 pm
Up
Infinite Rain
Reviewer
Offline Off
@ unknow soldier
No u dont right it not mmy coding style
You forgot spaces and using ' but not "
Code:
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
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
15.06.11 08:26:29 pm
Up
Yates
Reviewer
Offline Off
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.
15.06.11 08:28:36 pm
Up
Infinite Rain
Reviewer
Offline Off
It just my style I like it
And without spaces and ' its hard read for me
A thousand may fall at your side, ten thousand at your right hand, but it will not come near you. You will only look with your eyes and see the recompense of the wicked. - Psalm 91:7-8 ESV
15.06.11 08:30:14 pm
Up
Yates
Reviewer
Offline Off
You can't read when people use spaces and "?
Code:
1
"..player(id,"name").."

So, you're saying you can't read this?
15.06.11 08:41:25 pm
Up
Anders4000
User
Offline Off
He's talking about tabbing...
Like:
Code:
1
2
3
4
5
If ... then
     if ... then
          --Code
     end
end
15.06.11 08:42:52 pm
Up
Yates
Reviewer
Offline Off
user Infinite Rain has written:
Code:
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.
15.06.11 08:45:25 pm
Up
Anders4000
User
Offline Off
I don't know
Just forget it
15.06.11 10:21:49 pm
Up
Apache uwu
User
Offline Off
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.

Code:
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