• Pointshop | Can't make the model unequip when joining a new team
    4 replies, posted
Hey, My issue I think is pretty simple, I haven't really been able to figure it out though as I can't really lua code. What I want to do is make it so that when you change from one team to another, your model holsters. (This is on a jailbreak gamemode, TEAM_PRISONER = prisoner TEAM_JAILOR = prison guard) So far I've managed to make it so that if you do not have the model currently equipped and you are the wrong team, you can not equip the model. I'm trying to get it so that if you are prisoner, you buy the model and then you change the prison guard, you revert back to the default prison guard skin. Any help would be very much appreciated! [CODE] ITEM.Name = 'Kleiner' ITEM.Price = 0 ITEM.Model = 'models/player/kleiner.mdl' function ITEM:CanPlayerBuy(ply) return ply:SteamID() == "STEAM_0:1:3509" and ply:Team() == TEAM_PRISONER end function ITEM:CanPlayerEquip(ply) return ply:Team() == TEAM_PRISONER end 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 [/CODE]
You could do something along these lines; [code]hook.Add("PlayerSpawn", "PointshopTeam:PlayerSpawn", function(ply) if not ply:Team() == TEAM_PRISONER then ply:PS_HolsterItem("kleiner") -- the name of your PS item file, lowercase and without extension end end)[/code] Note, I haven't tested this and it should be run server-side.
I didn't even know PS_HolsterItem existed; thanks.
[QUOTE=jackwilsdon;45328028]You could do something along these lines; [code]hook.Add("PlayerSpawn", "PointshopTeam:PlayerSpawn", function(ply) if not ply:Team() == TEAM_PRISONER then ply:PS_HolsterItem("kleiner") -- the name of your PS item file, lowercase and without extension end end)[/code] Note, I haven't tested this and it should be run server-side.[/QUOTE] so to run server side you add it to lua auto run server?
[QUOTE=jackwilsdon;45328028]You could do something along these lines; [code]hook.Add("PlayerSpawn", "PointshopTeam:PlayerSpawn", function(ply) if not ply:Team() == TEAM_PRISONER then ply:PS_HolsterItem("kleiner") -- the name of your PS item file, lowercase and without extension end end)[/code] Note, I haven't tested this and it should be run server-side.[/QUOTE] if ITEM.ID is a thing, you could do this: [lua] function ITEM:PlayerSpawn( ply ) if ply:Team() == TEAM_PRISONER then return end ply:PS_HolsterItem( self.ID ) end [/lua]
Sorry, you need to Log In to post a reply to this thread.