How to install custom player models on my server?

Hello,

I would like to know how to do that. And I would like to be the only one able to use the skin I’ll install, sort of " admin skin ". I know how to force players to download it with ULX.

Thanks in advance.

I have been banned last time, I hope this is the right place to ask that, this time…

To install: Simply slap it on like any other addon (or if it’s not in addon format, just stick it in the models/player folder

To set it as admin only? I don’t know for sure, but you might have to use Lua to put it in the “select-model” list. Just omit the Lua and use UTeam to force your model to that particular model

Ok I’ll try that, but about UTeam, only a set of " pre-listed " models work. At the moment, not all default models work with the force thing, so I doubt it will work with customized ones.

Then make a Lua that sets your model to it.

I don’t know enough Lua to do it for you, but I know enough to pseudo-code it (with probable syntactical errors):

[lua]local function SetMyPlyModel()
if (Player_Steam_ID == Euphytoses_Steam_ID)
ply:SetModel(“models/player/euphytose.mdl”)
end
end

hook.Add(“PlayerSpawn”, “SetMyPlyModel”, SetMyPlyModel)[/lua]

I guess I have to put it in lua/autorun/server.

It’s a really simple script, thanks.

Edit : Is this thing kept if I change the server I am on?

I mean, I think I’ll do that with other players too, so I would like to know if they will be Kleiner back after left my server, or recover the player model they chose in the menu, a " normal ", default skin.

I know it doesn’t affect your settings when you do that with UTeam. But as I said, I’ll probably won’t be able to do that with UTeam.

No prob. I hope you know enough Lua to actually get it working :stuck_out_tongue:


function PlayerSpawn(ply)
	if ply:IsAdmin() or ply:IsSuperAdmin() then
		ply:SetModel("MyCustomModel")
	elseif ply:GetModel() == "MyCustomModel" then
		ply:SetModel("kleiner.mdl")
	end
end
hook.Add("PlayerSpawn" , "AdminModel" , PlayerSpawn)

I’m a pure noob at LUA coding but does this code set admins to the skin I’ll choose too? If it’s true, it’s not exactly what I want. The LUA posted above looked more simple and it was set by Steam ID, could you confirm that the LUA posted above works? If yes I’ll probably use it instead of yours. Or, could you explain exactly what your LUA does? Especially this line :

elseif ply:GetModel() == “MyCustomModel” then
ply:SetModel(“kleiner.mdl”)

Thanks.


function PlayerSpawn(ply) // Start the function with the first argument as the player entity
	if ply:SteamID() == "STEAM_0:1:123456" then // replace the steamid with your own
		ply:SetModel("MyCustomModel") // Set the model
	elseif ply:GetModel() == "MyCustomModel" then // If the player's steamid isn't yours and model is your custom one, then
		ply:SetModel("kleiner.mdl") // Sets them as a kleiner
	end // End the if statement
end // End the function
hook.Add("PlayerSpawn" , "AdminModel" , PlayerSpawn) // Calls the PlayerSpawn function when a player spawns

Tried to explain it in the internal comments.

Lavacano’s wouldn’t work, though theoratically it was almost right.

Ok, I got it. It means the player will be able to select my model from the list, but if he does that, he will be turned into Kleiner.

Thanks. :slight_smile:

It doesn’t work.

I put that


list.Set( "PlayerOptionsModel", "Grim Reaper", "models/grim.mdl" )
player_manager.AddValidModel( "Grim Reaper", "models/grim.mdl" )

into playermodelpack/lua/autorun and orangebox/garrysmod/lua/autorun, but it doesn’t work, it don’t know why, it worked perfectly in single player, and your script doesn’t work too, I put it in lua/autorun and lua/autorun/server, but it doesn’t work. The model is well downloaded, with fast .bz2 files etc… But I can’t select it from the player menu.

[editline]01:51PM[/editline]

Ok, I could select him by placing the LUA into MY LUA folder, now it’s ok because it’s MY model, but when I will want to have custom models for " normal " players, I won’t be able to do that.

[editline]01:56PM[/editline]

I think forcing the download of the " add player model to the menu " LUA to the client could work.

Sorry for " bumping " but your restrict script doesn’t work, I put it in lua/autorun and lua/autorun/server, but it doesn’t work, a player has been seen playing around with my skin. :’(