Adding a command to the ptokax GUI so as to give Profile Permissions

308 Views Asked by At

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?

1

There are 1 best solutions below

1
On BEST ANSWER

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.