Jump to content

Admin tags in Global


Eshtiz

Recommended Posts

function globalOOC(thePlayer, commandName, ...) 
    local logged = tonumber(getElementData(thePlayer, "loggedin")) 
    
    if (logged==1) then 
        if not (...) then 
            outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) 
        else 
            local oocEnabled = exports.global:getOOCState() 
            message = table.concat({...}, " ") 
            local muted = getElementData(thePlayer, "muted") 
            if (oocEnabled==0) and not (exports.global:isPlayerAdmin(thePlayer)) then 
                outputChatBox("OOC Chat is currently disabled.", thePlayer, 255, 0, 0) 
            elseif (muted==1) then 
                outputChatBox("You are currenty muted from the OOC Chat.", thePlayer, 255, 0, 0) 
            else 
                local players = exports.pool:getPoolElementsByType("player") 
                local playerName = getPlayerName(thePlayer) 
                local playerID = getElementData(thePlayer, "playerid") 
                local r, g, b = getPlayerNametagColor(thePlayer) 
                local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) 
                local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") 
  
                exports.logs:logMessage("[OOC: Global Chat] " .. playerName .. ": " .. message, 1) 
  
                for k, arrayPlayer in ipairs(players) do 
                    local logged = tonumber(getElementData(arrayPlayer, "loggedin")) 
                    local targetOOCEnabled = getElementData(arrayPlayer, "globalooc") 
                    if (logged==1) and (targetOOCEnabled==1) then 
                        if exports.global:isPlayerAdmin(thePlayer) then 
                            if (hiddenAdmin == 0) then 
                                outputChatBox("(( [GOOC] #FF0000[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            else 
                                outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            end 
                        else 
                            outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
addCommandHandler("o", globalOOC, false, false) 
addCommandHandler("GlobalOOC", globalOOC) 

That should not show the admin tag if he's hidden.

Link to comment
function globalOOC(thePlayer, commandName, ...) 
    local logged = tonumber(getElementData(thePlayer, "loggedin")) 
    
    if (logged==1) then 
        if not (...) then 
            outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) 
        else 
            local oocEnabled = exports.global:getOOCState() 
            message = table.concat({...}, " ") 
            local muted = getElementData(thePlayer, "muted") 
            if (oocEnabled==0) and not (exports.global:isPlayerAdmin(thePlayer)) then 
                outputChatBox("OOC Chat is currently disabled.", thePlayer, 255, 0, 0) 
            elseif (muted==1) then 
                outputChatBox("You are currenty muted from the OOC Chat.", thePlayer, 255, 0, 0) 
            else 
                local players = exports.pool:getPoolElementsByType("player") 
                local playerName = getPlayerName(thePlayer) 
                local playerID = getElementData(thePlayer, "playerid") 
                local r, g, b = getPlayerNametagColor(thePlayer) 
                local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) 
                local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") 
                local adminLevel = exports.global:getPlayerAdminLevel(thePlayer) 
  
                exports.logs:logMessage("[OOC: Global Chat] " .. playerName .. ": " .. message, 1) 
  
                for k, arrayPlayer in ipairs(players) do 
                    local logged = tonumber(getElementData(arrayPlayer, "loggedin")) 
                    local targetOOCEnabled = getElementData(arrayPlayer, "globalooc") 
                    if (logged==1) and (targetOOCEnabled==1) then 
                        if exports.global:isPlayerAdmin(thePlayer) then 
                            if (hiddenAdmin == 0) then 
                                if (adminLevel >= 1 and adminLevel < 4) then 
                                    outputChatBox("(( [GOOC] #00FF00[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                elseif (admniLevel >= 4) then 
                                    outputChatBox("(( [GOOC] #FF0000[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                end 
                            else 
                                outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            end 
                        else 
                            outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
addCommandHandler("o", globalOOC, false, false) 
addCommandHandler("GlobalOOC", globalOOC) 

Link to comment

Thanks, but didn't work until I changed this line:

                                elseif (adminLevel >= 4 and adminLevel < 1337) then 

It's all thanks to you though, it's all good now, solved :)

I got a request from a member earlier today, he wanted [Donator] tags in GOOC,

I can't get it to work, the GOOC script is getting big & messy and I get confused, as we have a /don(ator) chat, I've used some lines from there, here's the whole function, I just want all members with a donator level to have [Donator] tag in GOOC.

function donatorchat(thePlayer, commandName, ...) 
    if ( exports.global:isPlayerBronzeDonator(thePlayer) or exports.global:isPlayerAdmin(thePlayer) ) then 
        if not (...) then 
            outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) 
        else 
            local message = table.concat({...}, " ") 
            local title = "" 
            local hidden = getElementData(thePlayer, "hiddenadmin") or 0 
  
            if ( exports.global:isPlayerAdmin(thePlayer) ) then 
                if (hidden == 1) or (exports.global:getPlayerAdminTitle(thePlayer) == "Player") then 
                    if not (exports.global:isPlayerBronzeDonator(thePlayer)) then 
                        title = "Bronze Donator" 
                    else 
                        title = exports.global:getPlayerDonatorTitle(thePlayer) 
                    end 
                else 
                    title = exports.global:getPlayerAdminTitle(thePlayer) 
                end 
            elseif ( exports.global:isPlayerBronzeDonator(thePlayer) ) then 
                title = exports.global:getPlayerDonatorTitle(thePlayer) 
            end 
                 
            for key, value in ipairs(getElementsByType("player")) do 
                if ( exports.global:isPlayerBronzeDonator(value) or exports.global:isPlayerAdmin(value) ) then 
                    if ( getElementData(value, "donatorchat") == 1 ) then 
                        outputChatBox("[Donator] " .. title .. " " .. getPlayerName(thePlayer) .. ": " .. message, value, 160, 164, 104) 
                    end 
                end 
            end 
        end 
    end 
end 
addCommandHandler("donator", donatorchat, false, false) 
addCommandHandler("don", donatorchat, false, false) 
addCommandHandler("dchat", donatorchat, false, false) 

Link to comment

Try this:

function globalOOC(thePlayer, commandName, ...) 
    local logged = tonumber(getElementData(thePlayer, "loggedin")) 
    
    if (logged==1) then 
        if not (...) then 
            outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) 
        else 
            local oocEnabled = exports.global:getOOCState() 
            message = table.concat({...}, " ") 
            local muted = getElementData(thePlayer, "muted") 
            if (oocEnabled==0) and not (exports.global:isPlayerAdmin(thePlayer)) then 
                outputChatBox("OOC Chat is currently disabled.", thePlayer, 255, 0, 0) 
            elseif (muted==1) then 
                outputChatBox("You are currenty muted from the OOC Chat.", thePlayer, 255, 0, 0) 
            else 
                local players = exports.pool:getPoolElementsByType("player") 
                local playerName = getPlayerName(thePlayer) 
                local playerID = getElementData(thePlayer, "playerid") 
                local r, g, b = getPlayerNametagColor(thePlayer) 
                local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) 
                local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") 
                local adminLevel = exports.global:getPlayerAdminLevel(thePlayer) 
  
                exports.logs:logMessage("[OOC: Global Chat] " .. playerName .. ": " .. message, 1) 
  
                for k, arrayPlayer in ipairs(players) do 
                    local logged = tonumber(getElementData(arrayPlayer, "loggedin")) 
                    local targetOOCEnabled = getElementData(arrayPlayer, "globalooc") 
                    if (logged==1) and (targetOOCEnabled==1) then 
                        if exports.global:isPlayerAdmin(thePlayer) then 
                            if (hiddenAdmin == 0) then 
                                if (adminLevel >= 1 and adminLevel < 4) then 
                                    outputChatBox("(( [GOOC] #00FF00[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                elseif (admniLevel > 4) then 
                                    outputChatBox("(( [GOOC] #FF0000[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                end 
                            else 
                                if (exports.global:getPlayerDonatorLevel(thePlayer) > 0) then 
                                    outputChatBox("(( [GOOC] [Donator] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                else 
                                    outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                end 
                            end 
                        else 
                            if (exports.global:getPlayerDonatorLevel(thePlayer) > 0) then 
                                outputChatBox("(( [GOOC] [Donator] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            else 
                                outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            end 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
addCommandHandler("o", globalOOC, false, false) 
addCommandHandler("GlobalOOC", globalOOC) 

Link to comment

(sorry solid >.<)

Yeh.. how do I put a specific player with a tag?

Need a special member of ours to have a specific unique tag. How do I trigger it to his account name & then put a tag in GOOC?

Here's the complete script:

function globalOOC(thePlayer, commandName, ...) 
    local logged = tonumber(getElementData(thePlayer, "loggedin")) 
    
    if (logged==1) then 
        if not (...) then 
            outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) 
        else 
            local oocEnabled = exports.global:getOOCState() 
            message = table.concat({...}, " ") 
            local muted = getElementData(thePlayer, "muted") 
            if (oocEnabled==0) and not (exports.global:isPlayerAdmin(thePlayer)) then 
                outputChatBox("OOC Chat is currently disabled.", thePlayer, 255, 0, 0) 
            elseif (muted==1) then 
                outputChatBox("You are currenty muted from the OOC Chat.", thePlayer, 255, 0, 0) 
            else 
                local players = exports.pool:getPoolElementsByType("player") 
                local playerName = getPlayerName(thePlayer) 
                local playerID = getElementData(thePlayer, "playerid") 
                local r, g, b = getPlayerNametagColor(thePlayer) 
                local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) 
                local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") 
                local adminLevel = exports.global:getPlayerAdminLevel(thePlayer) 
  
                exports.logs:logMessage("[OOC: Global Chat] " .. playerName .. ": " .. message, 1) 
  
                for k, arrayPlayer in ipairs(players) do 
                    local logged = tonumber(getElementData(arrayPlayer, "loggedin")) 
                    local targetOOCEnabled = getElementData(arrayPlayer, "globalooc") 
                    if (logged==1) and (targetOOCEnabled==1) then 
                        if exports.global:isPlayerAdmin(thePlayer) then 
                            if (hiddenAdmin == 0) then 
                                if (adminLevel >= 1 and adminLevel < 4) then 
                                    outputChatBox("(( [GOOC] #33FF00[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                elseif (adminLevel >= 4 and adminLevel < 1337) then 
                                    outputChatBox("(( [GOOC] #c41212[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                end 
                            else 
                                if (exports.global:getPlayerDonatorLevel(thePlayer) > 0) then 
                                    outputChatBox("(( [GOOC]#AD8200 [Donator]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                else 
                                    outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                end 
                            end 
                        else 
                            if (exports.global:getPlayerDonatorLevel(thePlayer) > 0) then 
                                outputChatBox("(( [GOOC]#AD8200 [Donator]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            else 
                                outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            end 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
addCommandHandler("o", globalOOC, false, false) 
addCommandHandler("GlobalOOC", globalOOC) 

Link to comment

Try this:

function globalOOC(thePlayer, commandName, ...) 
    local logged = tonumber(getElementData(thePlayer, "loggedin")) 
    
    if (logged==1) then 
        if not (...) then 
            outputChatBox("SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14) 
        else 
            local oocEnabled = exports.global:getOOCState() 
            message = table.concat({...}, " ") 
            local muted = getElementData(thePlayer, "muted") 
            if (oocEnabled==0) and not (exports.global:isPlayerAdmin(thePlayer)) then 
                outputChatBox("OOC Chat is currently disabled.", thePlayer, 255, 0, 0) 
            elseif (muted==1) then 
                outputChatBox("You are currenty muted from the OOC Chat.", thePlayer, 255, 0, 0) 
            else 
                local players = exports.pool:getPoolElementsByType("player") 
                local playerName = getPlayerName(thePlayer) 
                local playerID = getElementData(thePlayer, "playerid") 
                local r, g, b = getPlayerNametagColor(thePlayer) 
                local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) 
                local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") 
                local adminLevel = exports.global:getPlayerAdminLevel(thePlayer) 
                local accountName = getElementData(thePlayer,"gameaccountusername") 
  
                exports.logs:logMessage("[OOC: Global Chat] " .. playerName .. ": " .. message, 1) 
  
                for k, arrayPlayer in ipairs(players) do 
                    local logged = tonumber(getElementData(arrayPlayer, "loggedin")) 
                    local targetOOCEnabled = getElementData(arrayPlayer, "globalooc") 
                    if (logged==1) and (targetOOCEnabled==1) then 
                        if (accountName == "theAccountNameWithTag") then 
                            outputChatBox("(( [GOOC] #33FF00[TheTag]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            return 
                        end 
                        if exports.global:isPlayerAdmin(thePlayer) then 
                            if (hiddenAdmin == 0) then 
                                if (adminLevel >= 1 and adminLevel < 4) then 
                                    outputChatBox("(( [GOOC] #33FF00[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                elseif (adminLevel >= 4 and adminLevel < 1337) then 
                                    outputChatBox("(( [GOOC] #c41212[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                end 
                            else 
                                if (exports.global:getPlayerDonatorLevel(thePlayer) > 0) then 
                                    outputChatBox("(( [GOOC]#AD8200 [Donator]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                else 
                                    outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                                end 
                            end 
                        else 
                            if (exports.global:getPlayerDonatorLevel(thePlayer) > 0) then 
                                outputChatBox("(( [GOOC]#AD8200 [Donator]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            else 
                                outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 
                            end 
                        end 
                    end 
                end 
            end 
        end 
    end 
end 
addCommandHandler("o", globalOOC, false, false) 
addCommandHandler("GlobalOOC", globalOOC) 

Change "theAccountNameWithTag" with the account name you want to be with a "special" tag, and "TheTag" with the tag.

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