Jump to content

admin text[SOLVED]


OrbTanT

Recommended Posts

I am using this script to the text the administrator, emerge in the middle of the screen, more when another admin also uses, he writes the text on top of an text, how do I put, when digitize new text, he destroy the old text and displays the new?

function announceScript(player, cmd, ...) 
    local accountname = getAccountName(getPlayerAccount(player)) 
    if ( hasObjectPermissionTo ( player, "command.mute", true ) ) then 
        local playerName = getPlayerName(player):gsub("#%x%x%x%x%x%x", "") 
        for id, players in ipairs(getElementsByType("player")) do 
            local message = table.concat({...}," ") 
            local textChat = textCreateDisplay () 
  
             
            local textItem = textCreateTextItem( message, 0.5, 0.15, 2, 255,255 ,255 , 255, 3.2, "center", "Top", 255) 
            textDisplayAddText ( textChat, textItem ) 
            textDisplayAddObserver ( textChat, players ) 
            timer = setTimer ( textDestroyTextItem, 5000, 1, textItem ) 
            timers = setTimer ( textDestroyDisplay, 5000, 1, textChat ) 
             
        end 
    else 
    outputChatBox(getPlayerName(player) .."#FF0000Você precisa estar logado como administrador para usar este comando!",player,255,255,255,true) 
     
  
        end 
end 
addCommandHandler("@@", announceScript) 

Edited by Guest
Link to comment
local textChat = textCreateDisplay ()              
local textItem = textCreateTextItem( "", 0.5, 0.15, 2, 255,255 ,255 , 255, 3.2, "center", "Top", 255) 
textDisplayAddText ( textChat, textItem )  
function announceScript(player, cmd, ...) 
 local accountname = getAccountName(getPlayerAccount(player)) 
  if ( hasObjectPermissionTo ( player, "command.mute", true ) ) then 
   local playerName = getPlayerName(player):gsub("#%x%x%x%x%x%x", "") 
   local message = table.concat({...}," ") 
   textItemSetText(textItem,message) 
    for id, players in ipairs(getElementsByType("player")) do 
      textDisplayAddObserver ( textChat, players ) 
    end 
    if isTimer(timer) then killTimer(timer) end 
     timer = setTimer ( textItemSetText, 5000, 1, textItem,"" ) 
   else 
    outputChatBox(getPlayerName(player) .."#FF0000Você precisa estar logado como administrador para usar este comando!",player,255,255,255,true)       
  end 
end 
addCommandHandler("@@", announceScript) 

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