Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 YEh, when they are on hidden admin duty, /hideadmin I want their admintag to disappear in GOOC, is that possible somehow? Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 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
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 Thanks, really. You saved my day! this is pretty much solved Link to comment
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 Question, is there a way to seperate admin lvl 1-3 colors, with 4+ (4-1337) Need like green admintag for 1-3 & red for 4+ (4-1337) Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 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
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 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
Castillo Posted February 7, 2012 Share Posted February 7, 2012 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
Eshtiz Posted February 7, 2012 Author Share Posted February 7, 2012 Thanks, everything works now, I won't be needed anything else regarding this anymore, I'm truly grateful. Link to comment
Castillo Posted February 7, 2012 Share Posted February 7, 2012 You're welcome. P.S: I hope so lol. Link to comment
Eshtiz Posted February 8, 2012 Author Share Posted February 8, 2012 (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
Castillo Posted February 8, 2012 Share Posted February 8, 2012 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
Eshtiz Posted February 8, 2012 Author Share Posted February 8, 2012 Doesn't work, I removed return then it duplicates the chat with tag & without as a player/admin. with return it doesn't let the player talk in GOOC. the other tags goes over it, duplicates the chat etc.. 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