• ply:SetModel() doesn't do anything at all
    2 replies, posted
I am not sure why it doesn't do anything, it only sets the playermodel once when it spawns for the first time, then it won't work ever again. This is for a game mode and not only does it not work when I want to use it for its intended purposes it also won't work if I just use via console or any other way. Here's the piece of code I made: function GM:PlayerSpawn(ply)      local jobString = ply:getJob()      if(jobString == "Invalid") then           jobString = self.Settings.BaseJob           ply:setJob(jobString)      end      local jobTable = self.Jobs[jobString]      ply:StripWeapons()      ply:StripAmmo()      for k, v in pairs(jobTable["Weapons"]) do           ply:Give(v)      end      ply:DrawViewModel(true)      hook.Run("PlayerSetModel", ply) end function GM:PlayerSetModel(ply)      local jobString = ply:getJob()      if(jobString == "Invalid") then           jobString = self.Settings.BaseJob           ply:setJob(jobString)      end      local jobTable = self.Jobs[jobString]      ply:SetModel(jobTable["Playermodel"]) end Here are the jobs: GM.Jobs = GM.Jobs || {} GM.Jobs["Class D"] = {      ["Weapons"] = {"weapon_fists", "weapon_bugbait"},      ["Salary"] = 30,      ["Playermodel"] = "models/player/group01/female_06.mdl" } GM.Jobs["Security"] = {      ["Weapons"] = {"weapon_fists", "weapon_pistol", "weapon_smg1"},      ["Salary"] = 125,      ["Playermodel"] = "models/player/kerry/class_securety.mdl" } GM.Settings.BaseJob = "Class D" There is nothing wrong with my functions, I already triple checked. The SetModel function just isn't setting the model. If you need more information I am running this only serverside.
Had a similar problem, it seems like PlayerSetModel seems to be called before something resets the model, try PlayerLoadout hook for setting the model.
I reinstalled gmod, removed all addons. And it's all working correctly now. :-)
Sorry, you need to Log In to post a reply to this thread.