redar98 Posted May 19, 2013 Share Posted May 19, 2013 How to use "!" instead of "/" for example here : function createAdminList() adminlist = { } supermodlist = { } modlist = { } for k, v in ipairs(getElementsByType("player")) do if not isGuestAccount(getPlayerAccount(v)) then if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then table.insert(adminlist, v) elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("SuperModerator")) then table.insert(supermodlist, v) elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Moderator")) then table.insert(modlist, v) end end end return adminlist, supermodlist, modlist end function AdminList(sourcePlayer, command) local admins, supmods, mods = createAdminList() if #admins == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online Admin yok!", sourcePlayer,false ) else for k, v in ipairs(admins) do outputChatBox("Admin : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end if #supmods == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online SuperModerator yok!", sourcePlayer,false ) else for k, v in ipairs(supmods) do outputChatBox("SuperModerator : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end if #mods == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online Moderator yok!", sourcePlayer,false ) else for k, v in ipairs(mods) do outputChatBox("Moderator : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end end addCommandHandler("admins", AdminList) Link to comment
Castillo Posted May 19, 2013 Share Posted May 19, 2013 I don't understand what do you mean. Link to comment
xXMADEXx Posted May 19, 2013 Share Posted May 19, 2013 I don't understand what do you mean. I think he is trying to make something like change commands from like "/admins" to "!admins" if that is what your trying to do, i guess you would just have to find the string of "!admins," when someone types a message... Link to comment
Jacob Lenn Posted May 19, 2013 Share Posted May 19, 2013 addEventHandler("onPlayerChat", root, function (msg, msgType) if msgType == 0 then if msg == "!admins" then --do sth end end end ) Did you mean sth like this? Link to comment
Castillo Posted May 19, 2013 Share Posted May 19, 2013 If that's what he want, then Jacob's code should work. Link to comment
redar98 Posted May 19, 2013 Author Share Posted May 19, 2013 I don't understand what do you mean. I think he is trying to make something like change commands from like "/admins" to "!admins" if that is what your trying to do, i guess you would just have to find the string of "!admins," when someone types a message... yes Link to comment
Jacob Lenn Posted May 19, 2013 Share Posted May 19, 2013 If so, u have to use code which i gave u before. Link to comment
Jaysds1 Posted May 19, 2013 Share Posted May 19, 2013 addEventHandler("onPlayerChat", root, function (msg, msgType) if msgType == 0 then if msg == "!admins" then --do sth end end end ) Did you mean sth like this? Use this code Link to comment
redar98 Posted May 19, 2013 Author Share Posted May 19, 2013 it will work ? addEventHandler("onPlayerChat", root, function (msg, msgType) if msgType == 0 then if msg == "!admins" then function createAdminList() adminlist = { } supermodlist = { } modlist = { } for k, v in ipairs(getElementsByType("player")) do if not isGuestAccount(getPlayerAccount(v)) then if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then table.insert(adminlist, v) elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("SuperModerator")) then table.insert(supermodlist, v) elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Moderator")) then table.insert(modlist, v) end end end return adminlist, supermodlist, modlist end function AdminList(sourcePlayer, command) local admins, supmods, mods = createAdminList() if #admins == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online Admin yok!", sourcePlayer,false ) else for k, v in ipairs(admins) do outputChatBox("Admin : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end if #supmods == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online SuperModerator yok!", sourcePlayer,false ) else for k, v in ipairs(supmods) do outputChatBox("SuperModerator : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end if #mods == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online Moderator yok!", sourcePlayer,false ) else for k, v in ipairs(mods) do outputChatBox("Moderator : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end end end end end ) Link to comment
Jacob Lenn Posted May 19, 2013 Share Posted May 19, 2013 Hmmm, better idea is to do in dat way: function createAdminList() adminlist = { } supermodlist = { } modlist = { } for k, v in ipairs(getElementsByType("player")) do if not isGuestAccount(getPlayerAccount(v)) then if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then table.insert(adminlist, v) elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("SuperModerator")) then table.insert(supermodlist, v) elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Moderator")) then table.insert(modlist, v) end end end return adminlist, supermodlist, modlist end function AdminList(sourcePlayer) local admins, supmods, mods = createAdminList() if #admins == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online Admin yok!", sourcePlayer,false ) else for k, v in ipairs(admins) do outputChatBox("Admin : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end if #supmods == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online SuperModerator yok!", sourcePlayer,false ) else for k, v in ipairs(supmods) do outputChatBox("SuperModerator : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end if #mods == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online Moderator yok!", sourcePlayer,false ) else for k, v in ipairs(mods) do outputChatBox("Moderator : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end end addEventHandler("onPlayerChat", root, function (msg, msgType) if msgType == 0 then if msg == "!admins" then AdminList(source) end end end ) Link to comment
redar98 Posted May 19, 2013 Author Share Posted May 19, 2013 Hmmm, better idea is to do in dat way: function createAdminList() adminlist = { } supermodlist = { } modlist = { } for k, v in ipairs(getElementsByType("player")) do if not isGuestAccount(getPlayerAccount(v)) then if isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Admin")) then table.insert(adminlist, v) elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("SuperModerator")) then table.insert(supermodlist, v) elseif isObjectInACLGroup("user." .. getAccountName(getPlayerAccount(v)), aclGetGroup("Moderator")) then table.insert(modlist, v) end end end return adminlist, supermodlist, modlist end function AdminList(sourcePlayer) local admins, supmods, mods = createAdminList() if #admins == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online Admin yok!", sourcePlayer,false ) else for k, v in ipairs(admins) do outputChatBox("Admin : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end if #supmods == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online SuperModerator yok!", sourcePlayer,false ) else for k, v in ipairs(supmods) do outputChatBox("SuperModerator : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end if #mods == 0 then outputConsole("#ff6600[iNFO]#00ff00 Online Moderator yok!", sourcePlayer,false ) else for k, v in ipairs(mods) do outputChatBox("Moderator : " .. getPlayerName(v), getRootElement (), 16, 160, 17, false) end end end addEventHandler("onPlayerChat", root, function (msg, msgType) if msgType == 0 then if msg == "!admins" then AdminList(source) end end end ) thanks Link to comment
Renkon Posted May 22, 2013 Share Posted May 22, 2013 addEventHandler('onPlayerChat', root, function(message) if string.sub(message, 1, 1)=='!' then local command = gettok(message, 1, 32) local args = string.gsub(message, command, '') command = string.gsub(command, '!', '') executeCommandHandler(command, source, args) end end ) Council made this. Link to comment
HunT Posted May 22, 2013 Share Posted May 22, 2013 function retroCommands(text) if text:find("!", 1, 1) then local command = gettok(text, 1, 32):sub(2) if #command > 0 then local arguments = text:sub(#command+3) executeCommandHandler(command, source, arguments) end end end addEventHandler("onPlayerChat", getRootElement(), retroCommands) -- Aibo Credit 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