playeri want to make say color lua, but able to on/off,
example :
when i say "!say off" then the say color is off,and when i say "!say on" then the say color is on.
can anyone make it for me?
thx before
Scripts
saycolor can be on/off
saycolor can be on/off
1

player
colors = {}
for i = 1,32 do
	colors[i] = false
end
addhook("join","_join")
function _join(id)
	colors[id] = false
end
addhook("say","_say")
function _say(id,txt)	
	if txt:sub(1,1) == "!" then	
		if txt:lower():sub(2,4) == "say" then
			local p = txt:lower():sub(6,8)
			if p == "on" then
				colors[id] = true
				msg2(id,"Color message activated")
			elseif p == "off" then
				colors[id] = false
				msg2(id,"Color message deactivated")
			end
			return 1
		end
	else
		if colors[id] == true then
			msg("©255255255"..player(id,"name")..": "..txt)
			return 1
		end
	end
end
sheeL: Check your serveraction function, dude. Also, there are many ways to shorten your code
admins = {108942};
Colors = {
	[1] = "255000000";
	[2] = "255100000";
	[3] = "000000255";
	[4] = "000255000";
	[5] = "000000000";
	[6] = "255255255";
	[7] = "255255000";
};
colors = {};
Player = {};
addhook("join","onJoin")
function onJoin(id)
	Player[id] = {};
	Player[id].color = 0;
end
addhook("serveraction","onServeraction")
function onServeraction(id, key)
	for _, i in ipairs(admins) do
		if player(id,"usgn") == i then
			if key == 1 then
				menu(id,"Select color,Red Color,Orange color,Blue Color,Green Color,Black Color,White Color,Neutral Color,Disable")
			end
		end
	end
end
addhook("menu","onMenu")
function onMenu(id, t, b)
	if t == "Select color" then
		if b > 0 and b < 8 then
			Player[id].color = b;
		elseif b == 8 then
			Player[id].color = 0;
		end
	end
end
addhook("say","onSay",1)
function onSay(id, txt)
	for _, i in ipairs(admins) do
		if player(id,"usgn") == i then
			if Player[id].color ~= 0 then
				msg("©".. Colors[Player[id].color] .. player(id,"name") .." [Admin]: ".. txt);
				return 1;
			end
		end
	end
end
EP has written
sheeL: Check your serveraction function, dude. Also, there are many ways to shorten your code 
EP: thx for the script man, works everytime
ReVoltage has written
EP: thx for the script man, works everytime

command == "!say";
player = {};
addhook("join","_join")
function _join(id)
	player[id] = {};
	player[id].text = true;
end
addhook("say","_say")
function _say(id, txt)
	if txt == command then
		if not player[id].text then
			player[id].text = true;
			msg2(id,"©000255000Color message activated");
		else
			player[id].text = false;
			msg2(id,"©255000000Color message deactivated");
		end
		return 1;
	elseif player[id].text then
		msg("©255255255"..player(id,"name")..": "..txt);
		return 1;
	end
end
say
ReVoltage has written
EP: thx for the script man, works everytime

ReVoltage: I tested the script, and does not appear in chat , because he used "return 1", Do not mix with other script, why we advise you to use menu
Gajos: Your script don't works, have many error
ReVoltage: This Workscommand = "!say";
admins = {45813,xxxxx}; -- YOUR USGN ID HERE
color = {};
addhook("join","Onjoin")
function Onjoin(id)
color[id] = 0;
end;
addhook("say","OnSay")
function OnSay(id,txt)
for _, k in ipairs(admins) do
if player(id,"usgn") == k then
if txt:lower() == ""..command.." on" then
color[id]=1;
msg2(id,"©000255000Say Color Enabled");
return 1;
elseif txt:lower() == ""..command.." off" then
color[id]=0;
msg2(id,"©255000000Say Color Disabled");
return 1;
elseif color[id] == 1 then
msg("©255255255"..player(id,"name").."/Admin/ : "..txt);
return 1;
end;
end;
end;
end
EP: and @
sheeL: thx to you two guys
command = "!say";
Player = {};
addhook("join","_join")
function _join(id)
	Player[id] = {};
	Player[id].text = true;
end
addhook("say","_say")
function _say(id, txt)
	if txt == command then
		if not Player[id].text then
			Player[id].text = true;
			msg2(id,"©000255000Color message activated");
		else
			Player[id].text = false;
			msg2(id,"©255000000Color message deactivated");
		end
		return 1;
	elseif Player[id].text then
		msg("©255255255"..player(id,"name")..": "..txt);
		return 1;
	end
end
Gajos has writtencommand = "!say";
Player = {};
addhook("join","_join")
function _join(id)
	Player[id] = {};
	Player[id].text = true;
end
addhook("say","_say")
function _say(id, txt)
	if txt == command then
		if not Player[id].text then
			Player[id].text = true;
			msg2(id,"©000255000Color message activated");
		else
			Player[id].text = false;
			msg2(id,"©255000000Color message deactivated");
		end
		return 1;
	elseif Player[id].text then
		msg("©255255255"..player(id,"name")..": "..txt);
		return 1;
	end
end
Gajos: , the issue has already been resolved because still posting?
ReVoltage: if you need help, send pm to me...
1
