5150 Posted October 5, 2016 Share Posted October 5, 2016 anyone know whats wrong here? im trying to get admin tags intergrated with my local chat Spoiler addEventHandler("onPlayerChat", root, function(tresc, msgtype) if (msgtype == 0) then cancelEvent() local x,y,z = getElementPosition(source) for key, gracze in ipairs(getElementsByType("player")) do local x2,y2,z2 = getElementPosition(gracze) if (getDistanceBetweenPoints3D(x,y,z,x2,y2,z2)<20) then local int = getElementInterior(source) local dim = getElementDimension(source) local int2 = getElementInterior(gracze) local dim2 = getElementDimension(gracze) if (int == int2 and dim == dim2) then if isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Administrator" ) ) and type == 0 and r == 204 and g == 255 and b == 0 then cancelEvent ( ) outputChatBox ( "#ff0000ADMINISTRATOR| " .. getPlayerName ( source ) .. ":#f7fc00 " .. msg, getRootElement(), r, g, b, true ) elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Founder" ) ) and type == 0 then cancelEvent ( ) r, g, b = getPlayerNametagColor(source) outputChatBox ( "#990000✬#000000FOUNDER#990000♫ " .. getPlayerName ( source ) .. " Says:#f7fc00 " .. msg, getRootElement(), r, g, b, true ) elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "LeadMod" ) ) and type == 0 and r == 102 and g == 102 and b == 0 then cancelEvent ( ) r, g, b = getPlayerNametagColor(source) outputChatBox ( "#0000FFLead Mod| " .. getPlayerName ( source ) .. ":#FFFFFF " .. msg, getRootElement(), r, g, b, true ) elseif isObjectInACLGroup ( "user." .. getAccountName(getPlayerAccount(source)), aclGetGroup ( "Moderator" ) ) and type == 0 and r == 51 and g == 102 and b == 51 then cancelEvent ( ) r, g, b = getPlayerNametagColor(source) outputChatBox ( "#3366ffModerator| " .. getPlayerName ( source ) .. ":#FFFFFF " .. msg, getRootElement(), r, g, b, true ) end end end end end) Link to comment
Dealman Posted October 5, 2016 Share Posted October 5, 2016 Use debugscript. type == 0 isn't defined, did you mean msgtype? Also you only need to cancel the event once. Link to comment
iPrestege Posted October 5, 2016 Share Posted October 5, 2016 Also msg isn't defined try this : addEventHandler( 'onPlayerChat',root, function( message,messageType ) if ( messageType == 0 ) then cancelEvent ( ) local x,y,z = getElementPosition(source) for key,gracze in ipairs ( getElementsByType ( 'player') ) do local x2,y2,z2 = getElementPosition ( gracze ) if ( getDistanceBetweenPoints3D ( x,y,z,x2,y2,z2 ) < 20 ) then local int = getElementInterior ( source ) local dim = getElementDimension ( source ) local int2 = getElementInterior ( gracze ) local dim2 = getElementDimension ( gracze ) local r, g, b = getPlayerNametagColor ( source ) if ( int == int2 and dim == dim2 ) then if isObjectInACLGroup ( 'user.' .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Administrator' ) ) and r == 204 and g == 255 and b == 0 then outputChatBox ( '#ff0000ADMINISTRATOR| ' .. getPlayerName ( source ) .. ':#f7fc00 ' .. message,root,r,g,b,true ) elseif isObjectInACLGroup ( 'user.' .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Founder' ) ) and type == 0 then r, g, b = getPlayerNametagColor(source) outputChatBox ( '#990000✬#000000FOUNDER#990000♫ ' .. getPlayerName ( source ) .. ' Says:#f7fc00 ' .. message,root,r,g,b,true ) elseif isObjectInACLGroup ( 'user.' .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'LeadMod' ) ) and r == 102 and g == 102 and b == 0 then r, g, b = getPlayerNametagColor(source) outputChatBox ( '#0000FFLead Mod| ' .. getPlayerName ( source ) .. ':#FFFFFF ' .. message,root, r, g, b, true ) elseif isObjectInACLGroup ( 'user.' .. getAccountName ( getPlayerAccount ( source ) ), aclGetGroup ( 'Moderator' ) ) and r == 51 and g == 102 and b == 51 then outputChatBox ( '#3366ffModerator| ' .. getPlayerName ( source ) .. ':#FFFFFF ' .. message,root, r, g, b, true ) end end end end end end ) Link to comment
#BrosS Posted October 5, 2016 Share Posted October 5, 2016 (edited) local root = getRootElement() function chatbox(text, msgtype) local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) cancelEvent() if isObjectInACLGroup("user." .. account, aclGetGroup("Administrator")) then outputChatBox("#ff0000ADMINISTRATOR |#ff6666" .. name .. ":#f7fc00 " .. text, root, 255, 255, 255, true) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Founder")) then outputChatBox("#990000✬#000000FOUNDER#990000♫ #ff6666" .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then outputChatBox("#3366ffModerator| #FF0000" .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) end end addEventHandler("onPlayerChat", root, chatbox) Edited October 5, 2016 by #xDaNtE-03 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now