Wondering where the PlayerSpawn function is...

Hey,

I was kinda wondering where the PlayerSpawn function is, as I can’t seem to find it.

What I’m trying to do is make player(s) spawn with a custom model on a sandbox server.

(My server is a war server btw)

I was also wondering how many models to can set to spawn with, if you can.

E.G


 ply:SetModel("models/mw2guy/riot/riot_us.mdl"),
                   ("models/jessev92/player/military/cod4_sniper.mdl")

[lua]
– for an addon, you want this
hook.Add(“PlayerSpawn”,“custom_models”,function(ply)
ply:SetModel(“models/your/model/here.mdl”)
end)
– for a gamemode, you want this
function GM:PlayerSpawn(ply)
ply:SetModel(“models/your/model/here.mdl”)
end
[/lua]

Thanks for that, Do you know where the file is?

I have updated the example.
The first one you can put anywhere, provided that the file you put it in is being ran on the server.
The second one you can put anywhere in the gamemode, provided that the file you put it in is being ran on the server.

So basically I can just do this>

lua/autorun/server(or client)/PlayerSpawn.lua

with all that inside…?

You can do lua/autorun/server/PlayerSpawn.lua with the first example inside, OR gamemodes/your_gamemode_name/gamemode/init.lua (or any other file that runs on the server) with the second example inside.

Okay thanks Co2. :D, You’ve helped a lot.