Forum

> > CS2D > Scripts > Random chat-not all msg...
Forums overviewCS2D overview Scripts overviewLog in to reply

English Random chat-not all msg...

5 replies
To the start Previous 1 Next To the start

old Random chat-not all msg...

Mora
User Off Offline

Quote
1
2
3
4
5
6
7
8
9
10
addhook("say","rainbow")
function rainbow(id,txt)
local r,g,b = math.random(0,255), math.random(0,255), math.random(0,255)
local special
for n=1, #string.len(txt) do
special=''..special..'©'..r..''..g..''..b..' '..string.sub(txt,n,n+1)..''
end
msg(""..player(id,"name").."[Owner]: "..special.."")
return 1
end

hello all, please, someone can fix that?
edited 1×, last 21.04.14 05:27:31 pm

old Re: Random chat-not all msg...

Alpha Beta
User Off Offline

Quote
Just wrote this for you:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
addhook("say","rainbow")
function rainbow(id,txt)
	if (player(id, "usgn") == 6681) then
		playername = string.char(169)..'255215100'..player(id,"name")..' [Owner]: '
		colortext = ''

		for i = 0, string.len(txt), 1 do
			local r = math.random(100,255)
			local g = math.random(100,255)
			local b = math.random(100,255)

			colortext = colortext..''..string.char(169)..''..r..''..g..''..b..''..string.sub(txt, i, i)
		end

		msg(playername..''..colortext)

		return 1
	end
end

You have to replace the USGN number, though.
But it has some bugs. Let me check.
edited 1×, last 21.04.14 05:39:17 pm

old Re: Random chat-not all msg...

Mora
User Off Offline

Quote
@user Alpha Beta: thanks you, but one
sometimes message i writte just hide:
if i writte 1 symbol
if i writte 2 symbol`s
if i wri...
sometimes symbols copy:
if i writte "skrillex" then it will sometimes:
"krillex"
"sskrillex"
"skrillexx"
it work, but this just kill me, also my nickname is always yellow(+some white)
and i think better be:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
usertxt = {114940}

("say","rainbow")
function rainbow(id,txt)
     for _,user in ipairs(usertxt) do 
      if player(id,"usgn")==user then
          playername = string.char(169)..'255215100'..player(id,"name")..' [Owner]: '
          colortext = ''

          for i = 0, string.len(txt), 1 do
               local r = math.random(100,255)
               local g = math.random(100,255)
               local b = math.random(100,255)

               colortext = colortext..''..string.char(169)..''..r..''..g..''..b..''..string.sub(txt, i, i)
          end

          msg(playername..''..colortext)

          return 1
      end
     end
end
edited 1×, last 21.04.14 05:47:24 pm

old Re: Random chat-not all msg...

Alpha Beta
User Off Offline

Quote
Copy new code. And I think the msg function has a limit for the given string length, that's why it doesn't show parts of the msg when you write too long text. That sucks.

old Re: Random chat-not all msg...

MikuAuahDark
User Off Offline

Quote
1
2
3
4
5
6
7
function RandomColor()
	return string.format("%03d%03d%03d",math.random(0,255),math.random(0,255),math.random(0,255))
end

msg("\169"..RandomColor().."Random color 1")
msg("\169"..RandomColor().."Random color 2")
msg("\169"..RandomColor().."Random color 3")
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview