• [TTT] Server only using last player model shown
    10 replies, posted
-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
Im gonna make this easier for ya copy this script into your auto run player_manager.AddValidModel( "Spartan - Gold", "models/player/Halo3/Spartan_gold.mdl" ) player_manager.AddValidModel( "Spartan - Green", "models/player/Halo3/Spartan_green.mdl" ) player_manager.AddValidModel( "Spartan - Pink", "models/player/Halo3/Spartan_pink.mdl" ) player_manager.AddValidModel( "Spartan - White", "models/player/Halo3/Spartan_white.mdl" ) player_manager.AddValidModel( "Spartan - Red", "models/player/Halo3/Spartan_red.mdl" ) player_manager.AddValidModel( "Spartan - Blue", "models/player/Halo3/Spartan_blue.mdl" ) list.Set( "PlayerOptionsModel", "Spartan - Gold", "models/player/Halo3/Spartan_gold.mdl" ) list.Set( "PlayerOptionsModel", "Spartan - Green", "models/player/Halo3/Spartan_green.mdl" ) list.Set( "PlayerOptionsModel", "Spartan - Pink", "models/player/Halo3/Spartan_pink.mdl" ) list.Set( "PlayerOptionsModel", "Spartan - White", "models/player/Halo3/Spartan_white.mdl" ) list.Set( "PlayerOptionsModel", "Spartan - Red", "models/player/Halo3/Spartan_red.mdl" ) list.Set( "PlayerOptionsModel", "Spartan - Blue", "models/player/Halo3/Spartan_blue.mdl" ) if (SERVER) then player_manager.AddValidModel( "Spartan Green", "models/player/Halo3/Spartan_green.mdl" ) AddCSLuaFile( "halo3spartan.lua" ) end list.Set( "PlayerOptionsModel", "Spartan Green", "models/player/Halo3/Spartan_green.mdl" ) --// File Generated By Fox-Warrior's Resources Generator Version 2.04 \\-- if (SERVER) then resource.AddFile( "models/player/halo3/spartan_blue.mdl" ) resource.AddFile( "models/player/halo3/spartan_gold.mdl" ) resource.AddFile( "models/player/halo3/spartan_green.mdl" ) resource.AddFile( "models/player/halo3/spartan_pink.mdl" ) resource.AddFile( "models/player/halo3/spartan_red.mdl" ) resource.AddFile( "models/player/halo3/spartan_white.mdl" ) resource.AddFile( "materials/models/player/halo3/security_white/security.vmt" ) resource.AddFile( "materials/models/player/halo3/security_white/security.vtf" ) resource.AddFile( "materials/models/player/halo3/security_white/security_bump.vtf" ) resource.AddFile( "materials/models/player/halo3/security_white/security_exp.vtf" ) resource.AddFile( "materials/models/player/halo3/security_white/security_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/security_red/security.vmt" ) resource.AddFile( "materials/models/player/halo3/security_red/security.vtf" ) resource.AddFile( "materials/models/player/halo3/security_red/security_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/security_pink/security.vmt" ) resource.AddFile( "materials/models/player/halo3/security_pink/security.vtf" ) resource.AddFile( "materials/models/player/halo3/security_pink/security_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/security_green/security.vmt" ) resource.AddFile( "materials/models/player/halo3/security_green/security.vtf" ) resource.AddFile( "materials/models/player/halo3/security_green/security_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/security_gold/security.vmt" ) resource.AddFile( "materials/models/player/halo3/security_gold/security.vtf" ) resource.AddFile( "materials/models/player/halo3/security_gold/security_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/security_blue/security.vmt" ) resource.AddFile( "materials/models/player/halo3/security_blue/security.vtf" ) resource.AddFile( "materials/models/player/halo3/security_blue/security_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_white/scout.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_white/scout.vtf" ) resource.AddFile( "materials/models/player/halo3/scout_white/scout_bump.vtf" ) resource.AddFile( "materials/models/player/halo3/scout_white/scout_exp.vtf" ) resource.AddFile( "materials/models/player/halo3/scout_white/scout_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_red/scout.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_red/scout.vtf" ) resource.AddFile( "materials/models/player/halo3/scout_red/scout_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_pink/scout.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_pink/scout.vtf" ) resource.AddFile( "materials/models/player/halo3/scout_pink/scout_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_green/scout.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_green/scout.vtf" ) resource.AddFile( "materials/models/player/halo3/scout_green/scout_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_gold/scout.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_gold/scout.vtf" ) resource.AddFile( "materials/models/player/halo3/scout_gold/scout_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_blue/scout.vmt" ) resource.AddFile( "materials/models/player/halo3/scout_blue/scout.vtf" ) resource.AddFile( "materials/models/player/halo3/scout_blue/scout_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_white/rogue.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_white/rogue.vtf" ) resource.AddFile( "materials/models/player/halo3/rogue_white/rogue_bump.vtf" ) resource.AddFile( "materials/models/player/halo3/rogue_white/rogue_exp.vtf" ) resource.AddFile( "materials/models/player/halo3/rogue_white/rogue_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_red/rogue.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_red/rogue.vtf" ) resource.AddFile( "materials/models/player/halo3/rogue_red/rogue_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_pink/rogue.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_pink/rogue.vtf" ) resource.AddFile( "materials/models/player/halo3/rogue_pink/rogue_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_green/rogue.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_green/rogue.vtf" ) resource.AddFile( "materials/models/player/halo3/rogue_green/rogue_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_gold/rogue.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_gold/rogue.vtf" ) resource.AddFile( "materials/models/player/halo3/rogue_gold/rogue_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_blue/rogue.vmt" ) resource.AddFile( "materials/models/player/halo3/rogue_blue/rogue.vtf" ) resource.AddFile( "materials/models/player/halo3/rogue_blue/rogue_visor.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_white/recon.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_white/recon.vtf" ) resource.AddFile( "materials/models/player/halo3/recon_white/reconvisor.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_white/recon_bump.vtf" ) resource.AddFile( "materials/models/player/halo3/recon_white/recon_exp.vtf" ) resource.AddFile( "materials/models/player/halo3/recon_red/recon.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_red/recon.vtf" ) resource.AddFile( "materials/models/player/halo3/recon_red/reconvisor.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_pink/recon.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_pink/recon.vtf" ) resource.AddFile( "materials/models/player/halo3/recon_pink/reconvisor.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_green/recon.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_green/recon.vtf" ) resource.AddFile( "materials/models/player/halo3/recon_green/reconvisor.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_gold/recon.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_gold/recon.vtf" ) resource.AddFile( "materials/models/player/halo3/recon_gold/reconvisor.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_blue/recon.vmt" ) resource.AddFile( "materials/models/player/halo3/recon_blue/recon.vtf" ) resource.AddFile( "materials/models/player/halo3/recon_blue/reconvisor.vmt" ) resource.AddFile( "materials/models/player/halo3/odst_white/odst.vmt"
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.