Hello! and first Issue

Hello, first I wanne say Hi!
This is my first post, I’m new here.
I started learning garry’s mod coding (lua) for a bit now.
But still have some problems, and I hope if someone can help me.

I’m tryin to make some sort of ‘no spawning’ thing;
But I can’t see what function I could use for making someone not being able to spawn and go into some sort of spectator mode.

I’m trying to fade the screen to black like a DFrame can (SetBackgroundBlur)
but can’t seem to find a function to do this without a DFrame

If anyone know what functions I could use for these issues, I would be thankfull?

for the one , try [lua]function SpawnedProp(ply, model, ent)
if ply:TEAM() = /Spectator team/ then

hook.Add(“PlayerSpawnedProp”, “playerSpawnedProp”, SpawnedProp)[/lua]**[Gamemode.PlayerSpawnedProp

and for the second you could place an overlay on the player screen, but i don’t know how.

I think he means player spawning (as in after they die) not entity spawning.

oh, i think i’m a bad reader :stuck_out_tongue:


Anyway, [lua]
function FirstSpawn( ply )

ply:SetTeam(/*spectator team*/)


hook.Add( “PlayerInitialSpawn”, “playerInitialSpawn”, FirstSpawn )[/lua]

Yeah, I too would like to know how to make a fade-in sort of thing.

I know you said how to do it without a dframe, but what is wrong with that? It’s relatively easy and it does the job.

I’m not sure I get what you want with the fading, but I had a go anyway.

[lua]function StartFade(fadetime)
local alpha = 0
hook.Add(“HUDPaint”, “Fade”, function()
alpha = math.Clamp(alpha + (255*FrameTime()/fadetime), 0, 255)
surface.SetDrawColor(Color(0, 0, 0, alpha))
surface.DrawRect(0, 0, ScrW(), ScrH())

function RemoveFade()
hook.Remove(“HUDPaint”, “Fade”)

This sounds good but is their a specatator mode? or do you need to make one?


Thanks, but is their a way to enforce on server? instead of client?


Your right, the function I have is doing it without a DFrame, I know a DFrame already has this function, but would love to accomplish it without a DFrame.

If its for a game mode, you simply put it in cl_init, and it is automatically forced.

Is it for a gamemode? Then the easiest way to disable both spawning and noclip is to derive your gamemode from “base” instead of “sandbox”.

Yes, making a gamemode.
and also my gamemode is based off base not from sandbox, so how would this care of the spawning?
Cause players still spawn in there


Yeah know this :smiley:
But I wsa thinking of a way so clients can’t ‘cheat’ it to disable it :stuck_out_tongue:


Yes I ment this.
Not spawning of entities, since i’m basing it of the ‘base’ gamemode

obviously untested…line 4: “aplha” not “alpha” :wink:

You can Sendlua it… but clients, if experienced enough, can still block it. ( Hint: ProcessUserMessage )

Yes, I didn’t have time to test it.

Nice to see you helping out maker :3:

I know right?

Yeah :byodood: