• Spawn Timer
    3 replies, posted
Hey guys, need a little help. I'm trying to make just a simple spawn timer so when you die it starts the timer and after 10 seconds is up you are allowed to spawn. Thanks in advance
[lua] local function BlockPropSpawn(ply) if ply.CanSpawnProps == false then return false; end end hook.Add( "PlayerSpawnProp", "blockProps", BlockPropSpawn ) local function OnSpawn(ply) ply.CanSpawnProps = false timer.Simple(10,AllowSpawnProps,ply,ply) end hook.Add( "PlayerSpawn", "blockPlySpawn", OnSpawn ) function AllowSpawnProps(ply) ply.CanSpawnProps = true end [/lua] Not tested, just a gist.
[QUOTE=Gbps;18177052][lua] local function BlockPropSpawn(ply) if ply.CanSpawnProps == false then return false; end end hook.Add( "PlayerSpawnProp", "blockProps", BlockPropSpawn ) local function OnSpawn(ply) ply.CanSpawnProps = false timer.Simple(10,AllowSpawnProps,ply,ply) end hook.Add( "PlayerSpawn", "blockPlySpawn", OnSpawn ) function AllowSpawnProps(ply) ply.CanSpawnProps = true end [/lua] Not tested, just a gist.[/QUOTE] I don't think that's what he mean't. :smile: [lua]function RespawnTimeHook( Victim, Inflictor, Attacker ) // Don't spawn for at least 10 seconds Victim.NextSpawnTime = CurTime() + 10 end hook.Add("PlayerDeath","SetRespawnTime",RespawnTimeHook) [/lua] This should be all you need, it will work in any gamemode derived from base. It is so simple because the base gamemode already handles all of the work. If it doesn't work simply put it on a timer shorter then 2 seconds, that way you'll be sure to override the default spawn time.
Ahh, /facepalm. Thank you XD
Sorry, you need to Log In to post a reply to this thread.