Forum

> > CS2D > Scripts > "@C" ? (lua)
Forums overviewCS2D overview Scripts overviewLog in to reply

English "@C" ? (lua)

12 replies
To the start Previous 1 Next To the start

old "@C" ? (lua)

limonata
User Off Offline

Quote
Hi all im sorry for this little and easy problem but i cant use @C in msg i tried this but failed.

msg1 = "test"

addhook("say","msg")
function msg(id,txt)
if txt == "!test" then
msg(@Cmsg1) --> Fail.

msg("@C" ..msg1) --> again fail.

How can i fix it ?

old Re: "@C" ? (lua)

Rainoth
Moderator Off Offline

Quote
1
2
3
4
addhook("say","centertext")
function centertext(id,t)
	msg(""..t.."@C") -- I forgot how to concatenate here >.<
end

old Re: "@C" ? (lua)

Rainoth
Moderator Off Offline

Quote
user Avo has written
msg(""..t.."@C")

How about just:

msg(t.."@C")

?


I thought that but I'm not sure so I did it how it would work anyways :3
EDIT : Spoke with Engin33r. It's correct, Bolt.
edited 1×, last 28.05.13 10:28:45 pm

old Re: "@C" ? (lua)

Alistaire
User Off Offline

Quote
user Rainoth has written
user Avo has written
msg(""..t.."@C")

How about just:

msg(t.."@C")

?


I thought that but I'm not sure so I did it how it would work anyways :3


Actually. You should make it like this;

1
2
3
4
5
local text_copied = t
local empty_string = ''
local at_sign = '@'
local C_letter = 'C'
msg([[]]..empty_string..[[]]..t..[[]]..at_sign..[[]]..C_letter..[[]])

That works.

old Re: "@C" ? (lua)

limonata
User Off Offline

Quote
Thanks guys i didnt put the "@C" to end of msg ah my mistake


msg(msg1.."@C") --> Correct. Problem solved.

old Re: "@C" ? (lua)

D-D3ADxPro
User Off Offline

Quote
Your suppose to put the @C at the end of the message. For example:
1
msg("Test@C")

Here's the fixed script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
if sample==nil then sample={} end
sample.sayfuncs={}

---------------------
-- Sample Function --
----------------------

addhook("say","sample.sayfuncs.say")
function sample.sayfuncs.say(p,txt)
if (txt== "!test") then
msg("Test@C")
return 1
end
end

And, if you want to do a centered color text, use this script:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
if sample==nil then sample={} end
sample.sayfuncs={}

---------------------
-- Sample Function --
----------------------

addhook("say","sample.sayfuncs.say")
function sample.sayfuncs.say(p,txt)
if (txt== "!test") then
msg("©000255000Test@C")
return 1
end
end

-- The Msg is green! --

old Re: "@C" ? (lua)

EngiN33R
Moderator Off Offline

Quote
user D-D3ADxPro has written
Your suppose to put the @C at the end of the message. For example:
1
msg("Test@C")


user limonata has written
msg(msg1.."@C") --> Correct. Problem solved.


Pointless post.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview