I was wondering how I would run a script in the point show for every model so that if they are on TEAM_DEATH there model changes to Death Model. It works for people who don't have a custom model from the point show its just the people who do have custom models.
Model in Pointshop:
[lua]
ITEM.Name = 'Pokémon - Ash'
ITEM.Price = 250
ITEM.Model = 'models/PKMN Trainer Red/ash.mdl'
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
[/lua]
Script to make people look like Death:
[lua]
hook.Add( "ChangePlayerModel", "Different Death Model", function( ply )
if ply:Team() == TEAM_DEATH then
return "models/player/death.mdl"
end
end )
[/lua]
[lua]
function ITEM:OnEquip(ply, modifications)
if not ply._OldModel then
ply._OldModel = ply:GetModel()
end
timer.Simple(1, function() if not ply:Team() == TEAM_DEATH then ply:SetModel(self.Model) end end)
end
[/lua]
Doesn't work. It doesn't equip the model.
Can't you just add:
[CODE]if ply:Team() == TEAM_DEATH then
ply:SetModel("INSERT MODEL HERE")
end[/CODE]
to your player spawn function?
[lua]
if ply:Team() == TEAM_DEATH then
timer.Simple( 2, ply:SetModel("INSERT MODEL HERE") )
end
[/lua]
Would this work if I put it in init.lua
[editline]16th August 2013[/editline]
It can't be any less than 2 seconds otherwise the custom model will over-take it if you will.
bump
EDIT:
-snip-
I already have the script. And I do need the timer. The point shop uses a timer.simple so it over-takes the original model. So 1 second after spawning this will be taken over. I already have a script for Death changing model for people who have no model in point shop.
Sorry, you need to Log In to post a reply to this thread.