Forum

> > CS2D > Scripts > How to create menu chat color
Forums overviewCS2D overview Scripts overviewLog in to reply

English How to create menu chat color

11 replies
To the start Previous 1 Next To the start

old How to create menu chat color

MaxmyA_TN
BANNED Off Offline

Quote
hi , i want ask ; how to make chat color in menu exmp:
when u press button color exp : red then u say color exp : ©25552552554m4axmya Tn "..txt)

old Re: How to create menu chat color

Ace Howl
User Off Offline

Quote
This one is simple. Consist of 9 colours, default colour on cancel button.
Global chat only >

old Re: How to create menu chat color

GeoB99
Moderator Off Offline

Quote
• Just a side note

The script made by user Ace Howl works without problems with the exception that it occupies all the serveraction buttons without letting space for other scripts which may use serveraction button. For that, here I've just tweaked it a bit from 12 to 14 line.
1
2
3
4
5
function txt.sa(id, action)
	if action == 1 then
		menu(id,"Chat Colour,White,Pink,Red,Orange,Green,Blue,Brown,Gray,Black")
	end
end
It's not a big deal but it's more advisable to keep only one reserved button for a simple script with only one menu. The rest can be used for other scripts.

old Re: How to create menu chat color

Yates
Reviewer Off Offline

Quote
user MaxmyA_TN has written
@user Zeik: it sucks

Can you tell me why so I can fix the sucky part? Or are you just mad and would like to throw out pathetic insults? Both are fine by me, whatever makes your day I guess.

old Re: How to create menu chat color

Dousea
User Off Offline

Quote
This code is untested. It may contains bugs. It should do pretty much the same as user Ace Howl's 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
maincolor = {
	"White=255255255",
	"Pink=255128255",
	"Red=255000000",
	"Orange=255128000",
	"Green=000255000",
	"Blue=000000255",
	"Brown=128064000",
	"Gray=128128128",
	"Black=000000000"
}
playercolor = {}

for id = 1, 32 do
	playercolor[id] = 0
end

for index, hook in ipairs({"serveraction", "menu", "say"}) do
	addhook(hook, hook .. "hook")
end

function serveractionhook(id, action)
	if (action == 1) then
		local contents = "Chat Color,"
		
		for index, value in ipairs(maincolor) do
			local name = value:match("(%s*)=(%d*)")
			
			contents = contents .. name .. (index < #maincolor and "," or "")
		end
		
		menu(id, contents)
	end
end

function menuhook(id, title, button)
	if (title == "Chat Color") then
		if (button >= 1 and button <= 9) then
			playercolor[id] = button
		end
	end
end

function sayhook(id, message)
	if (playercolor[id] > 0) then
		local name, color = maincolor[playercolor[id]]:match("(%s*)=(%d*)")
		
		msg(player(id, "name") .. ": "\169" .. color .. message)
	end
end

old Re: How to create menu chat color

Rainoth
Moderator Off Offline

Quote
Allow me to elaborate.
While user Yates's file cs2d Yates - Shit menu colour/color say/chat changer is indeed a very powerful tool. It does not have any predefined values and as such requires at least 8 brain cells and a couple of minutes to reach the desired effect.
I had similarly commented about his Y.A.T.E.S project - people are just too lazy/dumb to make stuff themselves so it's good to have pre-made things.
All these chat menu scripts do just that.

old Re: How to create menu chat color

Zeik
User Off Offline

Quote
In that case... It wouldn't be bad to extend Yates' script functionality so it lets you save colors from its menu. That way you can change "predefined" colors directly in-game.

old Re: How to create menu chat color

Yates
Reviewer Off Offline

Quote
Yeah you could just assign the RGBV values which my script uses with a menu allowing you to still use the shit colour say changer whenever you want.
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview