Forum

> > CS2D > General > Text position..
Forums overviewCS2D overviewGeneral overviewLog in to reply

English Text position..

15 replies
To the start Previous 1 Next To the start

old Text position..

SQ
Moderator Off Offline

Quote
I need very smal help
I need to know all codes which could help me with text positions in my server. IF you know what I mean.
I know that text position could be temporary in certer of screen , but I dont know how to make that
Can someone post commands in this tread?
Please type as much as passible commands...
Thanx

old Re: Text position..

SQ
Moderator Off Offline

Quote
Thanx dc

EDIT:But can you make example of Hud txt?
It should like in BB.. Im right?
edited 2×, last 10.05.09 03:52:25 pm

old Re: Text position..

DC
Admin Off Offline

Quote
type in your cs2d console:
hudtxt 0 "a text created with hudtext" 150 150 0

this will display a text at the position 150,150 which is aligned to the left (last param. 0). it uses the textid 0 (first param.). this id is simply used to access and modify the text. that means you can create up to 10 hudtxts at the same time (ids 0 to 9).

old Re: Text position..

DC
Admin Off Offline

Quote
...I already said something about that:
DC has written
@C is the only way to change the position with the regular sv_msg command.

old Re: Text position..

New Rex
User Off Offline

Quote
DC has written
...I already said something about that:
DC has written
@C is the only way to change the position with the regular sv_msg command.


Oh, noob part of me.


Will @R ever exist? it may be a little useful (perhaps, I need it )

old Re: Text position..

SQ
Moderator Off Offline

Quote
DC has written
type in your cs2d console:
hudtxt 0 "a text created with hudtext" 150 150 0

this will display a text at the position 150,150 which is aligned to the left (last param. 0). it uses the textid 0 (first param.). this id is simply used to access and modify the text. that means you can create up to 10 hudtxts at the same time (ids 0 to 9).

ok.. But Im bit confused.
Im trying to use it in lua...
Ect :
I want that "experience" text will be showing with this command (Hud_text).
Exp fuction is basicly almost same like sample.gg.kills...
Just I have bit updated it.
But until now I havent maked that command (Hud_text) work to me properly.

old Re: Text position..

DC
Admin Off Offline

Quote
in Lua you have to use parse to execute cs2d commands. as always.
1
parse('hudtxt 0 "a text created with hudtext" 150 150 0')
attention: you have to use different quotation marks! otherwise it will not work. I used ' for the outer quotes and " for the inner quotes therefore.


hud_text? it's hudtxt. not hud_text.

old Re: Text position..

Flacko
User Off Offline

Quote
Here, I made this function for a script:

1
2
3
4
function hudtext2(id,tid,color,txt,x,y)
	toprint = ("©"..color.." "..txt)
	parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y)
end

It takes 5 parameters:
1st: PlayerID
2nd: Text'sID
3rd: Color (Must be a string) i.e: "000255000" is green.
4th: Text.
5/6: Position

old Re: Text position..

SQ
Moderator Off Offline

Quote
Flacko has written
Here, I made this function for a script:

1
2
3
4
function hudtext2(id,tid,color,txt,x,y)
	toprint = ("©"..color.." "..txt)
	parse('hudtxt2 '..id..' '..tid..' "'..toprint..'" '..x.." "..y)
end

It takes 5 parameters:
1st: PlayerID
2nd: Text'sID
3rd: Color (Must be a string) i.e: "000255000" is green.
4th: Text.
5/6: Position


1
2
3
4
function hudtext2(id,tid,color,txt,x,y) 
	toprint = ("©000255255Here you some words")
	parse("hudtxt2 "..id.." 1 "..toprint.." "100" "100)
end
That should work ^
But no... Its not working . Where is a mistake ? (Console says that mistake is ...)

old Re: Text position..

DC
Admin Off Offline

Quote
you obviously don't even know what a function is or how to use it properly?! please read a Lua tutorial first!

you have to CALL the function! don't replace values in the function yourself!

old Re: Text position..

SQ
Moderator Off Offline

Quote
DC has written
you obviously don't even know what a function is or how to use it properly?! please read a Lua tutorial first!

you have to CALL the function! don't replace values in the function yourself!

I have read info more than 1 time
Exacly... That command is working for me in this form:
1
parse("hudtxt2 "..id.." 1 "..toprint)
(Btw... Im using "spawn" hook...)
My problem is only with X ; Y parameters...
Im working with lua 2 weeks but that is my first problem.
there is my problem...(X ; Y) :
http://img139.imageshack.us/my.php?image=85113570.jpg (Words on x=0 ; y=0)

old Re: Text position..

DC
Admin Off Offline

Quote
(the info.txt doesn't explain anything about how functions work or how Lua works.)

what exactly is your problem with x and y?

x goes from 0 (left side) to 640 (right side)
y goes from 0 (top) to 480 (bottom)

in parse("hudtxt2 "..id.." 1 "..toprint) you did not specify the x and y parameters so the game displays it at 0,0

old Re: Text position..

SQ
Moderator Off Offline

Quote
DC has written
(the info.txt doesn't explain anything about how functions work or how Lua works.)

what exactly is your problem with x and y?

x goes from 0 (left side) to 640 (right side)
y goes from 0 (top) to 480 (bottom)

in parse("hudtxt2 "..id.." 1 "..toprint) you did not specify the x and y parameters so the game displays it at 0,0

Thanx dc
You are the best
Finaly I have done it :
http://img365.imageshack.us/img365/3089/nolimitupdate.jpg

I wish you good luck in new project
edited 1×, last 11.05.09 08:56:32 pm

old examlple

Tajifun
User Off Offline

Quote
Can someone give me an example which is working?
pls...

To the start Previous 1 Next To the start
Log in to replyGeneral overviewCS2D overviewForums overview