marty000123 Posted August 22, 2014 Share Posted August 22, 2014 Hey everyone. Due the fact there aren't alot scripter available for us, we're kindly asking you for help. The things, we are searching: 1: Anti-Caps. Nobody can use shift/caps. If they do, the script will translate the letters into small letters. Only people in the ACL group ''Staff'' can use shift/caps. It will not be translated into small letters by the script. 2: Staff chat. Only people in the ACL group ''Staff'' must be able to use /s(taffchat) [ So the command must be /s to use staffchat ] and they must be the only one who can read it so only people in the ACL group Staff. Nobody else must be able to use /s or to even read it. Thank you very much in advance! Regards, Marty The Zombie Invasion Server Owner. Link to comment
Mr_Moose Posted August 22, 2014 Share Posted August 22, 2014 Well the anti caps part is easy unless you're being lazy, str = string.lower(str) For the second one you need to make a command handler and a loop thought all the players online and check their team. function staffChat(staffPlayer, cmd, ...) local message = string.concat(..., " ") for i, thePlayer in ipairs(getElementsByType("player")) -- Check your acl group here and show the message end end addCommandHandler("s", staffChat) Link to comment
marty000123 Posted August 22, 2014 Author Share Posted August 22, 2014 Well the anti caps part is easy unless you're being lazy, str = string.lower(str) Thanks for responding. I know anti-caps isn't that hard, but I requested ''only players in the ACL group ''Staff'' can be able to use caps/shift''. That's too hard for me and that's why I ask you. For the second one you need to make a command handler and a loop thought all the players online and check their team. function staffChat(staffPlayer, cmd, ...) local message = string.concat(..., " ") for i, thePlayer in ipairs(getElementsByType("player")) -- Check your acl group here and show the message end end addCommandHandler("s", staffChat) I don't get it exactly, sorry I'm not the best scripter you've ever met What do I need to put in that script to make it work? Marty Link to comment
Anubhav Posted August 22, 2014 Share Posted August 22, 2014 function getOnlineAdmins() local t = {} for k,v in ipairs ( getElementsByType("player") ) do while true do local acc = getPlayerAccount(v) if not acc or isGuestAccount(acc) then break end local accName = getAccountName(acc) local isAdmin = isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) if isAdmin == true then table.insert(t,v) end break end end return t end addCommandHandler("staffchat", function(source, cmd, ...) local concat = string.lower(table.concat(..., " ")) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then for k,v in ipairs(getOnlineAdmins()) do outputChatBox("(STAFF-CHAT)"..getPlayerName(source).. ": #ffffff"..tostring(concat), v, 255, 255, 255, true) end end end ) Link to comment
marty000123 Posted August 22, 2014 Author Share Posted August 22, 2014 function getOnlineAdmins() local t = {} for k,v in ipairs ( getElementsByType("player") ) do while true do local acc = getPlayerAccount(v) if not acc or isGuestAccount(acc) then break end local accName = getAccountName(acc) local isAdmin = isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) if isAdmin == true then table.insert(t,v) end break end end return t end addCommandHandler("staffchat", function(source, cmd, ...) local concat = string.lower(table.concat(..., " ")) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then for k,v in ipairs(getOnlineAdmins()) do outputChatBox("(STAFF-CHAT)"..getPlayerName(source).. ": #ffffff"..tostring(concat), v, 255, 255, 255, true) end end end ) Thanks, I'll try it out asap! Link to comment
Anubhav Posted August 22, 2014 Share Posted August 22, 2014 I am always here to help anyone. Link to comment
marty000123 Posted August 22, 2014 Author Share Posted August 22, 2014 I am always here to help anyone. Hey I copied and pasted your script into my script but when I do /staffchat , nothing pops up. I think it's not working. Do you know a fix? Marty Link to comment
Anubhav Posted August 22, 2014 Share Posted August 22, 2014 Use /debugscript 3 Use /staffchat msg Link to comment
marty000123 Posted August 22, 2014 Author Share Posted August 22, 2014 Use /debugscript 3Use /staffchat msg Doesn't work Link to comment
Et-win Posted August 22, 2014 Share Posted August 22, 2014 He means to use command: /debugscript 3 In-game and then to start and use the command of your script. Then, if any error's appear, post them here. Link to comment
xXMADEXx Posted August 22, 2014 Share Posted August 22, 2014 function getOnlineAdmins() local t = {} for k,v in ipairs ( getElementsByType("player") ) do while true do local acc = getPlayerAccount(v) if not acc or isGuestAccount(acc) then break end local accName = getAccountName(acc) local isAdmin = isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) if isAdmin == true then table.insert(t,v) end break end end return t end addCommandHandler("staffchat", function(source, cmd, ...) local concat = string.lower(table.concat(..., " ")) if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(source)), aclGetGroup("Admin")) then for k,v in ipairs(getOnlineAdmins()) do outputChatBox("(STAFF-CHAT)"..getPlayerName(source).. ": #ffffff"..tostring(concat), v, 255, 255, 255, true) end end end ) I don't understand why you would put a while loop in the getOnlineAdmins ( ) function. It's completely useless... Try using this code: function isPlayerInACL ( player, acl ) local account = getPlayerAccount ( player ) if ( isGuestAccount ( account ) ) then return false end return isObjectInACLGroup ( "user."..getAccountName ( account ), aclGetGroup ( acl ) ) end addCommandHandler ( "staffchat", function ( p, _, ... ) if ( not isPlayerInACL ( p, "Admin" ) ) then return end local msg = string.lower ( tostring ( table.concat ( { ... }, " " ) ) ):gsub ( "#%x%x%x%x%x%x", "" ) if ( msg:gsub ( " ", "" ) == "" ) then return end for i, v in pairs ( getElemetnsByType ( "player" ) ) do if ( isPlayerInACL ( v, "Admin" ) ) then outputChatBox ( "(Staff) "..getPlayerName ( p )..": #ffffff"..msg, v, 0, 255, 0 ) end end end ) 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