Jump to content

Why not working remove color coding?


Turbe$Z

Recommended Posts

addEventHandler("onPlayerLogin", getRootElement(),
function ()
local name = getPlayerName ( source )
name:gsub("#%x%x%x%x%x%x", "")
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then
		exports[getResourceName(resource)]:addNotification(root, name.." tulajdonos szolgálatba lépett!", "warning")
    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." szupermoderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Modi")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Operator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." operátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("zuker")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Adminseged")) then
		exports[getResourceName(resource)]:addNotification(root, name.." adminsegéd szolgálatba lépett!", "warning")
    end
end
)

i added 'gsub' but the color code not disappear :S

 

 
Link to comment

@Turbo777 try this

function getFixedName(player)
if isElement(player) then
local hisName = getPlayerName(player)
if hisName then
 result = string.gsub(hisName, '#%x%x%x%x%x%x', '')
 if result then
 return result
 end
end
end
end

addEventHandler("onPlayerLogin", getRootElement(),
function ()
local name = getFixedName(source)
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then
		exports[getResourceName(resource)]:addNotification(root, name.." tulajdonos szolgálatba lépett!", "warning")
    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." szupermoderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Modi")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Operator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." operátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("zuker")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Adminseged")) then
		exports[getResourceName(resource)]:addNotification(root, name.." adminsegéd szolgálatba lépett!", "warning")
    end
end
)

 

  • Like 1
Link to comment
3 minutes ago, #BrosS said:

@Turbo777 try this


function getFixedName(player)
if isElement(player) then
local hisName = getPlayerName(player)
if hisName then
 result = string.gsub(hisName, '#%x%x%x%x%x%x', '')
 if result then
 return result
 end
end
end
end

addEventHandler("onPlayerLogin", getRootElement(),
function ()
local name = getFixedName(source)
    if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then
		exports[getResourceName(resource)]:addNotification(root, name.." tulajdonos szolgálatba lépett!", "warning")
    elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Moderator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("SuperModerator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." szupermoderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Modi")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Operator")) then
		exports[getResourceName(resource)]:addNotification(root, name.." operátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("zuker")) then
		exports[getResourceName(resource)]:addNotification(root, name.." moderátor szolgálatba lépett!", "warning")
	elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(source)), aclGetGroup("Adminseged")) then
		exports[getResourceName(resource)]:addNotification(root, name.." adminsegéd szolgálatba lépett!", "warning")
    end
end
)

 

Thanks ! :D Working fine ^^:D

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