Permanent Models - Player keep the player model they last had!

Hello, I’m using DarkRP 2.6 and I’m creating a NPC shop that allows players to buy new playermodels e.g Suits etc. When players spawn they automatically go to the default groups model. I’d like it so when they buy a new playermodel, leave and then rejoin they still have the playermodel they had before they disconnected. I was thinking that I could achieve this using File.Write although I’m not sure how I could quite do this. I’d like some help coming up with some ways that I could achieve my goal.

Sorry if this didn’t make sense, I’m not very good at explaining things, Reply with any questions.

Thanks in advance,
Danny

You’re going to need to learn how to work with databases.

do something like this

file.Write(“file/”…ply:SteamID64()…"/model.txt", ply:GetModel()) on disconnect then on join

ply:SetModel(file.Read(“file/”…ply:SteamID64()…"/model.txt", “DATA”))

That will eventually slow the server down. A database will be much more efficient.

Or just use PData

[lua]hook.Add(“PlayerDisconnected”,“savemodel”,function(ply)
ply:SetPData(“permamodel”,ply:GetModel())
end)

hook.Add(“PlayerInitialSpawn”,“loadmodel”,function(ply)
ply:SetModel(ply:GetPData(“permamodel”,ply:GetModel()))
end)[/lua]

There’s your example :smile:

Thanks so much guys for all the suggestions, I will try them all out and see which one works and is efficient and I will let you know what I decide to use! Thanks :slight_smile: