Eshtiz Posted February 4, 2012 Share Posted February 4, 2012 (edited) I've been trying myself on this script lately, I've been trying to add admin in /o (GOOC), I keep failing, a new chat pops up in T /say instead, I'm getting really confused about it. here's the script I'm trying on: function globalOOC(thePlayer, commandName, ...) local root = getRootElement() local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) outputChatBox("#855863[HEAD] #FFFFFF" .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [HEAD] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("SuperModerator")) then cancelEvent(true) outputChatBox("#855863[sMOD] #FFFFFF" .. name ..":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [sMOD] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then cancelEvent(true) outputChatBox("#855863[MOD] #FFFFFF" .. name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: [MOD] " .. name .. ": " .. text) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then cancelEvent(true) outputChatBox(name .. ":#FFFFFF " .. text, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. text) end elseif (msgtype == 2) then end end addCommandHandler("o", globalOOC, false, false) addCommandHandler("GlobalOOC", globalOOC) function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end https://community.multitheftauto.com/index.php?p= ... ls&id=2963 (Global Out Of Character) Would be awesome if I could get some help with this. Edited February 8, 2012 by Guest Link to comment
drk Posted February 4, 2012 Share Posted February 4, 2012 lol, what is 'msgtype'? 'msgtype' is nil. 'text' is nil too. Link to comment
Eshtiz Posted February 4, 2012 Author Share Posted February 4, 2012 lol, what is 'msgtype'? 'msgtype' is nil. 'text' is nil too. So.. what are you saying? Link to comment
drk Posted February 4, 2012 Share Posted February 4, 2012 variable msgtype and text don't exists in your code. msgtype and text value is nil. Link to comment
Try Posted February 4, 2012 Share Posted February 4, 2012 Err... guy u are crazy look this like of your code function globalOOC(thePlayer, commandName, ...) local root = getRootElement() local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) --------------------------------------- if (msgtype == 0) then if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then cancelEvent(true) ---------------------------------------- if noone talk u are asking for get the headadmin account then cancelevent? wtf u have to get who don`t said then cancel the event then ask for account get so look how: if (msgtype == 0) then cancelEvent() if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then then u can and u don`t need cancel the event all the time Link to comment
Eshtiz Posted February 4, 2012 Author Share Posted February 4, 2012 Still the same problem, here's the GOOC 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") 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 outputChatBox("(( [GOOC] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204) end end end end end end addCommandHandler("o", globalOOC, false, false) addCommandHandler("GlobalOOC", globalOOC) Link to comment
Twisted Posted February 5, 2012 Share Posted February 5, 2012 function ChatSystem(msg,msgtype) local root = getRootElement() local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) if (msgtype == 0) then cancelEvent() if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then outputChatBox("#855863[HEAD] #FFFFFF" .. name .. ":#FFFFFF " .. msg, root, 255, 255, 255, true) outputServerLog("CHAT: [HEAD] " .. name .. ": " .. msg) else if isObjectInACLGroup("user." .. account, aclGetGroup("SuperModerator")) then outputChatBox("#855863[sMOD] #FFFFFF" .. name ..":#FFFFFF " ..msg, root, 255, 255, 255, true) outputServerLog("CHAT: [sMOD] " .. name .. ": " .. msg) else if isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then outputChatBox("#855863[MOD] #FFFFFF" .. name .. ":#FFFFFF " .. msg, root, 255, 255, 255, true) outputServerLog("CHAT: [MOD] " .. name .. ": " .. msg) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then outputChatBox(name .. ":#FFFFFF " .. msg, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. msg) end end end end end addEventHandler("onPlayerChat",getRootElement(),ChatSystem) function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end maybe this will work? Link to comment
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 Nop, afraid not Here's my acl, I might of placed the 'HeadAdmin' account wrong( I don't think so, just making sure everything's correct). "Everyone"> "Default"/> "user.*"/> "resource.*"/> "resource.ucp"/> "Moderator"> "Moderator"/> "resource.mapcycler"/> "resource.mapmanager"/> "resource.resourcemanager"/> "resource.votemanager"/> "SuperModerator"> "Moderator"/> "SuperModerator"/> "HeadAdmin"/> "user.testtest"> "Developer"/> "Admin"> "Moderator"/> "SuperModerator"/> "Admin"/> Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 function ChatSystem(msg,msgtype) local root = getRootElement() local account = getAccountName(getPlayerAccount(source)) local name = getPlayerName(source) if (msgtype == 0) then cancelEvent() if isObjectInACLGroup("user." .. account, aclGetGroup("HeadAdmin")) then outputChatBox("#855863[HEAD] #FFFFFF" .. name .. ":#FFFFFF " .. msg, root, 255, 255, 255, true) outputServerLog("CHAT: [HEAD] " .. name .. ": " .. msg) elseif isObjectInACLGroup("user." .. account, aclGetGroup("SuperModerator")) then outputChatBox("#855863[sMOD] #FFFFFF" .. name ..":#FFFFFF " ..msg, root, 255, 255, 255, true) outputServerLog("CHAT: [sMOD] " .. name .. ": " .. msg) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Moderator")) then outputChatBox("#855863[MOD] #FFFFFF" .. name .. ":#FFFFFF " .. msg, root, 255, 255, 255, true) outputServerLog("CHAT: [MOD] " .. name .. ": " .. msg) elseif isObjectInACLGroup("user." .. account, aclGetGroup("Everyone")) then outputChatBox(name .. ":#FFFFFF " .. msg, root, 255, 255, 255, true) outputServerLog("CHAT: " .. name .. ": " .. msg) end end end addEventHandler("onPlayerChat",getRootElement(),ChatSystem) function RGBToHex(red, green, blue, alpha) if((red < 0 or red > 255 or green < 0 or green > 255 or blue < 0 or blue > 255) or (alpha and (alpha < 0 or alpha > 255))) then return nil end if(alpha) then return string.format("#%.2X%.2X%.2X%.2X", red,green,blue,alpha) else return string.format("#%.2X%.2X%.2X", red,green,blue) end end Link to comment
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 Still the same I'm afraid, tested both, same problem, it creates a new chat in 'T' ( /say ), GOOC is in /o, any way to transfer it? Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 That script works fine, I've tested and if I'm SuperModerator it'll output with SMOD tag, same for HeadAdmin and so on. What are you trying to achieve? Link to comment
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 Well, I'm trying to get an 'admin tag' behind 'player(admins) names' in GOOC chat, /o and so on. Since it's a Roleplay script, there's three 'main chats', IC = /say, LOOC B = /b, GOOC = /o , when I use your script in a separete resource from the chat-system, it duplicates the /say chat which ain't exactly what I'm trying to achieve, I want/need it to squeeze in an admin tag behind the player names in GOOC. Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 Post your OOC(/o) chat script. Link to comment
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 It's quite a big one, http://pastebin.com/R1VrebN8 Search for GOOC and you'll find the function etc.. (Posted the whole thing to not leave anything out) Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 http://pastebin.com/wvLGUUwb Link to comment
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 No errors, nothing, including no tags , don't have much more to go on so can't tell ya much. Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 You are using vG scripts, right? if I remember well, they use own account system, so that would mean they don't use the MTA default account's. If that's correct, then it'll never work like this. Link to comment
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 Yeh, vg scripts. But I discovered how to fix it, quite simple actually but I still need help with two things, Here's the GOOC Script together with the admin tag 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") 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") local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) if (logged==1) and (targetOOCEnabled==1) then outputChatBox("(( [GOOC] [" .. tostring(adminTitle) .. "] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204) end end end end end end addCommandHandler("o", globalOOC, false, false) addCommandHandler("GlobalOOC", globalOOC) As you see, it was only two lines I had to add, but regular players(admin level 0) has tag name [Player], I need to remove it since it get's weird and not very special. And I need to add a r g b color for the tag, someone knows how I add this to it? Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 I don't understand your problem. You want to add R, G, B to the chat message? 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) 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 outputChatBox("(( [GOOC] [" .. tostring(adminTitle) .. "] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, r, g, b) 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 To the admintag, here: outputChatBox("(( [GOOC] [" .. tostring(adminTitle) .. "] (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204) this part: [" .. tostring(adminTitle) .. "] I want to be a specific color a part from the chat text. 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) 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 outputChatBox("(( [GOOC] #FF0000[" .. tostring(adminTitle) .. "]#FFFFCC (" .. playerID .. ") " .. playerName .. ": " .. message .. " ))", arrayPlayer, 255, 255, 204, true) 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 Works perfectly, thanks! but as I said in the comment above, I need to disable the tag for regular players, admin level 0, anyone have any idea how to do that? 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) 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 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 end end end end end end addCommandHandler("o", globalOOC, false, false) addCommandHandler("GlobalOOC", globalOOC) Do you mean that? Link to comment
Eshtiz Posted February 5, 2012 Author Share Posted February 5, 2012 Exactly like that, thank you so much. But I just discovered another problem ;S As there's hidden player admins, /hideadmin, it shows (hidden) in the chat. I've tried to move around and use lines from this script: local hiddenAdmin = getElementData(thePlayer, "hiddenadmin") if (hiddenAdmin==0) then local adminTitle = exports.global:getPlayerAdminTitle(thePlayer) exports.global:sendMessageToAdmins(" " .. tostring(adminTitle) .. " " .. getPlayerName(thePlayer) .. " slapped " .. targetPlayerName .. ".") outputChatBox(" " .. tostring(adminTitle) .. " " .. getPlayerName(thePlayer) .. " slapped " .. targetPlayerName .. ".", getRootElement(), 255, 0, 51) exports.logs:logMessage("[/slap] " .. getElementData(thePlayer, "gameaccountusername") .. "/".. getPlayerName(thePlayer) .." slapped ".. targetPlayerName , 4) triggerEvent("removeTintName", targetPlayer) To the GOOC script but I can't hide the hidden admin in GOOC. Link to comment
Castillo Posted February 5, 2012 Share Posted February 5, 2012 I don't understand what do you mean, you want to remove the (Hidden) tag? 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