I have tf2 hats for my admins and I am working on making clients download all the files they need to see the hat if they dont own tf2. I uncheck tf2 in my gmod settings to test it and my hat is pink? When I had my tf2 checked in gmod settings it was white and looked normal.
[img]http://i50.tinypic.com/23h9ev5.png[/img]
entity init.lua
[lua]
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")
include('shared.lua')
function SpawnCowFunction( pl )
local headcrabs , m = ents.FindByClass( "engi_texas" );
for _ , m in pairs( headcrabs ) do
if ( m && m:IsValid( ) && m:GetOwner( ) == pl ) then
return;
end
end
local eyes = pl:LookupAttachment( "eyes" );
if ( eyes == 0 ) then return; end
engi = ents.Create( 'engi_texas' );
engi:SetOwner( pl );
engi:SetParent( pl );
engi:SetModel("models/player/items/engineer/engineer_cowboy_hat.mdl")
engi:Spawn( );
engi:Activate( );
engi:SetMoveType( MOVETYPE_NONE )
engi:SetSolid( SOLID_NONE )
engi:SetCollisionGroup( COLLISION_GROUP_NONE )
engi:DrawShadow( false )
return engi;
end
function ENT:Think()
if self.Entity:GetOwner():GetViewEntity():GetClass() == "gmod_cameraprop" then
self.Entity:GetOwner():SetNWBool( "Camera", true)
else
self.Entity:GetOwner():SetNWBool( "Camera", false)
end
end
[/lua]
entity cl_init.lua
[lua]
include("shared.lua")
function ENT:Think()
if self.Entity:GetOwner():GetNWBool("Camera") == true then
if LocalPlayer() == not self.Entity:GetOwner() then
self.Entity:SetColor(255,255,255,255)
elseif LocalPlayer() == self.Entity:GetOwner() then
self.Entity:SetColor(255,255,255,255)
end
elseif self.Entity:GetOwner():GetNWBool("Camera") == false then
if LocalPlayer() == not self.Entity:GetOwner() then
self.Entity:SetColor(255,255,255,255)
elseif LocalPlayer() == self.Entity:GetOwner() then
self.Entity:SetColor(0,0,0,0)
end
end
end
function ENT:Draw()
local owner = self.Entity:GetOwner()
if owner:GetRagdollEntity() then
owner = owner:GetRagdollEntity()
elseif not owner:Alive() then return end
local boneindex = owner:LookupBone("ValveBiped.Bip01_Head1")
if boneindex then
local pos, ang = owner:GetBonePosition(boneindex)
if pos and pos ~= owner:GetPos() then
self.Entity:SetPos(pos + ang:Forward()*1 + ang:Right()*-1)
ang:RotateAroundAxis(ang:Right(),-90)
ang:RotateAroundAxis(ang:Up(),270)
self.Entity:SetAngles(ang)
self.Entity:DrawModel()
return
end
local attach = owner:GetAttachment(owner:LookupAttachment("eyes"))
if not attach then attach = owner:GetAttachment(owner:LookupAttachment("head")) end
if attach then
self.Entity:SetPos(attach.Pos)
self.Entity:SetAngles(attach.Ang)
self.Entity:DrawModel()
end
end
end
[/lua]
entity shared.lua
[lua]
ENT.Type = "anim"
ENT.Base = "base_anim"
ENT.PrintName = "Shane's Cowboy Hat"
ENT.Author = "Shane"
ENT.Category = "Admin Hats"
ENT.Spawnable = false
ENT.AdminSpawnable = false
[/lua]
server cl_init.lua
[lua]
resource.AddFile( "materials/models/player/items/engineer/cowboy_hat.vmt" )
resource.AddFile( "materials/models/player/items/engineer/cowboy_hat.vtf" )
resource.AddFile( "models/player/items/engineer/engineer_cowboy_hat.dx80.vtx" )
resource.AddFile( "models/player/items/engineer/engineer_cowboy_hat.dx90.vtx" )
resource.AddFile( "models/player/items/engineer/engineer_cowboy_hat.mdl" )
resource.AddFile( "models/player/items/engineer/engineer_cowboy_hat.phy" )
resource.AddFile( "models/player/items/engineer/engineer_cowboy_hat.sw.vtx" )
resource.AddFile( "models/player/items/engineer/engineer_cowboy_hat.vvd" )
[/lua]
Have them buy TF2. Your problem will be solved and they'll thank you for it!:smile:
Although while nobody really cares if you do it, it's illegal to send people copyrighted files that they don't own.
[QUOTE=Jamie932;18567642]It looks nice pink <3[/QUOTE]
That's probably how it was originally meant to look!:buddy:
Can we get back on topic..?
[QUOTE=darklighte;18568601]Can we get back on topic..?[/QUOTE]
No, warez isn't a really hot topic around here.
Ok then forget it is a tf2 hat and imagine its a pie model?
[QUOTE=darklighte;18568652]Ok then forget it is a tf2 hat and imagine its a pie model?[/QUOTE]
Well I don't see a problem with your code, so I would expect it to work well the way you did it.
You need Team-Fortress 2 mounted and installed to show the materials for the model.
How can you have the tf2 model without the material :psyduck:
The client is sent all the model files along with the material, it just turns pink for some reason.
[QUOTE=Gbps;18577641]How can you have the tf2 model without the material :psyduck:[/QUOTE]
[img]http://filesmelt.com/downloader/vacbanloldv3.jpg[/img]
Sorry, you need to Log In to post a reply to this thread.