[Lua request] On move, hudtxt.
13 replies



15.06.11 05:58:23 pm
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;
Was not serious, so don't say you did this wrong etc.

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
if tile x y is bla bla whatever then
hudtxt2
Was not serious, so don't say you did this wrong etc.
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.

I'm gonna try and put something together when I get back from diner (:
- Shouldn't be that hard.
Code:
1
2
3
4
5
6
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
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
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.
Edit: Meh, I failed.
to make an only CT hudtxt2 you need change the following line adding "and player(id,"team")==2"
it should be
(change this line of factis code)
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?
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
Factis's code, just with the 3rd line including the statement with the player check.
Good job guys

@ unknow soldier
No u dont right it not mmy coding style
You forgot spaces and using ' but not "
Edit:
OMG IS THAT U UNKNOWN SOLDOIER WLHO MADE ESCAPE DE VIRUS K?!
OMG I LOVE
UR MAP!
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
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.
It just my style I like it
And without spaces and ' its hard read for me

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
You can't read when people use spaces and "?
So, you're saying you can't read this?
Code:
1
"..player(id,"name").."
So, you're saying you can't read this?

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.
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.
That way it's easier to edit and make changes to the script.
On the other hand for organization it's better to move ands to another line.
Code:
1
2
3
4
5
6
7
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
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.



