Hi Facepunch,
I'm trying to add skins only for prisoners!
[CODE]ITEM.Name = 'Gman'
ITEM.Price = 1337
ITEM.Model = 'models/player/gman.mdl'
function ITEM:OnEquip(ply, modifications)
if not ply._OldModel then
ply._OldModel = ply:GetModel()
end
if ply:Team() == 1 then
timer.Simple(1, function() ply:SetModel(self.Model) end)
elseif ply:Team() == 2 then
ply:SetModel(ply._OldModel)
end
end
function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
end
end[/CODE]
It's not working... If I become guard I will have a prisoner skin :(
Can anyone help me ?
Do you want a system where you have default gamemode skin while guard or separate skins for different teams?
I assume you just want guard skins default:
[code]
function GuardModel(ply)
if ply:Team("TEAM_GUARD") then
timer.Simple(2, function(ply) ply:SetModel("models/player/police.mdl") end)
elseif ply:Team("TEAM_PRISONER") then
timer.Simple(2, function(ply) ply:SetModel(ITEM.Model) end)
end
end
[/code]
Could be done better, but you can figure it out (hopefully)
Timers are there because if I remember, this gets overwritten with the store model and crap.
[QUOTE=SatoshiAaron;49223698]Do you want a system where you have default gamemode skin while guard or separate skins for different teams?
I assume you just want guard skins default:
[code]
function GuardModel(ply)
if ply:Team("TEAM_GUARD") then
timer.Simple(2, function(ply) ply:SetModel("models/player/police.mdl") end)
elseif ply:Team("TEAM_PRISONER") then
timer.Simple(2, function(ply) ply:SetModel(ITEM.Model) end)
end
end
[/code]
Could be done better, but you can figure it out (hopefully)
Timers are there because if I remember, this gets overwritten with the store model and crap.[/QUOTE]
That's not how team comparisons work.
[code]ITEM.Name = 'Gman'
ITEM.Price = 1337
ITEM.Model = 'models/player/gman.mdl'
function ITEM:OnEquip(ply, modifications)
if not ply._OldModel then
ply._OldModel = ply:GetModel()
end
if ply:Team() == TEAM_PRISONER then
print"Jailbreak: Setting custom prisoner model"
timer.Simple(1, function() ply:SetModel(self.Model) end)
elseif ply:Team() == TEAM_GUARD then
-- ply:SetModel(ply._OldModel)
end
end
function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
end
end[/code]
I guessed on the team names. Make sure those are correct.
[QUOTE=code_gs;49223833]That's not how team comparisons work.
[code]ITEM.Name = 'Gman'
ITEM.Price = 1337
ITEM.Model = 'models/player/gman.mdl'
function ITEM:OnEquip(ply, modifications)
if not ply._OldModel then
ply._OldModel = ply:GetModel()
end
if ply:Team() == TEAM_PRISONER then
print"Jailbreak: Setting custom prisoner model"
timer.Simple(1, function() ply:SetModel(self.Model) end)
elseif ply:Team() == TEAM_GUARD then
-- ply:SetModel(ply._OldModel)
end
end
function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
end
end[/code]
I guessed on the team names. Make sure those are correct.[/QUOTE]
Sorry, I did know. This is code from a while ago when I was starting. My bad.
Just couldn't be bothered to check it properly.
How embarrassing.
Sorry, you need to Log In to post a reply to this thread.