Jump to content

Help Please!


Joker_Mta

Recommended Posts

Posted

Hello !

addEventHandler("onResourceStart", resourceRoot, 
    function() 
        for index, player in ipairs(getElementsByType("player")) do 
            setElementData( player, "n.tag", "Player" ) 
        end 
    end 
) 
  
addEventHandler( "onPlayerJoin",root, 
    function( ) 
        setElementData( source, "n.tag", "Player" ) 
    end 
) 
  
addEvent("change1", true) 
function changename( thePlayer, tag) 
    if ( not tag ) then return end 
    local newtag = tag 
    setElementData ( thePlayer, "n.tag", newtag ) 
    outputChatBox ("Tag :".. newtag, thePlayer,0,255,0,true ) 
end 
addEventHandler("change1", root, changename) 
  
function chat( msg, type ) 
    if (type == 0 and getElementData( source, "n.tag" ) ~= false) then 
    cancelEvent() 
    local r, g, b = getPlayerNametagColor(source) 
    outputChatBox ("#0000FF" .. tostring(getElementData( source, "n.tag" )) .. " ".. getPlayerName ( source ) .. ":#FFFFFF " .. msg, getRootElement(), r, g, b, true )     
    end 
end 
addEventHandler("onPlayerChat", root, chat ) 
  
local root = getRootElement() 
  
function chatbox(text, msgtype) 
    local account = getAccountName(getPlayerAccount(source)) 
    local name = getPlayerName(source) 
 cancelEvent() 
    if isObjectInACLGroup("user." .. account, aclGetGroup("Admin")) then 
        outputChatBox("#FF0000[Admin]#ff0000#ff0000" .. name .. ":#bbbbbb " .. text, root, 255, 255, 255, true) 
   elseif isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then 
        outputChatBox("#FF0000[HeadAdmin]#FFFFFF#ff0000" .. name .. ":#bbbbbb " .. text, root, 255, 255, 255, true) 
    elseif isObjectInACLGroup("user." .. account, aclGetGroup("Console")) then 
        outputChatBox("#0000cd[HeadModerator]#0000cd#ff0000" .. name .. ":#ff0000 " .. text, root, 255, 255, 255, true) 
  
    elseif isObjectInACLGroup("user." .. account, aclGetGroup("SuperModerator")) then 
        outputChatBox("#ff7400[superModerator]#00FFFF#ff0000" .. name ..":#CC0000 " .. text, root, 255, 255, 255, true) 
        
    elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then 
        outputChatBox("#00FF00[Moderator]#FF00FF#ff0000" .. name .. ":#CC0000 " .. text, root, 255, 255, 255, true) 
  
 elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then 
        outputChatBox("#00FFFF" .. name .. ":" .. text, root, 255, 255, 255, true) 
        end 
end 
addEventHandler("onPlayerChat", root, chatbox)  

Please Help

I Want not to Repeated the crown in chat..

Thanks

Posted

"I Want not to Repeated the crown in chat.." what do you mean saying crown, crown is thing which some king uses.

You mean that when you say something it outputs twice in the chatbox? Turn off your freeroam resource then.

Posted

maybe tell if you have got any debug errors and for what set element data is used, this part of code is not needed I think..

addEventHandler("onResourceStart", resourceRoot, 
    function() 
        for index, player in ipairs(getElementsByType("player")) do 
            setElementData( player, "n.tag", "Player" ) 
        end 
    end 
) 
  
addEventHandler( "onPlayerJoin",root, 
    function( ) 
        setElementData( source, "n.tag", "Player" ) 
    end 
) 
  
addEvent("change1", true) 
function changename( thePlayer, tag) 
    if ( not tag ) then return end 
    local newtag = tag 
    setElementData ( thePlayer, "n.tag", newtag ) 
    outputChatBox ("Tag :".. newtag, thePlayer,0,255,0,true ) 
end 
addEventHandler("change1", root, changename) 
  
function chat( msg, type ) 
    if (type == 0 and getElementData( source, "n.tag" ) ~= false) then 
    cancelEvent() 
    local r, g, b = getPlayerNametagColor(source) 
    outputChatBox ("#0000FF" .. tostring(getElementData( source, "n.tag" )) .. " ".. getPlayerName ( source ) .. ":#FFFFFF " .. msg, getRootElement(), r, g, b, true )     
    end 
end 
addEventHandler("onPlayerChat", root, chat ) 

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