Kill player when join the server?

Hello guys. How can I do to avoid player spawn when join the server? Because I’m having problems of people spawning as spectator and using items (like a ghost)

Like a blacklist or how?


hook.Add( "PlayerInitalSpawn", "KillOnSpawn", function( ply ) ply:Kill() end )

I spawn as a spectator. but my pointshop items stay on me (like I was alive). I want to avoid spawn when joint the server

mind you, because there are no if statements, you could even do


hook.Add( "PlayerInitalSpawn", "KillOnSpawn", FindMetaTable("Player").Kill )

but you shouldn’t

also use KillSilent

What gamemode?

Here’s essentially everything you need to spawn into a game as a spectator: https://dl.dropboxusercontent.com/u/26074909/tutoring/_systems/spectating_players_system.lua.html

If you’re writing a game-mode use GM functions, and if you’re modifying then use hook.Add except for the custom functions.

I’m using your system, but for some reason when player join the server. He become a Living spectator

I’d suggest this instead:


hook.Add( "PlayerInitalSpawn", "KillOnSpawn", function( ply ) ply:KillSilent() end )

If the player is spawning as a “living” spectator, then you will need to compare existing GM functions with what I’ve done… Don’t just copy/paste the script because depending on load order, it may do certain tasks but your game-mode may overwrite others…

To implement the features into an existing game-mode you’ll need to use hook.Add… If you’re writing a game-mode, you’ll need to create proper modifications.

On a new game-mode with the code provided active, the player spawns as a spectator and is required to choose a team ( using other methods ) before being able to be “alive”… I’ll be more than happy to help you implement it, but we need more info.

What game-mode is this for? Is it an existing game-mode or one you’re writing?

If existing, did you copy/paste the GM functions or change to hook.Add?

Depending on this answer, there is more to it when using hook.Add because it also executes prior to the GM function meaning the GM function will execute so you will have to return non-nil in the hook.Add for first-spawn and prevent the player from spawning until some value has been triggered which is controlled by the join-team command…

Have you updated your graphics card?

I’m writting a gamemod (Deathrun custom). I tried to kill player on initial spawn, but didn’t work. Also when I’m on spectator mod. I heard a footstep sound. And I didn’t see any sprite/sound.