xPermissions - Permission Denied.

I’ve been working on an addon called xPermissions, which is basicly something for Lua coders to implement into scripts.

You can do stuff like.

[lua]
function LetUsNoClip(ply)

if xPermissions and xPermissions.HasPermission(ply, "noclip") then

	return true
	
else
	
	return false
	
end

end

hook.Add(“PlayerNoClip”, “xPermissionsTest”, LetUsNoClip)
[/lua]

It will be released soon as soon as I work out all of the bugs.
You can also assign a player a ‘*’ permission to let them access everything.

Functions:

xPermission.GetPermissions(PLAYER Object) – Returns a table of all the players permissions.
xPermission.GivePermission(PLAYER Object, STRING permission) – Gives a player a permission.
xPermission.HasPermission(PLAYER Object, STRING permission) – Returns true if a player has a permission, Returns false if they do not.
xPermission.RemovePermission(PLAYER Object, STRING permission) – Removes a players permission, if they do not have permission, it returns nil.
xPermission.SetPermissions(PLAYER Object, TABLE permissions) – Sets a players permission, (WARNING: Accepts tables only.)

Current Bugs:
For some reason, Permissions started to durr when I put it on a dedicated server instead of a listen server. - Should be fixed.

You can also use this in DarkRP to restrict weapons and jobs to certain players.
Instead of true/false for the admin boolean on the AddCustomTeam function, use [lua]xPermissions.HasPermission(ply, “whateverpermission”)[/lua]

How will these permissions be stored?

SQLite, Why? I might add some more storage methods such as GLON and MySQL

GLON isn’t a method of storing data, it’s a method for compressing data. I assume you say GLON, but mean to say text file?

someone could find this useful i suppose.

I suggest for the sake of actually getting publicity( Lua Libraries like this don’t get a lot of attention believe me ), you make a menu for admins to give permissions and include all the basic sandbox hooks for permissions.

also how many “bugs” could there be with this? I can’t possibly imagine how you’d manage to get a bug with storing true/false on the player

your bugs are very descriptive

When I put it on a listen server, it returns true when a player has the permission, when its dedicated, it returns false when the player has the permission.

never ran into this. something you must be doing weird with your code.

[lua]
if !ply or !perm then return end

local plyperms = xPermissions.GetPermissions(ply)

if table.HasValue(plyperms, "*") or table.HasValue(plyperms, perm) then
	return true
else
	return false
end

[/lua]
Dont see whats wrong.

[lua]function YourFunction(ply, perm)
if table.HasValue(plyperms, “*”) or table.HasValue(plyperms, perm) then
return true
end
return false
end[/lua]

Why add the “else”.

[lua]function YourFunction(ply, perm)
return table.HasValue(plyperms, “*”) or table.HasValue(plyperms, perm)
end[/lua]

You don’t even know how to use SQLite

god damnit, it works in singleplayer/listen servers, but it wont work on dedicated servers.

I’d rather have a general purpose addon that allows you to save any sort of data for players (except tables).

Playerdata uses SQLite, he doesn’t need to know.

pdata.

btw a permissions library is useless,

player:SetPData(“CanNoclip”, true );

player:GetPData(“CanNoclip”);

like my lib?

[lua]hook.Add(“PlayerNoClip”, “xPermissionsTest”, function(ply)
return xPermissions.HasPermission(ply, “noclip”)
end)[/lua]
Why take up 15 lines when you could just use 3?

And this is such a basic addon. Any developer that can actually do decent scripting wouldnt need this.

Don’t hate on other peoples work when you can’t do better you’re self

Yay. Flawless is back.

I could make this system so easily and have it encorporate more than he has.

oh yeah well i can make it better than all u nerds!!!

anyone wasting there time arguing over this is stupid, if this is released, someone might find it useful. leave it at that and quit being retards talking about who can store a bool on the player “better”, it’s pathetic.

Reminds me of things like PermissionsBukkit