I am having been having a bit of trouble here, I have been trying to restrict use of an entity to only allow certain ULX groups to use it.
[CODE]function ENT:Use( ply )
if (!ply:IsUserGroup("donor","admin","superadmin") || !ply:IsPlayer()) then
ply:SendLua("chat.AddText(Color(0,255,0,255), '[CASINO] ', Color(255,0,0,255), 'You are not VIP!')")
return
end[/CODE]
I have also tried
[CODE]function ENT:Use( ply )
if (!ply:IsUserGroup("donor") || !ply:IsAdmin() || !ply:IsSuperAdmin() || !ply:IsPlayer()) then
ply:SendLua("chat.AddText(Color(0,255,0,255), '[CASINO] ', Color(255,0,0,255), 'You are not VIP!')")
return
end[/CODE]
But neither seem to work, both either turn out to not allow any of the groups to use it or only allow the first group defined can use it and it ignores the rest. Keep in mind though, I am not a lua coder, i've fixed a few VERY small things before but never coded anything major. Any kind of help would be appreciated.
[url=http://wiki.garrysmod.com/page/ENTITY/Use]If I understand you right, you want the caller[/URL]
so
[LUA]function ENT:Use( act, ply )
if ply:IsUserGroup("bleh") then
end
end[/LUA]
Thanks for you reply rejax, but that for some reason breaks the entity all together. Can't even spawn it with "ulx ent" command. There are no errors, it just says it doesn't exist.
[editline]22nd August 2013[/editline]
I think i got it, With "function ENT:Use( act,ply )" that you posted I tried this...
[CODE]function ENT:Use( act, ply )
if ply:IsUserGroup("donor") or ply:IsSuperAdmin() then
else ply:SendLua("chat.AddText(Color(0,255,0,255), '[CASINO] ', Color(255,0,0,255), 'You are not VIP!')")
return
end[/CODE]
and so far so good. Only time will tell. Thank you again rejax for your help.
Sorry, you need to Log In to post a reply to this thread.