User Tag List

Page 2 of 4 FirstFirst 1 2 3 4 LastLast
Results 8 to 14 of 25

Thread: [Eluna] Simple World Chat System

  1. #8
    Original Poster
    Mad Scientist <span style='color: #008000'><span class='glow_006400'>slp13at420</span></span>'s Avatar



    Join Date
    Dec 2013
    Location
    Idaho
    Posts
    2,497
    XP
    20,134,837
    Level
    500
    Thanks
    1,092
    Thanked 333 Times in 213 Posts
    for this tho I think I can do something like (if lang == -1) AND (current message == prior message)

    - - - Updated - - -

    and then let it only spam the player.
    so then any addon will chat at the player but not the world ... maybe lol

    Try this @renatokeys .

    Code:
    
    
    
    -- by slp13at420 of EmuDevs.com
    -- a mutation of FoeReaper's world chat with basic bells an whistles.
    -- simple world chat WITHOUT the '#chat' command...WTF you say?
    -- just change to /say channel 
    -- turn it on
    -- and chat away.
    -- names are clickable for whispers and sub menu.
    
    local ACCT = {};
    local channel_name = "World Chat";
    local on = "#chat on";
    local off = "#chat off";
    local duration = 5; -- in seconds.
    
    local Team =  { -- colors for names and misc
    	[0] = "|cff3399FF", -- blue for alliance name
    	[1] = "|cffFF0000", -- red for horde name
    	[3] = "|cff000000", -- black for [channel name]
    	[4] = "|cff00cc00", -- green for "message"
    		};
    	
    local function ChatLogon(event, player)
    
    	ACCT[player:GetAccountId()] = {
    							chat = 0,
    							time = GetGameTime(),
    	};
    end
    
    RegisterPlayerEvent(3, ChatLogon)
    
    local function ChatSystem(event, player, msg, type, lang, channel)
    
    	if(lang ~= -1)then
    	
    		if(msg ~= "")then
    			
    			if(msg ~= "Away")then
    				
    				local acctid = player:GetAccountId();
    				local time = GetGameTime();
    				
    					if(msg == off)then
    						ACCT[acctid].chat = 0;
    						player:SendBroadcastMessage("|cff3399ffWorld chat off.|r")
    					return false;
    					end
    				
    					if(msg == on)then
    						ACCT[acctid].chat = 1;
    				    	player:SendBroadcastMessage("|cff3399ffWorld chat on.|r")
    				    return false;
    					end
    					
    					if(ACCT[acctid].chat == 1)then -- 0 = world chat off :: 1 = world chat on
    						if(time-ACCT[acctid].time >= duration)then
    						
    								local t = table.concat{"[", Team[3], channel_name, "|r]", "[", Team[player:GetTeam()],"|Hplayer:", player:GetName(),  "|h", player:GetName(), "|h", "|r]:", Team[4], msg, "|r"};
    								SendWorldMessage(t);
    								ACCT[acctid].time = time;
    						else
    					    		player:SendBroadcastMessage("|cff3399ffWorld chat spam timer detected.|r")
    						end				
    
    					return false;
    					end
    			end
    		end
    	end
    end
    	
    RegisterPlayerEvent(18, ChatSystem)
    
    print("Grumbo'z World Chat loaded.")
    it doesn't do anything if the lang is -1 so it wont interfere with the player receiving the msg and it also has an adjustable time check for delay between messages.

    hold on its frell'd

    - - - Updated - - -

    ok tested what I can but I don't have add-ons , it does work with delay check:

    Code:
    
    
    -- by slp13at420 of EmuDevs.com
    -- a mutation of FoeReaper's world chat with basic bells an whistles.
    -- simple world chat WITHOUT the '#chat' command...WTF you say?
    -- just change to /say channel 
    -- turn it on
    -- and chat away.
    -- names are clickable for whispers and sub menu.
    
    local ACCT = {};
    local channel_name = "World Chat";
    local on = "#chat on";
    local off = "#chat off";
    local duration = 5; -- in seconds.
    
    local Team =  { -- colors for names and misc
    	[0] = "|cff3399FF", -- blue for alliance name
    	[1] = "|cffFF0000", -- red for horde name
    	[3] = "|cff000000", -- black for [channel name]
    	[4] = "|cff00cc00", -- green for "message"
    		};
    	
    local function ChatLogon(event, player)
    
    	ACCT[player:GetAccountId()] = {
    							chat = 0,
    							time = GetGameTime(),
    	};
    end
    
    RegisterPlayerEvent(3, ChatLogon)
    
    local function ChatSystem(event, player, msg, type, lang, channel)
    
    	if(lang ~= -1)then
    	
    		if(msg ~= "")then
    			
    			if(msg ~= "Away")then
    				
    				local acctid = player:GetAccountId();
    				local time = GetGameTime();
    				
    					if(msg == off)then
    						ACCT[acctid].chat = 0;
    						player:SendBroadcastMessage("|cff3399ffWorld chat off.|r")
    					return false;
    					end
    				
    					if(msg == on)then
    						ACCT[acctid].chat = 1;
    				    	player:SendBroadcastMessage("|cff3399ffWorld chat on.|r")
    				    return false;
    					end
    					
    					if(ACCT[acctid].chat == 1)then -- 0 = world chat off :: 1 = world chat on
    						if(time-ACCT[acctid].time >= duration)then
    						
    								local t = table.concat{"[", Team[3], channel_name, "|r]", "[", Team[player:GetTeam()],"|Hplayer:", player:GetName(),  "|h", player:GetName(), "|h", "|r]:", Team[4], msg, "|r"};
    								SendWorldMessage(t);
    								ACCT[acctid].time = time;
    						else
    					    		player:SendBroadcastMessage("|cff3399ffWorld chat spam timer detected.|r")
    						end				
    
    					return false;
    					end
    			end
    		end
    	end
    end
    	
    RegisterPlayerEvent(18, ChatSystem)
    
    print("Grumbo'z World Chat loaded.")
    
    ok when language is -1 it should just pass thru to player. anything else will go to world chat where it then checks for duration between last world chat message.
    Last edited by slp13at420; 03-02-2016 at 12:20 AM.
    Achievements:
    Shopper Got a Sticky! Member 1 year registered Level XL Level D
    Awards:
    Pot Head LOL Raffle Winner Top Tagger Donator Hangman Scripter Repacker Drunk Support Member of Staff Da Bomb!
    "Cuz PvP's better with a bag 'o' weed"
    !! King Spade !!

    -Guild Plot System-
    Grumbo'z Guild Warz


    -VIP System-
    Grumbo'z VIP System

  2. #9
    Founder <span style='color: #FF4500'>Tommy</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    7,391
    XP
    3,449,104
    Level
    378
    Thanks
    889
    Thanked 1,858 Times in 1,120 Posts
    Imo you should remove the prints. That's a lot of console spam and you said it already works, so there's no real point in keeping them. :P

  3. #10
    Original Poster
    Mad Scientist <span style='color: #008000'><span class='glow_006400'>slp13at420</span></span>'s Avatar



    Join Date
    Dec 2013
    Location
    Idaho
    Posts
    2,497
    XP
    20,134,837
    Level
    500
    Thanks
    1,092
    Thanked 333 Times in 213 Posts
    Quote Originally Posted by Tommy View Post
    Imo you should remove the prints. That's a lot of console spam and you said it already works, so there's no real point in keeping them. :P
    rofl good catch n fixed :D

    `print` , best tool ever!!
    Achievements:
    Shopper Got a Sticky! Member 1 year registered Level XL Level D
    Awards:
    Pot Head LOL Raffle Winner Top Tagger Donator Hangman Scripter Repacker Drunk Support Member of Staff Da Bomb!
    "Cuz PvP's better with a bag 'o' weed"
    !! King Spade !!

    -Guild Plot System-
    Grumbo'z Guild Warz


    -VIP System-
    Grumbo'z VIP System

  4. #11
    Founder <span style='color: #FF4500'>Foereaper</span>'s Avatar
    Join Date
    Apr 2013
    Posts
    926
    XP
    38,862
    Level
    60
    Thanks
    125
    Thanked 329 Times in 156 Posts
    Why do you have so many empty else cases?

  5. #12
    Original Poster
    Mad Scientist <span style='color: #008000'><span class='glow_006400'>slp13at420</span></span>'s Avatar



    Join Date
    Dec 2013
    Location
    Idaho
    Posts
    2,497
    XP
    20,134,837
    Level
    500
    Thanks
    1,092
    Thanked 333 Times in 213 Posts
    Quote Originally Posted by Foereaper View Post
    Why do you have so many empty else cases?
    ermm I was prepping for responces n ermm forgot to remove them too lol
    ugh n fixed
    Last edited by slp13at420; 03-02-2016 at 12:22 AM.
    Achievements:
    Shopper Got a Sticky! Member 1 year registered Level XL Level D
    Awards:
    Pot Head LOL Raffle Winner Top Tagger Donator Hangman Scripter Repacker Drunk Support Member of Staff Da Bomb!
    "Cuz PvP's better with a bag 'o' weed"
    !! King Spade !!

    -Guild Plot System-
    Grumbo'z Guild Warz


    -VIP System-
    Grumbo'z VIP System

  6. #13
    Enthusiast
    Join Date
    Sep 2013
    Posts
    21
    XP
    2,422
    Level
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    lua_scripts/Chat23.lua:55: attempt to index field '?' (a nil value)

    "if(ACCT[acctid].chat == 1)then -- 0 = world chat off :: 1 = world chat on"

    any solution?

  7. #14
    Moderator / Eluna Dev <span style='color: #FF0000'><span class='glow_8B0000'>Rochet2</span></span>'s Avatar
    Join Date
    Apr 2013
    Location
    Finland
    Posts
    1,860
    XP
    13,531
    Level
    35
    Thanks
    95
    Thanked 592 Times in 419 Posts
    did you use .reload eluna
    ?

    I dont think the script is designed to be reloadable.
    Awards:
    Support LOL Scripter Facepalm! Raffle Winner
    rochet2.github.io - Home of great codes

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •