Jump to content

"!" instead of "/"


redar98

Recommended Posts

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

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

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
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 :D

Link to comment
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
  
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

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