-Hopefully this is in the right part of the forums, delete or move if ya want-
So whats going on is that i am trying to add player models to the pointshop (quick note they disappear when round starts, i think i have to use a separate timer or something). I have extracted Halo 3 Spartan models that comes with 6 different models, blue, gold, pink, white, green and red. For some reason the only model that appears is the last one, the red spartan, i have the same code with the other spartans (please note this is my first time trying to add player models so don't get mad at me too much, everyones got to start at some point, right?) and its really getting on my nerves, believe me please, i have tried to fix it before i came on here but now im stumped.
I'm not sure if i should paste my code because it is pretty long but basically it's this:
ITEM.Name = "Green Spartan"
ITEM.Price = 1250
ITEM.Model = "models/player/halo3/spartan_green.mdl"
ITEM.AllowedUserGroups = { "superadmin",
"admin",
"senior_moderator",
"moderator",
"Trial Moderator",
"donator" }
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
And the other spartans are the same just with different model locations and different names, of course.
Also when i do add them to the server a lua error pops up :
[ERROR] addons/spartan models/lua/autorun/spartan.lua:1: attempt to index global 'ITEM' (a nil value)
1. unknown - addons/spartan models/lua/autorun/spartan.lua:1
im probably just an idiot :/
i put this and the matierals and models folder etc in to the addons folder and i also copied and pasted the lua file in to the pointshop file (the correct one)
umm i guess if u got this far thanks for reading it, if you cant help me thats fine, im just a bit stuck.
hello I used to have same problem what you want to do from them to stop resetting is this
Go to gamemodes/terrortown/gamemode/player_ext•.lua
Scroll down to line 271, either delete it or hide it by adding "//" at the beginning of the code line. now your• models work after the round starts.
If you require any assistance in making the models work add me on steam snake5510
Im using those models for my ttt server as well and they work so I can tell you how to make everything work.
Thanks, i'll check now and post an update to say whether it worked, although, like in the OP i said the player models resetting isn't my big problem the problem is only the Red Spartan decides it wants to show up
are you sure that works? u dont have the other play_manager.AddValidModel commented and you dont have the functions after an item price
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
[QUOTE=funkyguy09;44502692]are you sure that works? u dont have the other play_manager.AddValidModel commented and you dont have the functions after an item price
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[/QUOTE]
scroll down the wall of code the pointshop script is a bit lower.
ITEM.Name = 'Spartan Gold'
ITEM.Price = 30000
ITEM.Model = 'models/player/Halo3/Spartan_gold.mdl'
ITEM.AllowedUserGroups = { "admin", "vip", "superadmin", "Donator", "moderator" }
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
u dont need anything more than this in your pointshop/lua file to make it work
do u add all the functions after each player model so e.g
ITEM.Name = 'Spartan Gold'
ITEM.Price = 30000
ITEM.Model = 'models/player/Halo3/Spartan_gold.mdl'
ITEM.AllowedUserGroups = { "admin", "vip", "superadmin", "Donator", "moderator" }
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
ITEM.Name = 'Spartan Green'
ITEM.Price = 30000
ITEM.Model = 'models/player/Halo3/Spartan_green.mdl'
ITEM.AllowedUserGroups = { "admin", "vip", "superadmin", "Donator", "moderator" }
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
yes exactly, but you need to make them in seperate files. dont clog it all up in same one.
[editline]10th April 2014[/editline]
yes exactly, but you need to make them in seperate files dont clog it all up in same one.
ohhhhhhhhhhh
thats why they only one was showing, i didnt realise they had to be seperate files, thanks
np, just make sure that you have all the
resource.addfile for your spartans otherwise other people wont see it.
Aside from that every player model needs their own file same goes with hats
weapons or anything that you add to pointshop
[url]http://www.facepunch.com/threads/showthread.php?t=911414[/url]
Here you can find list of the counter strike/half life models they are the standard gmod models
so you can just create file in the pointshop for these models without having to upload the models to your server
if your looking for a variety
just be careful not all of them work
ok thanks mate!
Sorry, you need to Log In to post a reply to this thread.