I am trying to make it where when you buy this point shop addon it changes your material, I got it to do that but Im not sure how to make it revert back. :l Im looking for the code on holster to revert to normal material. this is what I have, I am a far noob realize that pl0x :D
[code]ITEM.Name = 'Test Material'
ITEM.Price = 999000
ITEM.Model = 'models/harry/harry_potter.mdl'
function ITEM:OnEquip(ply, modifications)
ply:SetMaterial("Models/effects/splodearc_sheet")
end
function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
end
end
[/code]
[QUOTE=fast0nitro;44873634]I am trying to make it where when you buy this point shop addon it changes your material, I got it to do that but Im not sure how to make it revert back. :l Im looking for the code on holster to revert to normal material. this is what I have, I am a far noob realize that pl0x :D
[code]ITEM.Name = 'Test Material'
ITEM.Price = 999000
ITEM.Model = 'models/harry/harry_potter.mdl'
function ITEM:OnEquip(ply, modifications)
ply:SetMaterial("Models/effects/splodearc_sheet")
end
function ITEM:OnHolster(ply)
if ply._OldModel then
ply:SetModel(ply._OldModel)
end
end
[/code][/QUOTE]
Untested.
[code]ITEM.Name = 'Test Material'
ITEM.Price = 999000
ITEM.Model = 'models/harry/harry_potter.mdl'
function ITEM:OnEquip(ply, modifications)
ply:SetMaterial("Models/effects/splodearc_sheet")
OrgMaterial = ply:GetMaterial()
end
function ITEM:OnHolster(ply)
ply:SetMaterial(OrgMaterial)
end
[/code]
[CODE]ITEM.Name = 'Test Material'
ITEM.Price = 999000
ITEM.Model = 'models/harry/harry_potter.mdl'
function ITEM:OnEquip(ply, modifications)
ply:SetMaterial("Models/effects/splodearc_sheet")
end
function ITEM:OnHolster(ply)
ply:SetMaterial("")
end[/CODE]
There ya go.
[QUOTE=Marquis;44874047][CODE]ITEM.Name = 'Test Material'
ITEM.Price = 999000
ITEM.Model = 'models/harry/harry_potter.mdl'
function ITEM:OnEquip(ply, modifications)
ply:SetMaterial("Models/effects/splodearc_sheet")
end
function ITEM:OnHolster(ply)
ply:SetMaterial("")
end[/CODE]
There ya go.[/QUOTE]
Setting it to no material will cause an error iirc.
[QUOTE=code_gs;44874067]Setting it to no material will cause an error iirc.[/QUOTE]
It actually resets the material in my experience. Never got an error.
EDIT: [QUOTE=Gmod Wiki]Set material to "" in order to revert to the normal material of an entity. It is also possible to do this with many models by setting the material to the model string. [/QUOTE]
Sorry, you need to Log In to post a reply to this thread.