English tween_color (lua)

4 replies
Goto Page
To the start Previous 1 Next To the start
11.06.13 11:40:17 pm
Up
limonata
User
Offline Off
Code:
1
2
3
4
5
addhook("join","as")
function as()
local text = parse('hudtxt 1 "Test "282 26')
tween_color(text,2000,050,255,100)
end


It doesnt work please fix it
11.06.13 11:46:16 pm
Up
Apache uwu
User
Offline Off
Please read up on cs2d lua hook join, and cs2d cmd hudtxt2, and cs2d lua cmd tween_color.

The `join` hook sends a parameter of `ID`, which is perfect because it is unique for every user.

The `hudtxt2`/`hudtxt` requires an ID to be specified so that other commands that modify this text.

The `tween_color` command modifies ID of images, so it does not work on `hudtxt2`. (? Correct me if I'm wrong ?)

Code:
1
2
3
4
5
addhook("join","as")
function as(id)
     parse('hudtxt2 '..id..' '..id..' "Test" 282 26')
     tween_color(id,2000,050,255,100)
end
11.06.13 11:57:06 pm
Up
limonata
User
Offline Off
I already read them. And I tried a lot of thing. Your script doesnt work ?
12.06.13 01:02:42 am
Up
Apache uwu
User
Offline Off
You can not tween color on an hudtxt2.
12.06.13 01:35:55 am
Up
DC
Admin
Offline Off
@user limonata: The problems with your code are:

1. Line 3: cs2d lua cmd parse command doesn't return any value. So doing something like variable=parse(...) NEVER makes any sense.

2. Line 4: All the tween commands work with images only. They neither work with players nor with any texts. This is the second time today you are trying to use them with other stuff than images. This simply doesn't work. Images only!

Solution:
The command you need to fade the color of a text is cs2d cmd hudtxtcolorfade. Note that it is a CS2D console command so you have to use it with cs2d lua cmd parse when using it in a Lua script. Also the ID of the hudtxt is 1 because you specified 1 as ID (see: cs2d cmd hudtxt)
Code:
1
parse("hudtxtcolorfade 0 1 2000 50 255 100")



@user Apache uwu: Your code isn't correct either. You are using cs2d lua cmd tween_color with a player ID. It expects an image ID.
www.UnrealSoftware.de | www.CS2D.com | www.CarnageContest.com | Use the forum & avoid PMs!
To the start Previous 1 Next To the start