Jump to content

Chat type


-Doc-

Recommended Posts

There's a simpler way

Make a script with for example a command /radio with a 3rd argument which will be our chat text in a string.

I did this just for youu :

function isPlayerInTeam(player, team) 
    assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]") 
    assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]") 
    return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true))) 
end --isplayerinteam is from wiki mta 
function radioCommand(thePlayer,cmdname,arg3) 
 local playerName = getPlayerName(thePlayer) 
   if isPlayerInTeam(thePlayer, "Police") then  -- 2nd argument is the string name of the team that is created on server 
   for i, players in ipairs(getPlayersInTeam(getTeamFromName("Police"))) do 
    outputChatBox(""..playerName..":" ..arg3.."",players,0,255,255) 
   end 
   else 
   outputChatBox("You need to be in the Police team to use this command!",thePlayer,255,0,0) 
end 
end 
addCommandHandler("radio",radioCommand) 

Now after you have the radio thing for example in your server use bindKey to (bind key chatbox cmdname example bind u chatbox radio)

You can use my lua example to make new chats if this is what you asked for u weren't very specific.

Instead of using isPlayerInTeam you can use your script but this is good if you want to make specific chats for example the radio for the police team u can do almost anything u want with this example, except draw new chat if u meant that im not sure about that honestly.

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...