English "@C" ? (lua)

12 replies
Goto Page
To the start Previous 1 Next To the start
28.05.13 09:10:10 pm
Up
limonata
User
Offline Off
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 ?
28.05.13 09:15:01 pm
Up
useigor
User
Offline Off
user limonata, here example from cs2d.com:
Code:
1
msg("This text is displayed at the center@C")
28.05.13 09:28:04 pm
Up
Dynamite07
User
Offline Off
msg("@Cmsg1") ?
What do you want to do?
28.05.13 10:08:46 pm
Up
Rainoth
Moderator
Offline Off
Code:
1
2
3
4
addhook("say","centertext")
function centertext(id,t)
     msg(""..t.."@C") -- I forgot how to concatenate here >.<
end
28.05.13 10:23:15 pm
Up
Avo
User
Offline Off
msg(""..t.."@C")

How about just:

msg(t.."@C")

?
Trust me, I'm an engineer | user DC approved file cs2d Super extra mod for CS2D (64), yeah!
28.05.13 10:24:28 pm
Up
Infinite Rain
Reviewer
Offline Off
@user Avo:
I don't understand the logic myself.
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
28.05.13 10:25:30 pm
Up
Rainoth
Moderator
Offline Off
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
28.05.13 10:27:05 pm
Up
Infinite Rain
Reviewer
Offline Off
it same as

msg(0 + 5 + 6)
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
28.05.13 10:28:42 pm
Up
Alistaire
User
Offline Off
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;

Code:
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.
IMG:http://i.imgur.com/5zhwOTP.png
28.05.13 10:29:53 pm
Up
Conscience
User
Offline Off
@user Avo: @user Infinite Rain: It is preferred not to code how Raining Mammoths did, but it is still allowed.
Remember to learn to forget. Whiskey shots and cheap cigarettes.
28.05.13 10:30:28 pm
Up
limonata
User
Offline Off
Thanks guys i didnt put the "@C" to end of msg ah my mistake


msg(msg1.."@C") --> Correct. Problem solved.
28.05.13 10:41:32 pm
Up
D-D3ADxPro
User
Offline Off
Your suppose to put the @C at the end of the message. For example:
Code:
1
msg("Test@C")


Here's the fixed script:
Code:
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:
Code:
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! --
Revisiting after 4 years, and boy how much cs2d really changed.
28.05.13 10:43:19 pm
Up
EngiN33R
Moderator
Offline Off
user D-D3ADxPro has written:
Your suppose to put the @C at the end of the message. For example:
Code:
1
msg("Test@C")


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


Pointless post.
I code, therefore I exist. | Visit my blog for Lua tips and other interesting info
To the start Previous 1 Next To the start