Forum

> > CS2D > Scripts > script request (chat color)
Forums overviewCS2D overview Scripts overviewLog in to reply

English script request (chat color)

7 replies
To the start Previous 1 Next To the start

old ¿something like that?

Scott
BANNED Off Offline

Quote
¿something like that?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
admins = {xxxx} -- Your USGN Here --
chat = {}
txt = {}

for id = 1,32 do
     chat[id] = {mode = 0}
end

addhook("menu","colorsmenu")
addhook("say","colorsmsg")
addhook("serveraction","adminsay")

function adminsay(id,action)
   for _, usgn in ipairs(admins) do
      if player(id,"usgn") == usgn then
     if action == 1 then
          menu(id,"Admin Chat Color,White,Pink,Red,Orange,Green,Blue,Brown,Gray,Remove Colors|X")
               return 1
            end
        end
    end
end

function colorsmenu(id,tit,btn)
     if tit=="Admin Chat Color" then
          if btn == 1 then
               chat[id].mode = 1
               msg2(id,"\169255255255Chat colour has been changed to White.@C")
          elseif btn == 2 then
               chat[id].mode = 2
               msg2(id,"\169255128255Chat colour has been changed to Pink.@C")
          elseif btn == 3 then
               chat[id].mode = 3
               msg2(id,"\169255000000Chat colour has been changed to Red.@C")
          elseif btn == 4 then
               chat[id].mode = 4
               msg2(id,"\169255128000Chat colour has been changed to Orange.@C")
          elseif btn == 5 then
               chat[id].mode = 5
               msg2(id,"\169000255000Chat colour has been changed to Green.@C")
          elseif btn == 6 then
               chat[id].mode = 6
               msg2(id,"\169000000255Chat colour has been changed to Blue.@C")
          elseif btn == 7 then
               chat[id].mode = 7
               msg2(id,"\169128064000Chat colour has been changed to Brown.@C")
          elseif btn == 8 then
               chat[id].mode = 8
               msg2(id,"\169128128128Chat colour has been changed to Gray.@C")
          elseif btn == 9 then
               chat[id].mode = 0
               msg2(id,"Chat colour has been changed to default.@C")
          end
     end
end

function colorsmsg(id,txt)
      msg(teamclr(id)..""..player(id,"name")..": "..returnmsg(id)..""..txt)
     return 1
end

function returnmsg(id)
     if chat[id].mode == 0 then
          return "\169255255000"
     elseif chat[id].mode == 1 then
          return "\169255255255"
     elseif chat[id].mode == 2 then
          return "\169255128255"
     elseif chat[id].mode == 3 then
          return "\169255000000"
     elseif chat[id].mode == 4 then
          return "\169255128000"
     elseif chat[id].mode == 5 then
          return "\169000255000"
     elseif chat[id].mode == 6 then
          return "\169000000255"
     elseif chat[id].mode == 7 then
          return "\169128064000"
     elseif chat[id].mode == 8 then
          return "\169128128128"
     elseif chat[id].mode == 9 then
          return "\169255255000"
     end
end

function teamclr(id)
     if player(id,"team") == 1 then
          return "\169255025000"
     elseif player(id,"team") == 2 then
          return "\169050150255"
     end
end

old Sorry, but I had fun doing it: HTML Colors, codes

VADemon
User Off Offline

Quote
@user DC, code-tag doesn't work for this message, pls fix

Full code + HTML Color table from http://www.abecem.net/web/renk.html
500 Lines, 13kB:

Code >


Usage:
1
2
3
hcolor("COLORNAME")
-----
msg(hcolor("lavenderblush1") .. "Hello everyone!")

Please note that I removed turkish color names because of turkish characters, they would have caused trouble otherwise and some of them weren't properly written inside HTML code.
All color names are lowercase and contain no spaces.

PS: Change thread title to "[SOLVED] ....." if everything is good.

old Re: script request (chat color)

GeoB99
Moderator Off Offline

Quote
@user vuenxx: Care to elaborate in a better detail with what you said? Does the script cause any errors? Is there any unexpected behaviour during the usage of user VADemon's script or other scripts posted above?
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview