How would I track which playermodel players are using on default TTT?

I’m trying to make an SWEP that spawns a fake player, so the model has to be the same as the one that players are using on that specific map or it won’t work, obviously.

The function GetRandomPlayerModel() is called at the start of each round in the init.lua, and it looks like this.


'
local ttt_playermodels = {
   Model("models/player/phoenix.mdl"),
   Model("models/player/arctic.mdl"),
   Model("models/player/guerilla.mdl"),
   Model("models/player/leet.mdl")
};

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


how would I read into that? is it possible to to check an invidividual playermodel? If so, that would be optimal because then I could use the exact same model as the player who was creating the fake, regardless of wether or not they had a custom skin.

[LUA]
Model(“models/player/phoenix.mdl”),
Model(“models/player/arctic.mdl”),
Model(“models/player/guerilla.mdl”),
Model(“models/player/leet.mdl”)
};

function GetRandomPlayerModel()
local pmodel = table.Random(ttt_playermodels)
print( pmodel )
return pmodel
end
[/LUA]

then just store that variable

I ended up looking a little deeper into the folder, and I found GAMEMODE.playermodel, which a global variable you can call anytime to return their model :slight_smile: