Forum

> > CS2D > Scripts > Hudtxt
Forums overviewCS2D overview Scripts overviewLog in to reply

English Hudtxt

4 replies
To the start Previous 1 Next To the start

old Hudtxt

Marcell
Super User Off Offline

Quote
Hi
When i run this lua script i got
LUA ERROR: attempt to call a nil value



Script:
1
2
3
4
5
addhook("spawn","hud_text")

function hudtext(id,txt,usgn,x,y)
    parse('hudtxt2 '..id..' 1 "©000000000USGNID: '..player(id,"usgn")..'" 8 440 ')
end

old Re: Hudtxt

EngiN33R
Moderator Off Offline

Quote
The name of the function in your hook differs from the name of your actual function. Either change the function declaration to become this:

1
2
3
function hud_text(id)
	parse('hudtxt2 '..id..' 1 "©000000000USGNID: '..player(id,"usgn")..'" 8 440')
end

Or you could change the addhook call:

1
addhook("spawn","hudtext")

But not both.

Also, the spawn hook provides only the id argument. The other arguments are useless, unless you're calling this same function with them from some other point in your code (which I assume you don't)

old Re: Hudtxt

Marcell
Super User Off Offline

Quote
Ohh i am blind, sorry
thanks!


EDIT:
1
2
3
4
function hud_text(id)
     parse('hudtxt2 '..id..' 1 "'..cGREEN_DARK..'USGNID: '..player(id,"usgn")..'" 8 440') 
	 parse('hudtxt2 '..id..' 2 "'..cGREEN_DARK..'Name: '..player(id,"name")..'" 8 480')
end

How can i add more hudtxt?
Tried with this but i got just the first txt on my hudimage.
edited 3×, last 18.10.13 09:17:00 pm

old Re: Hudtxt

Rainoth
Moderator Off Offline

Quote
Why'd you need to show player's name ?

Anyways, you didn't say anything about hudimg. It seems that the commands are fine, as you made different Y for them.

old Re: Hudtxt

Marcell
Super User Off Offline

Quote
user Rainoth has written
Why'd you need to show player's name ?

Anyways, you didn't say anything about hudimg. It seems that the commands are fine, as you made different Y for them.


Name is just temporary, i will make a RolePlay name which read from file and authorize by usgn id..

so ex:.
Player(Matt) connect to server with 32524 USGNID
Then he register on the server via some commands.
After it, he get a roleplay name which he set.
Ex:. Tom_Denem then
it's show on the hudtxt
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview