• This is a read only backup of the old Emudevs forum. If you want to have anything removed, please message me on Discord: KittyKaev

[SOLVED] [TC Wotlk] Chat System

Status
Not open for further replies.

Unknown96

Exalted Member
I just now tried to edit a script I found on this website that was originally made by Gumbo'z I think, also edited by Syd(numbers) or what his name now was. How ever I received an error after completing the modifications to the script that I can't really figure out why.

I would like some assistance and explanations about what went wrong in my editing,

Just the Edits Paste
Full Script Paste <- Error line 71

Best Regards, Unknown96.
 

Tommy

Founder
There's an extra comma almost at the end near "msg". (Extra comma is in LIME)

Code:
local t = table.concat{"[", Faction[player:GetTeam()], channel_name, "|r]", RankC[player:GetGMRank()],  Rank[player:GetGMRank()], "|r", ClassC[player:GetClassByString()] ,player:GetName()"|r]|cFFF8F8FF:", [COLOR="#00FF00"],[/COLOR] msg, "|r"};

Remove the comma and that error will lift. Also, future advice: paste the full error you received in your post.
 

Unknown96

Exalted Member
There's an extra comma almost at the end near "msg". (Extra comma is in LIME)
Remove the comma and that error will lift. Also, future advice: paste the full error you received in your post.

Thank you and I actually did but only in the "Just Edited Paste" I assumed that would be the place that would be looked at first but I will remember to do that for future events :)

Error Message : Line 69: attempt to index field '?' (a nil value)

--Line 69--​
Code:
if(ACCT[player:GetAccountId()].chat == 1)then

--Line 71--​
Code:
local t = table.concat{"[", Faction[player:GetTeam()], channel_name, "|r]", RankC[player:GetGMRank()],  Ranks[player:GetGMRank()], "|r", ClassC[player:GetClassByString()], player:GetName(), "|r]|cFFF8F8FF:", msg, "|r"}
 
Last edited:

Unknown96

Exalted Member
There is actually a comma there in the code quote just on the 2th line since the code is to long, how ever I'm still receiving the same error but now on two lines

Lines effected
58, 64

Also changed
player:GetClassByString() to player:GetClassAsString() since the other method was invalid
 
Last edited:

Rochet2

Moderator / Eluna Dev
cant remember other than the classasstring, commas I already mentioned, the double comma thing tommy said, Ranks aaand .. nope.
 

slp13at420

Mad Scientist
the original post: http://emudevs.com/showthread.php/4302-Eluna-Simple-World-Chat-System

here is a copy of my own version:

Code:
[COLOR="#808080"]
-- simple world chat WITHOUT the '#chat' command...WTF you say?
-- just  turn it on and chat away.
-- when your done you just turn it off.
-- names are clickable for whispers and sub menu.

local on = "#chat on";
local off = "#chat off";
local WC_commands = "#help world chat"; -- "/help" won't work. it gets parsed prior to Eluna chat hook.

local Wchat = {};

local Team =  {
	[0] = "[|TInterface\\icons\\Inv_Misc_Tournaments_banner_Human.png:13|t]",
	[1] = "[|TInterface\\icons\\Inv_Misc_Tournaments_banner_Orc.png:13|t]"
		};
local Class = { 
	[1] = "[|TInterface\\icons\\INV_Sword_27.png:13|t]",
        [2] = "[|TInterface\\icons\\INV_Hammer_01.png:13|t]",
        [3] = "[|TInterface\\icons\\INV_Weapon_Bow_07.png:13|t]",
        [4] = "[|TInterface\\icons\\INV_ThrowingKnife_04.png:13|t]",
        [5] = "[|TInterface\\icons\\INV_Staff_30.png:13|t",
        [6] = "[|TInterface\\icons\\Spell_Deathknight_ClassIcon.png:13|t]",
        [7] = "[|TInterface\\icons\\inv_jewelry_talisman_04.png:13|t]",
        [8] = "[|TInterface\\icons\\INV_Staff_30.png:13|t]",
        [9] = "[|TInterface\\icons\\INV_Staff_30.png:13|t]",
        [11] = "[|TInterface\\icons\\Ability_Druid_Maul.png:13|t]",
		};
local Gmrank = {
	[0] = "|cff00ffff[Player]|r",
	[1] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t]|cffff0000[GM1]|r",
	[2] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t|cffff0000[GM2]|r",
	[3] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t|cffff0000[GM3]|r",
	[4] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t][|cff999999ADMIN|r]",
		};
	
function ChatSystem(event, player, msg, type, lang, channel)

local acctid = player:GetAccountId();

	if(msg ~= "")then
		
		if(msg ~= "Away")then
			
			if(msg == off)then
				Wchat[acctid].chat = 0;
				player:SendBroadcastMessage("|cff3399ffWorld chat off.|r")
			return false;
			end
		
			if(msg == on)then
				Wchat[acctid].chat = 1;
		    		player:SendBroadcastMessage("|cff3399ffWorld chat on.|r")
		    	return false;
			end
		
			if(Wchat[acctid].chat == 1)and(msg ~= WC_commands)then -- 0 = world chat off :: 1 = world chat on
				local t = table.concat{Team[player:GetTeam()], Class[player:GetClass()], Gmrank[player:GetGMRank()], "[|cff3399ff","|Hplayer:", player:GetName(),  "|h", player:GetName(), "|h", "|r]:|cff00cc00",  msg};
				SendWorldMessage(t)
			return false;
			end
		else
		end
	else
	end
end

RegisterPlayerEvent(18, ChatSystem)

function VIP_Wchat_comm(event, player, message, type, language)
    if(event == 3)or(message:lower() == WC_commands)then
     	player:SendBroadcastMessage("|cff00cc00World Chat System:|r")
     	player:SendBroadcastMessage("-->/say "..on.."|cff00cc00 to turn on the world chat.|r")
     	player:SendBroadcastMessage("-->|cff00cc00Then just chat away on `/say` channel.|r")
    	player:SendBroadcastMessage("-->/say "..off.."|cff00cc00 to turn off the world chat.|r")
    	player:SendBroadcastMessage("-->/say "..WC_commands.."|cff00cc00 for this list of commands.|r")
	end
return;
end

RegisterPlayerEvent(3, VIP_Wchat_comm)
RegisterPlayerEvent(18, VIP_Wchat_comm)

local function SetChat(event, player)

	local acctid = player:GetAccountId();

	Wchat[acctid] = {
				chat = 0,
	};
end

RegisterPlayerEvent(3, SetChat)

print("Grumbo'z World Chat loaded.")
[/COLOR]

Just hop on '/say' channel and type '#chat on' and chat away.
when you are done just type '/say #chat off' to turn it off.
Only operates in local chat channel '/say'.

this one is just kinda behind in comparison to my original release. and this is a mutation of FoeReapers world chat.
in my original release colors were tabled.never mind lol they did a class based color table :D good idea for LFG'n.
instructions are handy too.
 
Last edited:

Unknown96

Exalted Member
Code:
[COLOR="#808080"]
-- simple world chat WITHOUT the '#chat' command...WTF you say?
-- just  turn it on and chat away.
-- when your done you just turn it off.
-- names are clickable for whispers and sub menu.

local on = "#chat on";
local off = "#chat off";
local WC_commands = "#help world chat"; -- "/help" won't work. it gets parsed prior to Eluna chat hook.

local Wchat = {};

local Team =  {
	[0] = "[|TInterface\\icons\\Inv_Misc_Tournaments_banner_Human.png:13|t]",
	[1] = "[|TInterface\\icons\\Inv_Misc_Tournaments_banner_Orc.png:13|t]"
		};
local Class = { 
	[1] = "[|TInterface\\icons\\INV_Sword_27.png:13|t]",
        [2] = "[|TInterface\\icons\\INV_Hammer_01.png:13|t]",
        [3] = "[|TInterface\\icons\\INV_Weapon_Bow_07.png:13|t]",
        [4] = "[|TInterface\\icons\\INV_ThrowingKnife_04.png:13|t]",
        [5] = "[|TInterface\\icons\\INV_Staff_30.png:13|t",
        [6] = "[|TInterface\\icons\\Spell_Deathknight_ClassIcon.png:13|t]",
        [7] = "[|TInterface\\icons\\inv_jewelry_talisman_04.png:13|t]",
        [8] = "[|TInterface\\icons\\INV_Staff_30.png:13|t]",
        [9] = "[|TInterface\\icons\\INV_Staff_30.png:13|t]",
        [11] = "[|TInterface\\icons\\Ability_Druid_Maul.png:13|t]",
		};
local Gmrank = {
	[0] = "|cff00ffff[Player]|r",
	[1] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t]|cffff0000[GM1]|r",
	[2] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t|cffff0000[GM2]|r",
	[3] = "|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t|cffff0000[GM3]|r",
	[4] = "[|TINTERFACE/CHATFRAME/UI-CHATICON-BLIZZ:13:13:0:-1|t][|cff999999ADMIN|r]",
		};
	
function ChatSystem(event, player, msg, type, lang, channel)

local acctid = player:GetAccountId();

	if(msg ~= "")then
		
		if(msg ~= "Away")then
			
			if(msg == off)then
				Wchat[acctid].chat = 0;
				player:SendBroadcastMessage("|cff3399ffWorld chat off.|r")
			return false;
			end
		
			if(msg == on)then
				Wchat[acctid].chat = 1;
		    		player:SendBroadcastMessage("|cff3399ffWorld chat on.|r")
		    	return false;
			end
		
			if(Wchat[acctid].chat == 1)and(msg ~= WC_commands)then -- 0 = world chat off :: 1 = world chat on
				local t = table.concat{Team[player:GetTeam()], Class[player:GetClass()], Gmrank[player:GetGMRank()], "[|cff3399ff","|Hplayer:", player:GetName(),  "|h", player:GetName(), "|h", "|r]:|cff00cc00",  msg};
				SendWorldMessage(t)
			return false;
			end
		else
		end
	else
	end
end

RegisterPlayerEvent(18, ChatSystem)

function VIP_Wchat_comm(event, player, message, type, language)
    if(event == 3)or(message:lower() == WC_commands)then
     	player:SendBroadcastMessage("|cff00cc00World Chat System:|r")
     	player:SendBroadcastMessage("-->/say "..on.."|cff00cc00 to turn on the world chat.|r")
     	player:SendBroadcastMessage("-->|cff00cc00Then just chat away on `/say` channel.|r")
    	player:SendBroadcastMessage("-->/say "..off.."|cff00cc00 to turn off the world chat.|r")
    	player:SendBroadcastMessage("-->/say "..WC_commands.."|cff00cc00 for this list of commands.|r")
	end
return;
end

RegisterPlayerEvent(3, VIP_Wchat_comm)
RegisterPlayerEvent(18, VIP_Wchat_comm)

local function SetChat(event, player)

	local acctid = player:GetAccountId();

	Wchat[acctid] = {
				chat = 0,
	};
end

RegisterPlayerEvent(3, SetChat)

print("Grumbo'z World Chat loaded.")
[/COLOR]

Thanks for sharing, I might even change to this but with a few edits, just this time I will be more care full with comma and my own table names x.x, Also thanks for sharing the first script I modified! :)
 
Status
Not open for further replies.
Top