Hello, I'm trying to merge an old TTT addon called Chiefeh's mask shop with _Undefined's Pointshop. The result is mostly working except that the client can't find the mask's material. (The mask is just a floating material infront of the players face with no model).
Here's the item's file:
[CODE]ITEM.Name = 'Scatman'
ITEM.Price = 1000
ITEM.Material = 'materials/scatman.vtf'
ITEM.NoPreview = true
function ITEM:PostPlayerDraw(ply, modifications, ply2)
if not ply == ply2 then return end
if not ply:Alive() then return end
if ply.IsSpec and ply:IsSpec() then return end
local boneindex = ply:LookupBone("ValveBiped.Bip01_Head1")
if boneindex then
local pos, ang = ply:GetBonePosition( boneindex )
if pos and pos ~= ply:GetPos() then
ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Up(), -90 )
cam.Start3D2D( pos - ang:Forward() * 5 - ang:Right() * 10 + ang:Up() * 7, ang, 1 )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetTexture( surface.GetTextureID( 'materials/scatman' ) )
surface.DrawTexturedRect( 0, 0, 10, 10 )
cam.End3D2D()
end
end
end
if SERVER then
resource.AddFile('materials/scatman.vmt')
resource.AddFile('materials/scatman.vtf')
end[/CODE]
scatman.vmt and scatman.vtf are both located in the server's garrysmod/materials as well as on fastdl, however the files are not downloading to my client automatically, and with the files manually placed in my client I still get the error when any player looks at me or when I look at a player (It doesn't matter who has the mask on): --- Missing Vgui material materials/scatman
The result is a mask on the face just like it's supposed to be however it just shows missing textures.
Any help would be appreciated. The code for placing the mask is old, probably 2 or 3 years, as well as the vmt and vtf, but I don't see where they'd have an effect.
Put your resource.AddFiles in a separate file/your other resource.AddFile file.
[QUOTE=code_gs;45389755]Put your resource.AddFiles in a separate file/your other resource.AddFile file.[/QUOTE]
It's in lua/autorun now and I still have the same problem.
Can you post the link to your download server?
[url]http://fastdl.sky-netgaming.com/[/url]
[editline]14th July 2014[/editline]
[QUOTE=code_gs;45389979]Can you post the link to your download server?[/QUOTE]
And although the downloading is an issue it's not the biggest one. Even when I add the files to my clientside I still have the same problem
Any thoughts on this?
Can you post what the resource.AddFile file looks like and it's location? Also, is that FastDL link your sv_downloadurl (server.cfg)?
[QUOTE=code_gs;45393298]Can you post what the resource.AddFile file looks like and it's location? Also, is that FastDL link your sv_downloadurl (server.cfg)?[/QUOTE]
lua/autorun/masks.lua
[CODE]if SERVER then
resource.AddFile('materials/scatman.vmt')
resource.AddFile('materials/scatman.vtf')
end[/CODE]
Yes, it is and works with everything else fine
After some messing around,
1. The files are downloading correctly now
2. This is the code currently:
[CODE]ITEM.Name = 'Scatman'
ITEM.Price = 1000
ITEM.Material = 'materials/scatman.vtf'
ITEM.NoPreview = true
local masktexture = surface.getTextureID("scatman")
function ITEM:PostPlayerDraw(ply, modifications, ply2)
if not ply == ply2 then return end
if not ply:Alive() then return end
if ply.IsSpec and ply:IsSpec() then return end
local boneindex = ply:LookupBone("ValveBiped.Bip01_Head1")
if boneindex then
local pos, ang = ply:GetBonePosition( boneindex )
if pos and pos ~= ply:GetPos() then
ang:RotateAroundAxis( ang:Forward(), 90 )
ang:RotateAroundAxis( ang:Up(), -90 )
cam.Start3D2D( pos - ang:Forward() * 5 - ang:Right() * 10 + ang:Up() * 7, ang, 1 )
surface.SetDrawColor( 255, 255, 255, 255 )
surface.SetTexture( masktexture )
surface.DrawTexturedRect( 0, 0, 10, 10 )
cam.End3D2D()
end
end
end[/CODE]
3. I'm getting the error:
[ERROR] addons/pointshop-master/lua/items/headshatsmasks/scatman.lua:6: attempt to call field 'getTextureID' (a nil value)
1. unknown - addons/pointshop-master/lua/items/headshatsmasks/scatman.lua:6
So why is it returning nil? The files are materials/scatman.vtf and .vmt so shouldn't that code be correct?
It should be [b]G[/b]etTextureID.
[QUOTE=code_gs;45397093]It should be [b]G[/b]etTextureID.[/QUOTE]
Gah, I feel dumb now. Everything is working fine now. Thanks for the help, I appreciate you putting up with my stupidity :P
End result:
[IMG]http://cloud-4.steampowered.com/ugc/589160673536370656/30806C462A723D3AE86EC81047FA8CEC2A61F907/[/IMG]
[IMG]http://cloud-2.steampowered.com/ugc/589160673536431142/EDD603A0577A4A906ED000BA74F7FDF590EBC6C3/[/IMG]
Sorry, you need to Log In to post a reply to this thread.