Getting the owner of the tool in the tool codeing?
4 replies, posted
who does one get the current owner of a tool wihtout them having to do anything?
Explanation:
i am trying to make a tool add a specific option to the options menu of a tool but that person has to be in a seicified group for it to show up. so i cant figure out how to get the owner of the tool before they click and before the options list is fully made. the end result should be that only the desiginated group can have or see this option from the list and the other groups dont know it is there.
i am currently trying to use this in the tool somewhere: [code]
local ply = self:GetOwner()
if ply:IsUserGroup( "owner" ) then
list.Add( "Types", "Alteran" ) end
[/code]
Since the menu is clientside you can always get a reference to the player using LocalPlayer()
About GetOwner, look it up. It really isn't used for that.
so how would one use that?
like to get the player that has the tool
eg self:LocalPlayer() {which doesnt work}
[lua]if LocalPlayer():IsUserGroup( "owner" ) then
list.Add( "Types", "Alteran" ) end[/lua]
thanks for the help it now works!
Sorry, you need to Log In to post a reply to this thread.