Storing a player model to be set every time you spawn?

Basically, I have a window come up when you join to choose your model, but I want that model to stick, even if you die. How can I store the model and set a players model every time they spawn to the one they chose when they joined?

-snip misread question-

you can use sql lite (bundled with gmod), mysql (requires module and server) or write to a text file which will lag your server every time it writes.

theres probably more ways to do it but those are the main 3.

once you are saving it, you can edit the GM:PlayerSpawn(ply) hook to retrieve the information from the server/file

Care to provide some example code?

Dude. Its easy. On the Inital Spawn hook, pop up the menu. Once they pick the model, store it as a variable on the player. on the PlayerSpawn hook, set the model to the one stored on the player. Done.

I don’t know how to!

Initial Spawn

Player Spawn

[lua]
function GM:PlayerInitialSpawn( ply )
//Menu shit should pop up on player in here
ply.PickedModel = “”
end

function GM:PlayerSpawn( ply )
ply:SetModel(ply.PickedModel)
end
[/lua]
Its not hard.

How do I define PickedModel?

… seriously? Dude if you don’t even understand the simplest of concepts dealing with variables… go to the tutorials section on the wiki.

Thanks for your help.

Yes I am dumb because you don’t know what the hell you’re talking about. Lemme tell ya.

What troubles me even further… You have a menu right? 20 bucks says you didn’t make it. If you DID, then you should be able to do this simplest of code. I gave you what you needed, but you apparently dont even have the knowledge to build off of it, or even attempt for the matter.

I understand derma quite fine.

Then tell me. How is it you understand Derma, but you cant understand a damned variable when it is staring you right in the fucking face?



ply.PickedModel = ""


That’s how PickedModel is defined. It is sitting right there in black and white.

I call bullshit.

No need for rudeness. I just don’t understand this side of it all.

You have to know what a variable is in order to make Derma menus… You have to know what parameters are and such…

What I gave you, you should be perfectly knowledgeable in knowing how to take a string, and set it on a variable, then call it later on in a SetModel parameter… If you don’t, then good luck to you.

Your answer has been given. Twice in fact.

If you still have no clue, do what I suggested and go to the Tutorials section. Here I’ll even link it to you since everything seems to be required to done for you: Here