Is it possible to disable the click to respawn thing Gmod has? I have made a function that handles respawning and giving the players the weapons they need depending on their role. But if a player clicks with the mouse to respawn before the timer is up, it results in double-spawning and first getting your weapons on the second spawn, and also causing wierd errors with the HUD. Here is the function in case anyone can use that:
[CODE]function playerRespawning( victim, weapon, killer )
if victim:Team() == 2 then
if IsValid( jail ) then
timer.Simple(4, function() victim:Spawn() victim:Give("cr_hands") end)
timer.Simple(0.1, function() victim:SetJailed() end)
else
timer.Simple(4, function() victim:Spawn() victim:Give("cr_hands") victim:Give("weapon_crowbar") end)
end
elseif victim:Team() == 4 then
if IsValid( jail ) then
timer.Simple(4, function() victim:Spawn() victim:Give("cr_hands") end)
timer.Simple(0.1, function() victim:SetJailed() end)
else
timer.Simple(4, function() victim:Spawn() victim:Give("cr_hands") victim:Give("weapon_crowbar")
umsg.Start("hassmokespawn")
umsg.Bool(false)
umsg.End() end)
end
elseif victim:Team() == 3 then
timer.Simple(4, function() victim:Spawn() end)
timer.Simple(0.1, function() victim:SetJailed() end)
elseif victim:Team() == 1 or victim:Team() == 5 then
timer.Simple(4, function() victim:Spawn() end)
end
end
hook.Add("PlayerDeath", "Respawning", playerRespawning)[/CODE]
What gamemode is this for?
[QUOTE=NiandraLades;45208803]What gamemode is this for?[/QUOTE]
My own gamemode. It is a gamemode based on the variation of Tag called "Cops and Robbers" (or at least here in my country), where a few taggers are selected, and if they tag a runner (hit them with a stuntick), the runners are teleported to a jail, at which the other free runners can hit them with a crowbar to free them again.
Override the [url=http://wiki.garrysmod.com/page/GM/PlayerDeathThink]PlayerDeathThink[/url] hook. In the base gamemode, the player is respawned if they're clicking or jumping.
[url=https://github.com/garrynewman/garrysmod/blob/ff51a59d5a821dec3c8f524631c86150b3e4744d/garrysmod/gamemodes/base/gamemode/player.lua#L98]Original[/url]
Sorry, you need to Log In to post a reply to this thread.