Im very new to Lua.
I will explain my idea, I wanted to make PlayX work with a job so the job can play the movie and or youtube link
I found in the PlayX code this, (Please tell me if I am not right)
[CODE]function PlayX.AccessManager(ply)
-- Default is Deny
local result = false
-- Check if ULib is loaded
if ULib ~= nil then
result = ply:query("PlayX Access")
end
-- Check if exsto is loaded
if exsto ~= nil then
result = ply:IsAllowed("playxaccess")
end
-- Check if Evolve is Loaded
if evolve ~= nil then
result = ply:EV_HasPrivilege( "PlayX Access" )
end
if result == false then
result = ply:IsAdmin()
end
return result
end[/CODE]
I figure I could add some where in here something like,
[CODE] if result == false then
result = ply:IsTeam() == TEAM_MOVIE
end[/CODE]
If that is totally wrong ith this ^, I found another file that I think might make it work,
[CODE]if SERVER then
if ULib ~= nil then
ULib.ucl.registerAccess("PlayX Access", {"admin", "superadmin"}, "Give access to PlayX", "PlayX")
end
end[/CODE]
Again, I am still learning. Any sudjetions or a link to a wiki I can learn about Teams would be great.
Also, I should add, Im not posting for some one to do the work for me as I wont learn that way, but to put me in the right direction.
Is this for a gamemode and if so what gamemode?
as for this
[code]
if result == false then
result = ply:IsTeam() == TEAM_MOVIE
end
[/code]
I would figure that would need do be more like this.
[code]
if result == false then
if (ply:IsTeam() == TEAM_MOVIE) then
result = true
end
end
[/code]
ply:IsTeam() looks like it's a custom function for a specific gamemode rather than actually being something base lua. The closest thing I could find for teams on the garry's mod wiki was ply:Team() but it uses numbers to references teams rather than a string. It leads me to believe you're doing this in DarkRP or an equivalent? I've never done programming for many other gamemodes so I don't know the list of functions. If this is a gamemode try searching through the files where the function is used and look at how it was used, that's how I learnt what I know about LUA.
I realised I didn't explain the code so here we go.
the ply:IsAdmin() returns what is known as a boolean value or a true, false value when executed. It checks the players usergroup and if they are in the group "admin" or "superadmin" it returns true. Otherwise it returns false.
So when it makes result = ply:IsAdmin() it will return true or false and that will determine if they are allowed access. As far as I know doing ply:IsTeam() == TEAM_MOVIE would throw up an error since you have already made result = the string ply:IsTeam() that it would return. I imagine the == would throw up an error as I have only seen it (known as an operator) in an if statement. So you would need to do [code]if ply:IsTeam() == TEAM_MOVIE then[/code] then give the result a boolean value.
Maybe I'm wrong on the last part.
Sorry, you need to Log In to post a reply to this thread.