English script request (chat color)

7 replies
Goto Page
To the start Previous 1 Next To the start
05.01.17 11:21:42 pm
Up
vuenxx
User
Offline Off
Hi guys.

I need a lua. This code will be colored.
Will open more and more

Sample:

IMG:http://i.hizliresim.com/vXa1dz.png


Thanks.
Yardıma gerek duyduğun zaman kimsenin sana yardım etmeyeceği kadar kötü bir hayat..
06.01.17 12:11:15 am
Up
Rainoth
Moderator
Offline Off
Code:
1
2
3
4
5
addhook("say","_s")
function _s(id,txt)
     msg(player(id,"name").."\169255080000:"..txt)
     return 1
end
06.01.17 12:34:40 am
Up
Scott
BANNED
Offline Off
¿something like that?

Code:
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
Up
VADemon
User
Offline Off
@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:
[code]hcolor("COLORNAME")
-----
msg(hcolor("lavenderblush1") .. "Hello everyone!")
[/code]

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.
06.01.17 10:01:12 am
Up
vuenxx
User
Offline Off
...

"Will open more and more"
Yardıma gerek duyduğun zaman kimsenin sana yardım etmeyeceği kadar kötü bir hayat..
06.01.17 02:52:34 pm
Up
Fraizeraust
Moderator
Offline Off
@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?
06.01.17 03:27:10 pm
Up
Masea
Super User
Offline Off
Did even anyone understand what he wanted from us yet?
Create and design your GUI easy and fast: file cs2d GUI Framework (12) | Go deep of the darkness and try your intrepidity: file cs2d Outlast 2 Modification (27)
06.01.17 09:12:44 pm
Up
vuenxx
User
Offline Off
I found :

IMG:http://i.hizliresim.com/2nPNME.jpg


Thanks
Yardıma gerek duyduğun zaman kimsenin sana yardım etmeyeceği kadar kötü bir hayat..
To the start Previous 1 Next To the start