Recommended Posts

Posted (edited)

glr como faz para aparecer alguma tag no chat RP do mta tipo #00BFFF[ Twitter ] #FFFFFF e uma segunda tag #00BFFFDono #FFFFFF ?

se alguem puder me ajudar agradeço ^^

 

chat que uso:

chat_range=100 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"o","down","chatbox","LocalChat") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"o","down","chatbox","LocalChat") 
  end 
end) 
  
function isPlayerInRangeOfPoint(player,x,y,z,range) 
   local px,py,pz=getElementPosition(player) 
   return ((x-px)^2+(y-py)^2+(z-pz)^2)^0.5<=range 
end 
  
function onChat(player,_,...) 
  local px,py,pz=getElementPosition(player) 
  local msg = table.concat({...}, " ") 
  local nick=getPlayerName(player) 
local r,g,b = getTeamColor(getPlayerTeam(player)) 
  for _,v in ipairs(getElementsByType("player")) do 
    if isPlayerInRangeOfPoint(v,px,py,pz,chat_range) then 
      outputChatBox("#00ff00ChatLocal  #ffffff"..nick.."#00ff00 - #00ff00"..msg,v,r,g,b,true) 
    end 
  end 
end 
addCommandHandler("LocalChat",onChat) 

function MensagemTwitter(source, cmd, ...) 
    local MessagemT = table.concat ( { ... }, " " )
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
    outputChatBox("#00BFFFTwitter  #ffffff"..name.."#00BFFF - #00BFFF"..MessagemT,v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("Twitter",  MensagemTwitter)
  
addCommandHandler( "DeepWeb", function ( source, cmd, ... )            
    local message2 = #{...} > 0 and table.concat({...}," ") or nil
    if message2 then
        for _, p in ipairs (getElementsByType("player")) do
            if hasObjectPermissionTo(p, "command.mute", true) then
                outputChatBox("#696969DeepWeb  #ffffff"..getPlayerName(source).."#696969 - #696969"..message2, p, 255, 255, 255, true)
            else
                outputChatBox("#696969DeepWeb  #696969"..message2, p, 255, 255, 255, true)
            end
        end
    else
    end
end )

addCommandHandler( "staff", function ( source, cmd, ... )            
    local message2 = #{...} > 0 and table.concat({...}," ") or nil
    if message2 then
        for _, p in ipairs (getElementsByType("player")) do
            if hasObjectPermissionTo(p, "command.mute", true) then
                outputChatBox("#262523[ #696969#FFBA00STAFF #262523] #ffffff"..getPlayerName(source).."#696969 - #FFBA00"..message2, p, 255, 255, 255, true)
            else
                outputChatBox("#FFBA00STAFF  #696969"..message2, p, 255, 255, 255, true)
            end
        end
    else
    end
end )

addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "i", "down", "chatbox", "Twitter")
end 
) 

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
  for index,player in pairs(getElementsByType("player")) do 
        bindKey(player,"i", "down", "chatbox", "Twitter")
  end 
end 
) 

addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "u", "down", "chatbox", "DeepWeb")
end 
) 

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
  for index,player in pairs(getElementsByType("player")) do 
        bindKey(player,"u", "down", "chatbox", "DeepWeb")
  end 
end 
) 

addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "x", "down", "chatbox", "staff")
end 
) 

addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), function() 
  for index,player in pairs(getElementsByType("player")) do 
        bindKey(player,"x", "down", "chatbox", "staff")
  end 
end 
) 

 

Edited by DNL291
Código adicionado com a formatação Lua

Share this post


Link to post
Posted (edited)

Da próxima vez cole o código do jeito correto pois fica mais legível e não direto no texto. 

SSEaVoh.png

Edited by Renazz

Share this post


Link to post

Verifique a ACL Group do usuário por meio da função isObjectInACLGroup. Qualquer resource de TAGs já faz isso, basta saber colar no seu código de chat.

Share this post


Link to post

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.