Hey i'm not sure whether i'll get any help from here anymore but i've been having a rather annoying issue with my custom TTT server and trying to add models to the pointshop.
I've followed multiple tutorials through and through not missing a single detail and for some reason i keep getting an error when starting up my server that the item has no name and i can't for the life of me fix it even looking at past threads on this site have drawn me at a blank.
Someone please help this has been an issue for weeks!!
Can you post the error and code?
Here
ITEM.Name = 'Dracula'
ITEM.Price = 10000
ITEM.Model = 'Program Files (x86)/Steam/steamapps/common/GarrysMod/garrysmod/addons'
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
function ITEM:PlayerSetModel(ply)
ply:SetModel(self.Model)
end
)
if (SERVER) then
player_manager.addvalidmodel( 'Dracula', 'Program Files (x86)/Steam/steamapps/common/GarrysMod/garrysmod/addons' )
AddCSLuaFile( 'Dracula.lua' )
end
list.Set( 'PlayerOptionsModel', 'Dracula', 'Program Files (x86)/Steam/steamapps/common/GarrysMod/garrysmod/addons' )
https://files.facepunch.com/forum/upload/175146/8fcbde55-63af-40d1-b818-50cec5cb33e1/image.png
A few problems with your code:
All paths in Garry's Mod are relative - you begin from the "garrysmod" folder. Even addons are reflected into a virtual directory, meaning if your model is in ~/addons/my_addon/models/subfolder/dracula.mdl, your path would just be "models/subfolder/dracula.mdl". This apples to the ITEM.Model and AddValidModel call.
You have a random close parenthesis on line 43.
Functions in Lua are case-sensitive - that means it should be AddValidModel instead of addvalidmodel.
You don't have to AddCSLuaFile item files.
You don't need the list.Set line anymore.
i've fixed everything except for the line 43 issue im genrally new to code so i have no idea what the issue maybe because it seems the same as all of the other resources
The solution is to just remove it. There's no reason for it to be there and every close parenthesis needs an open, which that does not have.
Sorry for the late response but i've fixed every issue you've listed and i'm still getting
unexpected symbol '>' and item name missing
Post your new code in a code block.
ITEM.Name = "Dracula"
ITEM.Price = 10000
ITEM.Model = "Model/dracula_cvlos2_player/Dracula.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
function ITEM:PlayerSetModel(ply)
ply:SetModel(self.Model)
end
)
if (SERVER) then
player_manager.AddValidModel( "Dracula", "Model/dracula_cvlos2_player/Dracula.mdl" )
end
The folder is "models/", not "Model/", and you still have a random close parenthesis on line 47.
ok so change the folders and remove line 47 along with line 43 gotcha i'll let you know if it works or not
Can you post the error again and your new code? Please use the code block feature on the forum.
player_manager.AddValidModel( "Dracula LoS2", "models/dracula_cvlos2_player/dracula.mdl" )
player_manager.AddValidHands( "Dracula LoS2", "models/dracula_cvlos2_player/dracula_arms.mdl", 0, "00000000" )
ITEM.Name = "Dracula"
ITEM.Price = 10000
ITEM.Model = "models/dracula_cvlos2_player/dracula.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
function ITEM:PlayerSetModel(ply)
ply:SetModel(self.Model)
end
)
if (SERVER) then
player_manager.AddValidModel( "Dracula", "models/dracula_cvlos2_player/dracula.mdl" )
end
--// File Generated By Fox-Warrior's Resources Generator Version 2.06 \\--
if (SERVER) then
resource.AddFile( "models/dracula_cvlos2_player/dracula.mdl" )
resource.AddFile( "models/dracula_cvlos2_player/dracula_arms.mdl" )
resource.AddFile( "materials/vgui/entities/npc_dracula_p.vmt" )
resource.AddFile( "materials/vgui/entities/npc_dracula_p.vtf" )
resource.AddFile( "materials/vgui/entities/npc_dracula_ph.vmt" )
resource.AddFile( "materials/vgui/entities/npc_dracula_ph.vtf" )
resource.AddFile( "materials/models/castlevania_los2/coat.vmt" )
resource.AddFile( "materials/models/castlevania_los2/coat_nocull.vmt" )
resource.AddFile( "materials/models/castlevania_los2/eyeboll.vtf" )
resource.AddFile( "materials/models/castlevania_los2/eyel.vtf" )
resource.AddFile( "materials/models/castlevania_los2/eyer.vtf" )
resource.AddFile( "materials/models/castlevania_los2/face.vtf" )
resource.AddFile( "materials/models/castlevania_los2/hair.vmt" )
resource.AddFile( "materials/models/castlevania_los2/hair.vtf" )
resource.AddFile( "materials/models/castlevania_los2/hair_noalpha.vmt" )
resource.AddFile( "materials/models/castlevania_los2/l_eye.vmt" )
resource.AddFile( "materials/models/castlevania_los2/r_eye.vmt" )
resource.AddFile( "materials/models/castlevania_los2/torso.vmt" )
resource.AddFile( "materials/models/castlevania_los2/torso.vtf" )
end
https://files.facepunch.com/forum/upload/175146/c83adef1-ae9a-4b74-ac6e-1a4b6bf53881/image.png
Once again, you still have a random close parenthesis just sitting around. You're also adding the Dracula player model twice with AddValidModel. By the way, the error is saying unexpected symbol near ')', not '>' - the cmd font just looks jagged.
okay on the sunject of parenthesis im extremely sorry cause i haven't a slightest clue what they are and i will delete one of the dracula model lines.
These are parentheses ()
Right so if i'm following you correctly delete the brackets (parenthesis) when there is no writing inside??
No, delete the single parenthesis just sitting in the middle of the file. It says exactly where in the error.
It worked thanks so much for your help it's extremely appreciated
Sorry, you need to Log In to post a reply to this thread.