hooks like playerinitialspawn

hey im trying to make a motd for my server that makes your player wait to spawn till you click spawn on the motd. im not sure what hook to use to stop the player from spawning. also to open the menu. i have tryed playerinitialspawn

this will be for darkrp.

Playerinitialspawn = serverside, there is no LocalPlayer serverside

exactly. so i’m looking for help on what to use instead. or how i use it to make the motd come up for players

concommand.Add(“openhud”, function()
–derma stuff

hook.Add(“PlayerInitialSpawn”, “barf”, function(ply)

As far as I know you cannot disable spawning… I did something like this in my server:

  • store the positions/angle of all spawnpoints of the map
  • delete all spawn points
  • create one spawnpoint where the player cannot be seen (in a wall or whatever)
  • set player’s camera to a nice position, or if your MOTD takes the whole screen, set the camera very far so he cannot hear sounds of players or props
  • when he press the Spawn button, set player position/angle to a random that you stored earlier, and reset his view
  • of course when any player died, you have to respawn them to a stored position as well

Crappy workaround, but it works…

Why not just set them as a spectator and disable movement?

thanks for the ideas! but how did you get all the spawn points and remove them? did u really edit the map or with code?

[editline]23rd October 2014[/editline]

how can i make some one a spectator in darkrp

I don’t know for that spectator thing I have never tried,

Here is how you can store all spawnpoints, delete them, and create a new one

local spawnpoints = {}
for k, v in pairs(ents.FindByClass( "info_player_start" )) do
    spawnpoints[k] = { pos = v:GetPos(), angle = v:GetAngles().yaw }
PrintTable( spawnpoints )

local spawnpoint = ents.Create( "info_player_start" )
spawnpoint:SetPos( Vector( X, Y, Z ) )
spawnpoint:SetAngles( Angle( 0, YAW, 0 ) )

But, I’m not sure if this method will work well with darkrp…

sweet! thanks so much guys/gals

[editline]23rd October 2014[/editline]

im also trying to change the players view ace told me to use CalcView but my code seems to not work

[editline]23rd October 2014[/editline]

and setting player:spectate and lock dont do anything
or its just me?

hook.Add("PlayerInitialSpawn", "startscreen", function()

Player:Spectate( OBS_MODE_FIXED )



local function OriginCam()
	local CamData = {}
	CamData.angles = Angle(8.711967, 91.382660, 0.000000)
	CamData.origin = Vector(-1461.001465, -3167.425781, 742.591553)
	CamData.x = 0
	CamData.y = 0
	CamData.w = ScrW()
	CamData.h = ScrH()
	render.RenderView( CamData )
hook.Add("HUDPaint", "OriginCam", OriginCam)

[editline]23rd October 2014[/editline]

WOOT NVM IT WORKS JUST FORGOT HOW TO USE NET LIBRARY. but calc view does nothing and so does spectate

[editline]23rd October 2014[/editline]

ok so all the code looks right but nothing hapends i spawn like normal and no errors. im going to try render.renderview

[editline]23rd October 2014[/editline]

so render.renderview gave me what i was looking for but now i need to make the player a spectator

[editline]23rd October 2014[/editline]

everything works now i need to find out how to draw the derma and make the mouse appear like when u press f3