• PointShop Problem when the players removed usergroup on ULX
    8 replies, posted
Hello! =D I have a problem. When a user is set to "vip", the player can buy and equip some models But when the players set "vip" to "user", he can equip the vip models, because he already bought the model. My question is it would be possible to remove the model when the player "vip" set to "user" ? Somes code I have tested ^^ [CODE] ITEM.Name = 'Kleiner' ITEM.Price = 250 ITEM.Model = 'models/player/kleiner.mdl' ITEM.AllowedUserGroups = { "superadmin", "vip" } function ITEM:OnEquip(ply, modifications) if not ply._OldModel then ply._OldModel = ply:GetModel() end timer.Simple(1, function() ply:SetModel(self.Model) end) end function ITEM:OnHolster(ply) if ply._OldModel then ply:SetModel(ply._OldModel) end end function ITEM:PlayerSetModel(ply) ply:SetModel(self.Model) end function ITEM:CanPlayerEquip(ply) if not ply:IsUserGroup("vip") then self:OnHolster(ply) end end[/CODE] Best Regards
Try this [code]function ITEM:CanPlayerEquip(ply) return table.HasValue(self.AllowedUserGroups, ply:GetUserGroup()) end[/code]
Thanks, is work =D Now, the problem is, when the player have already equip the model and is back to "user", the model is always stays equiped ( the player can hold the model ) Is possible to remove/hold the model when the player back to "user" ? Or the server can check ? Sorry for my bad English :/ Best Regards
You would have to make something custom for this pretty sure [editline]20th September 2016[/editline] An example would be to check every time they try and equip it and if they aren't the group the item gets removed.
I take the time from ulx ? ( the Utime or something like, I do not remember)
[QUOTE=warblack31;51081484]I take the time from ulx ? ( the Utime or something like, I do not remember)[/QUOTE] He wasn't referring to time, but every time the equip function is called
Similary to this ? [CODE]function ITEM:OnEquip(ply, modifications) table.HasValue(self.AllowedUserGroups, ply:GetUserGroup()) end[/CODE]
[QUOTE=warblack31;51088588]Similary to this ? [CODE]function ITEM:OnEquip(ply, modifications) table.HasValue(self.AllowedUserGroups, ply:GetUserGroup()) end[/CODE][/QUOTE] That should work but I'd say that iJohnny's solution is cleaner since you already have a checker function for that.
[QUOTE=aftokinito;51093281]That should work but I'd say that iJohnny's solution is cleaner since you already have a checker function for that.[/QUOTE] Thanks, but the problem is possible to remove/hold the model when the player back to "user" ?
Sorry, you need to Log In to post a reply to this thread.