Jump to content

Making my own chat


Recommended Posts

Hey guys, I'd like to know how I can make a mta chat of my own like Teamsay, but only for staff members. 

For example,

(staff) User: There's someone spamming in Shooter arena

The staff chat should be binded to a key like "J" or "H". 

Does anyone know how I can get started with that? 

Link to comment

It should be possible, just a concept, not sure it works with this code, but you can modify the rest. 


 

--- server 

addCommandHandler("adminchat", function(player, _, ...)
	for _,v in ipairs(getElementsByType("player")) do
		if isObjectInACLGroup("user."..account,aclGetGroup("Staff")) then --- uses ACL to determine who is able use.
			if (getElementData(v, "adminchat") == getElementData(player, "adminchat")) then
				outputChatBox("#7D6608[Admin]#9A7D0A"..getPlayerName(player):gsub("#%x%x%x%x%x%x", "").."#7D6608: #FFFFFF"..table.concat({...}, " "):gsub("#%x%x%x%x%x%x", ""), v, 255, 255, 255, true);
			end
		end
	end
end);





--- client
bindKey("u", "down", "chatbox", "adminchat");

 

Edited by Mischief-1
  • Like 1
Link to comment

Please disregard the post above..


This is a working code

----server
addCommandHandler("adminchat", function(player, _, ...)
	local account = getAccountName(getPlayerAccount(player)) --get the player account 
	for _,v in ipairs(getElementsByType("player")) do
		if isObjectInACLGroup("user." .. account, aclGetGroup("Staff")) then --- this section you can customize which ACL role they are.
			outputChatBox("#7D6608[Admin]#9A7D0A"..getPlayerName(player):gsub("#%x%x%x%x%x%x", "").."#7D6608: #FFFFFF"..table.concat({...}, " "):gsub("#%x%x%x%x%x%x", ""), v, 255, 255, 255, true); --- thisplay chat you can customize as well.
        else
        outputChatBox("You don't have enough access to use this chat!")
		end
	end
end
)


---client
bindKey("h", "down", "chatbox", "adminchat");

 

Please hit like on 2 of my posts if these helped you :) 

Edited by Mischief-1
  • Like 2
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...