(LUA 5)How can i check permissions
 

News:

29 December 2022 - PtokaX 0.5.3.0 (20th anniversary edition) released...
11 April 2017 - PtokaX 0.5.2.2 released...
8 April 2015 Anti child and anti pedo pr0n scripts are not allowed anymore on this board!
28 September 2015 - PtokaX 0.5.2.1 for Windows 10 IoT released...
3 September 2015 - PtokaX 0.5.2.1 released...
16 August 2015 - PtokaX 0.5.2.0 released...
1 August 2015 - Crowdfunding for ADC protocol support in PtokaX ended. Clearly nobody want ADC support...
30 June 2015 - PtokaX 0.5.1.0 released...
30 April 2015 Crowdfunding for ADC protocol support in PtokaX
26 April 2015 New support hub!
20 February 2015 - PtokaX 0.5.0.3 released...
13 April 2014 - PtokaX 0.5.0.2 released...
23 March 2014 - PtokaX testing version 0.5.0.1 build 454 is available.
04 March 2014 - PtokaX.org sites were temporary down because of DDOS attacks and issues with hosting service provider.

Main Menu

(LUA 5)How can i check permissions

Started by ruler, 04 June, 2005, 13:47:38

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ruler

Does anyone know what code is needed to get permissions of a user?
i used it so that if i changed a users profiles(permissions) then it not load up their zRight clicker with that command also disabling the command from the script without having to edit the script.
this is part of the old working script...

function zRightclicker(user,data)
bit = GetProfileName(GetItemByName(user.sName).iProfile)
   num,pro,indx = nil,nil,nil
      for line in io.lines("../Profiles.dat") do
      s,e,num,pro,indx=string.find(line,"(.+)%|(.+)%|(%d+)")
         if (bit == pro) then
         bit = indx
                  break end
      end
if string.sub(bit, 2,2) == "1" then
user:SendData("$UserCommand 1 3 InBuilt\\Drop User$<%[mynick]> !drop %[nick]||")
end
if string.sub(bit, 4,4) == "1" then
user:SendData("$UserCommand 1 2 InBuilt\\Ban User$<%[mynick]> !ban %[nick] %[line:Enter Reason]||")
user:SendData("$UserCommand 1 2 InBuilt\\Ban Nick$<%[mynick]> !nickban %[nick] ||")
user:SendData("$UserCommand 1 2 InBuilt\\UnBan User$<%[mynick]> !unban %[nick] ||")
end
end

im sure that there is an easier way of accessing/editing the permissions for example like the code...

GetProfileName(GetItemByName(user.sName).iProfile))

any ideas?

thanks guys and gals  :D


p.s.  the reason is because of the way the .dat files have been changed in the newer hubsoft version

The Direct Connect Global Banlist get protected.

jiten

With this one you'll get the Profile name of "user":
GetProfileName(GetItemByName(user.sName).iProfile))
Have a look at "Scripting-Interface.txt" shipped with the new PtokaX (in its main folder).

Best regards,

jiten

Dessamator

zright clicker already does that on its own at least the newest one :)
Ignorance is Bliss.

ruler

thanks for the reply but its not what i was trying to do.
ive read that text file with the ptokax hub so many times that i know it word for word now.
im trying to get the ' Permissions ' via command as i did in the script i posted just earlier. that was a working script from the .0.3.3.0 16.06 build version but with the new hubsoft there are no .dat files as they have now been changed to .xml files.
im just trying to find another way of getting the ' Permissions ' by using one or a combination of the profiles listed below...

GetProfiles()
GetProfileIdx(ProfileName)
GetProfileName(ProfileNumber)
GetUsersByProfile(ProfileName)

thanks

The Direct Connect Global Banlist get protected.

bastya_elvtars

My 2 cents:

If I were you, I would make a table. It would look like this:

userlevels={ 
	[-1] = 1, -- Guest
	[0] = 5, -- master
	[1] = 4, -- op
	[2] = 3, -- vip
	[3] = 2 -- reg
} -- rights management

It is easy to determine that the more rights are assigned to a profile, the higher that nuber will become. So you can set another 'layer' of permission handling within the script. You can always retrieve the rightt with userlevels[user.iProfile] and you can assign a level to different things that need it. To retrieve the original PtokaX user right bits you have to parse the profiles config file.
Everything could have been anything else and it would have just as much meaning.

ruler

Cheers im gonna give that a try.
with the old hubsoft it was easy to get the permissions but with the new ptokax hubsoft using .xml files makes it harder because of the way the .xml files are layed out.
it does seem strange though that you can access everything in the profiles file and not the permissions  :D  just wondering if it was left out on purpose or if PPK forgot about it when he was programming that part  8o  lol
anyway, thanks for the help guys

The Direct Connect Global Banlist get protected.

ruler

it was working like a charm in the old hubsoft cos when you get particular ops that get too carried away with their commands  8o  i could just goto the hub console and click on Advanced --->  Profile Manager and then untick the selected profile without having to edit the scripts  :]
also when a user enters the hub the scripts can check to see what profiles are enabled and what is not so that the zRight clicker knows what to load up for that user  ;)
anyway it would be nice to see that function back in a newer version of ptokax one day ' hint hint '  :D

The Direct Connect Global Banlist get protected.

SMF spam blocked by CleanTalk