[Sandbox] How to disable the random player model when you spawn
5 replies, posted
Hello everyone !
I have a little problem on my server. I want to disable the random playermodel when you spawn for the first time on the server. I tried to find how to do that but i'm lost.
It's a problem because sometimes the player spawn with a vip model :/ If you know how to disable it with a command or something, That would be great !
( I tried the command GM.Config.enforceplayermodel = true but it didn't work )
Just hook player spawn and set their model there.
ot: wow first post in 11 years
Thank you for the answer but, I don't know how to do that. Can you tell me what i need to write and where ?
[QUOTE=xmathisx;50860329]Thank you for the answer but, I don't know how to do that. Can you tell me what i need to write and where ?[/QUOTE]
Make a new file in lua/autorun/server and inside put the following.
[CODE]
local vipmodels = {"models/player/gman_high.mdl", "models/player/leet.mdl"}
local usermodels = {"models/player/artic.mdl", "models/player/phoenix.mdl"}
local function playermodelyo(ply)
if ply:IsUserGroup("vip") then
ply:SetModel(table.random(vipmodels))
else
ply:SetModel(table.random(usermodels))
end
end
hook.Add("PlayerSpawn", "playermodelyo", playermodelyo)
[/CODE]
[ERROR] lua/autorun/server/randommodel.lua:8: attempt to call field 'random' (a nil value )
replace [B]table.random[/B] with [B]table.Random[/B], uppercase R
Sorry, you need to Log In to post a reply to this thread.