[LUA] Looking if the server has this addon installed.

So I am making a concommand and I want to check if the server has ULX and ULib then check if a user has this rank else don’t run it. And well I couldn’t find a solution I was searching for like 30 minutes and I gave up.

Figure out some LUA variable that the addons in question use, and check if it is nil.

If the code of ULX makes a global variable called ULX, you would simply check:

if ULX != nil then
     //do stuff

[editline]30th July 2017[/editline]

Nil means the variable isn’t assigned, which implies the addon isn’t running on the server.

[editline]30th July 2017[/editline]

I don’t actually know which global variables ULX creates, though. You’ll have to find that out yourself by looking at its code.

Does table count?

I’m pretty sure ulx uses the variable/table “ulx” (lowercase), and yes, you can check a table. (Also, I don’t think you need the != nil, I think just if [var] does the trick)

Thanks, and can I ask does ULX use Player:CheckGroup() by default or custom function?

ULX can use ply:IsUserGroup(group) to return if that is exactly a player’s user group (you could also obviously use if ply:GetUserGroup() == group then), or you can use ply:CheckGroup(group) to return true if the player is the group or is a group that inherits from that group