1

As there are the commands like tempban, permban, etc which can be given permissions for profiles using the ptokax GUI under the profile manager.

I have made a script and i want to add my command to the GUI. How can i do this?

mental
  • 13
  • 2
  • Can you explain your question a little more? – hjpotter92 Jun 09 '14 at 12:05
  • if u use ptokax u can see under the profile manager window u can give permissions to profiles for commands like ban,gag,etc.i wanted to add my command to this list. – mental Jun 09 '14 at 12:08

1 Answers1

2

No, you can not allow certain profiles to use commands which you have written or created. Instead, you'd have to handle this from your own scripts. For example, let's say you have profile levels from 0 (Master) to 6 (regular user) along with the profile -1 for unregistered users.

If you want your command to be accessible by only certain profiles, create a hash table:

tAllowedProfiles = {
    [-1] = false,
    [0] = true,
    [1] = false,
    [2] = false,
    [3] = true,
    [4] = true,
    [5] = true,
    [6] = false
}

and then, in your ChatArrival or ToArrival functions, you can match the user's profile against the has table created above:

function ChatArrival( tUser, sMessage )
    if not tAllowedProfiles[tUser.iProfile] then return false end
    -- deal with the command/message otherwise
end

This is true for the GUI client for Windows as well. You can look over a few of my own scripts for reference.

hjpotter92
  • 78,589
  • 36
  • 144
  • 183
  • @mental You're welcome! You can select it as an answer if it helped and the question won't appear under unsolved questions list :) – hjpotter92 Jun 09 '14 at 13:05