Fantanic Posted April 12, 2014 Posted April 12, 2014 Hello , Im a bit stuck with a script. (class chat) So wich functions do i need to use ? those? ; getElementData ouputChatbox greetings
Fantanic Posted April 12, 2014 Author Posted April 12, 2014 sort of teamchat but then only the one in the same class can see it for example if u do /class then u get chatbox if u typed "hoi" it goes to all players who are in that class ( guees getElementData is needed)
monumento Posted April 12, 2014 Posted April 12, 2014 getElementsByType for loop getElementData outputChatBox
MulTi96 Posted April 12, 2014 Posted April 12, 2014 TeamPlayer = {}; TeamPlayer.__index = TeamPlayer; ChatPlayer = {}; function TeamPlayer:Enter( player ) if ( ChatPlayer[player] ) then return; end local objector = {}; objector.player = player; objector.class = false; _chatenter = function() objector:EnterChat() end; _chatfunction = function( msg, type ) objector:Chat( msg, type ) end; addCommandHandler("class", _chatenter); addEventHandler("onPlayerChat", root, _chatfunction); table.insert( ChatPlayer, objector.player ); setmetatable( objector, self ); return objector; end function TeamPlayer:EnterChat( ) if ChatPlayer[self.player] then self.class = true; end end function TeamPlayer:Chat(msg) if ( self.class ) then cancelEvent() for k, v in pairs( ChatPlayer ) do outputChatBox(msg, v, 255, 255, 255 ) end end end function LeaveOutClassChat( player ) for k, v in pairs( ChatPlayer ) do if v == player then table.remove( ChatPlayer, k ); end end return true end addCommandHandler("leaveclass", LeaveOutClassChat) function enterInClassChat( player ) TeamPlayer:Enter( player ); end addCommandHandler("enterclass", enterInClassChat)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now