Author Topic: TTT Setting ulx usergroups to custom player models.  (Read 3112 times)

0 Members and 1 Guest are viewing this topic.

Offline PeddleMe

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
TTT Setting ulx usergroups to custom player models.
« on: March 02, 2017, 07:34:06 PM »
Hi, I'm not entirely sure if I'm posting in the correction section, sorry if I am. :/

I've been trying to set ulx groups to have custom player models on spawn for TTT. So far this is all I've got:

Quote
   if ply:IsUserGroup("owner") then
      return "models/player/superheroes/superman.mdl"
   end
I placed this into lua/autorun/server

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: TTT Setting ulx usergroups to custom player models.
« Reply #1 on: March 02, 2017, 08:07:49 PM »
Is that the _only_ code you have?
Is that code in a function?
Does TTT call whatever function you have, and set the model of the player depending on if it's returned.
The way you have it set is literally returning "/model/.../path/etc" to whatever is calling it.
If that code is just in a file, it's likely erroring out on server start.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline PeddleMe

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
Re: TTT Setting ulx usergroups to custom player models.
« Reply #2 on: March 02, 2017, 08:19:04 PM »
Is that the _only_ code you have?
Is that code in a function?
Does TTT call whatever function you have, and set the model of the player depending on if it's returned.
The way you have it set is literally returning "/model/.../path/etc" to whatever is calling it.
If that code is just in a file, it's likely erroring out on server start.
Yes this is the only code I have.
It's not in a function.
The only model related stuff I have are;
shared.lua
Quote
-- Everyone's model
local ttt_playermodels = {
   
   Model("models/player/gman_high.mdl")
   
};

function GetRandomPlayerModel()
   return table.Random(ttt_playermodels)
end


local ttt_playercolors = {
   all = {
      COLOR_GREEN
   },

   serious = {
      COLOR_DGREEN
   }
};

player.lua
Quote
hook.Call("PlayerSetModel", GAMEMODE, ply)

player_ext.lua
Quote
function plymeta:SpawnForRound(dead_only)
   hook.Call("PlayerSetModel", GAMEMODE, self)

Those last three quotes are from the original TTT files with only the first one being slightly edited. I'm posting these because when I tried to add functions (a couple of hours ago, I get kept getting errors from these lines; forgot what functions I was adding because I gave up at some point :/ ).




An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given