Jump to content

COMO EU COLOCO TAG NO CHAT DE RP ?


Recommended Posts

function MensagemTwitter(source, cmd, ...) 
    local MessagemT = table.concat ( { ... }, "T" )
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("Twitter",  MensagemTwitter)
  
function MensagemAnon(source, cmd, ...) 
    local MessagemANS = table.concat ( { ... }, "T" ); 
for _,v in ipairs(getElementsByType("player")) do 
    outputChatBox("#ffffff[ #696969 [ BsB™DeepWeb ] #ffffff] #696969"..MessagemANS,v, 255, 255, 255, true) 
    end 
end 


addCommandHandler("DeepWeb",  MensagemAnon)
  
function MensagemRP(source, cmd, ...) 
    local MessagemFRP = table.concat ( { ... }, "" ); 
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
    outputChatBox("#000000[ #ffffff [BsB™Fora RP]#000000] "..name.." #ffffff"..MessagemFRP,v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("forarp",  MensagemRP)

addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "Y", "down", "chatbox", "Twitter")
  bindKey(source, "U", "down", "chatbox", "Deepweb")
  bindKey(source, "i", "down", "chatbox", "forarp")
end 
) 

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

chat_range=100 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"t","down","chatbox","ChatLocal") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"t","down","chatbox","ChatLocal") 
  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("᠉ #00ff00 [ BsB™Local ]  - #ffffff"..nick.."#00ff00 - #ffffff"..msg,v,r,g,b,true) 
    end 
  end 
end 
addCommandHandler("ChatLocal",onChat) 

 

voce sabe  pq o meu chat local quando eu do um comando por exemplo

/chat

aparece tudo no chat local ??

Link to comment
26 minutes ago, krazyY said:

function MensagemTwitter(source, cmd, ...) 
    local MessagemT = table.concat ( { ... }, "T" )
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("Twitter",  MensagemTwitter)
  
function MensagemAnon(source, cmd, ...) 
    local MessagemANS = table.concat ( { ... }, "T" ); 
for _,v in ipairs(getElementsByType("player")) do 
    outputChatBox("#ffffff[ #696969 [ BsB™DeepWeb ] #ffffff] #696969"..MessagemANS,v, 255, 255, 255, true) 
    end 
end 


addCommandHandler("DeepWeb",  MensagemAnon)
  
function MensagemRP(source, cmd, ...) 
    local MessagemFRP = table.concat ( { ... }, "" ); 
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
    outputChatBox("#000000[ #ffffff [BsB™Fora RP]#000000] "..name.." #ffffff"..MessagemFRP,v, 255, 255, 255, true) 
    end 
end 
addCommandHandler("forarp",  MensagemRP)

addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "Y", "down", "chatbox", "Twitter")
  bindKey(source, "U", "down", "chatbox", "Deepweb")
  bindKey(source, "i", "down", "chatbox", "forarp")
end 
) 

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

chat_range=100 
  
addEventHandler("onPlayerJoin",getRootElement(), 
function () 
bindKey(source,"t","down","chatbox","ChatLocal") 
end) 
  
addEventHandler("onResourceStart",getResourceRootElement(getThisResource()), 
function () 
for index, player in pairs(getElementsByType("player")) do 
bindKey(player,"t","down","chatbox","ChatLocal") 
  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("᠉ #00ff00 [ BsB™Local ]  - #ffffff"..nick.."#00ff00 - #ffffff"..msg,v,r,g,b,true) 
    end 
  end 
end 
addCommandHandler("ChatLocal",onChat) 

 

voce sabe  pq o meu chat local quando eu do um comando por exemplo

/chat

aparece tudo no chat local ??

O Gamemode "play" ou "freeroam" está ativado ?

Link to comment
4 minutes ago, krazyY said:

Ok e como eu coloco a tag nesse CHAT RP ?

function MensagemTwitter(source, cmd, ...) 
    local MessagemT = table.concat ( { ... }, "T" )
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
  conta = getAccountName ( getPlayerAccount ( source ) )

    if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

       end     
    end 
end 
addCommandHandler("Twitter",  MensagemTwitter)
  
function MensagemAnon(source, cmd, ...) 
    local MessagemANS = table.concat ( { ... }, "T" ); 
for _,v in ipairs(getElementsByType("player")) do 
    conta = getAccountName ( getPlayerAccount ( source ) )

    if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

        end
    end 
end 


addCommandHandler("DeepWeb",  MensagemAnon)
  
function MensagemRP(source, cmd, ...) 
    local MessagemFRP = table.concat ( { ... }, "" ); 
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
    conta = getAccountName ( getPlayerAccount ( source ) )

    if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)
        end
    end 
end 
addCommandHandler("forarp",  MensagemRP)

addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "Y", "down", "chatbox", "Twitter")
  bindKey(source, "U", "down", "chatbox", "Deepweb")
  bindKey(source, "i", "down", "chatbox", "forarp")
end 
) 

OBS: Não testado. Qualquer erro só enviar print do "/debugscript 3".
OBS: Só mudar a posição do "Nome do grupo" para o "Everyone". Pois quem tem a tag geral não vai aparecer a tag se ela estiver acima.

Edited by Luccas
errado
Link to comment
  • 8 months later...
On 03/10/2019 at 17:41, Luccas said:

function MensagemTwitter(source, cmd, ...) 
    local MessagemT = table.concat ( { ... }, "T" )
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
  conta = getAccountName ( getPlayerAccount ( source ) )

    if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™Twitter ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

       end     
    end 
end 
addCommandHandler("Twitter",  MensagemTwitter)
  
function MensagemAnon(source, cmd, ...) 
    local MessagemANS = table.concat ( { ... }, "T" ); 
for _,v in ipairs(getElementsByType("player")) do 
    conta = getAccountName ( getPlayerAccount ( source ) )

    if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™DeepWeb ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

        end
    end 
end 


addCommandHandler("DeepWeb",  MensagemAnon)
  
function MensagemRP(source, cmd, ...) 
    local MessagemFRP = table.concat ( { ... }, "" ); 
    local name = getPlayerName(source); 
for _,v in ipairs(getElementsByType("player")) do 
    conta = getAccountName ( getPlayerAccount ( source ) )

    if isObjectInACLGroup ("user."..conta, aclGetGroup ( "Everyone" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)

    elseif isObjectInACLGroup ("user."..conta, aclGetGroup ( "Nome do grupo" ) ) then
    outputChatBox("#00BFFF[ BsB™ForaDoRp ] #FFFFFF [Tag] "..name.." #FFFFFF: #00BFFF"..MessagemT,v, 255, 255, 255, true)
        end
    end 
end 
addCommandHandler("forarp",  MensagemRP)

addEventHandler("onPlayerJoin", getRootElement(),  
function() 
  bindKey(source, "Y", "down", "chatbox", "Twitter")
  bindKey(source, "U", "down", "chatbox", "Deepweb")
  bindKey(source, "i", "down", "chatbox", "forarp")
end 
) 

OBS: Não testado. Qualquer erro só enviar print do "/debugscript 3".
OBS: Só mudar a posição do "Nome do grupo" para o "Everyone". Pois quem tem a tag geral não vai aparecer a tag se ela estiver acima.

Deu o seguinte erro:    [20-06-28 01:30:10] ERROR: [Mods]/[BVN]Chat/Chats.Lua:142: attempt to concatenate global 'MessagemT' (a nil value)

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