ply:Kill() for several minutes.

May be a simple question, I’m not sure though.

I’m currently developing a gamemode … Euh yea, I’m new to lua, however I want to try and make one … unfortunately problems stop me from finishing it.

I’m coding it’s own admin system, and it’s great so far. The only thing missing, is a “demote” option. The player shall be spawned first of all and then killed for 5 minutes and not able to respawn.


--[[ TO-AS.: ForceTeamSur ]]--
	hook.Add( 'PlayerSay', 'TheOpen127', function( ply, text, isteam )
	
		text = string.lower( text )
		
		if ( string.sub( text, 0, 7 ) == "!demote" ) then
			text = string.Explode( " ", text )
			local victim = TheOpenFind( text[2] )
			
			if ( IsValid( victim ) ) then
				victim:SetModel( "models/player/hostage/hostage_02.mdl" )
				victim:StripWeapons()
				victim:Spawn() --I want the victim to spawn first then die.
				victim:Kill() --for a duration of 5 minutes. But how? With a timer? 
				PrintMessage( 3, victim:Nick() .. "'s character has been demoted by " .. ply:Nick() .. " and will now be a citizen. Wait 5 minutes to be able to respawn again." )
			end
			
			return ""
			
		end
	end )

Thanks in advance. The code is working fine. But I want the player to understand that he can’t break rules and therefore not be able to respawn yet.

use GM:PlayerDeathThink and a variable on a timer

also, 5 minutes is a really long time

Cool, thank you very much. Yes 5 minutes is veeerrryy long ^.^, but I want a serious gamemode and people to feel the pain in waiting ages to respawn.

[editline]1st June 2014[/editline]

Like so? Sorry, I feel bad for asking about everything -.-


t = timer.Create( "Demotion", 5, 1, function()
				end)
				victim:Kill(t)

[editline]1st June 2014[/editline]

Ah, I got it now.


--[[ TO-AS.: ForceTeamSur ]]--
		function GM:PlayerDeathThink( ply ) 
			local t = timer.Create( "Demotion", 300, 1, function()
			end)
		end
	hook.Add( 'PlayerSay', 'TheOpen127', function( ply, text, isteam )
	
		text = string.lower( text )
		
		if ( string.sub( text, 0, 7 ) == "!demote" ) then
			text = string.Explode( " ", text )
			local victim = TheOpenFind( text[2] )
			
			if ( IsValid( victim ) ) then
				victim:SetModel( "models/player/hostage/hostage_02.mdl" )
				victim:StripWeapons()
				victim:Spawn()
				
				victim:Kill(t)
				PrintMessage( 3, victim:Nick() .. "'s character has been demoted by " .. ply:Nick() .. " and will now be a citizen. Wait 5 minutes to be able to respawn again." )
			end
			
			return ""
			
		end
	end )

Thanks for your help!

Instead of waiting, some people will leave. Take that into account. Make a minigame for them to fool around or something :v:

[editline]2nd June 2014[/editline]

When they are dead.

I agree, if they don’t just straight up leave the server, they’ll probably just go do something else for a bit then come back and won’t feel the “Consequences of death” anyway.

Also, since it looks like you’re using it for a modified version of darkRP or some sort of RP thing, this will be something easy for a griefer to abuse. Think of what will go through their mind:

“Wow people who get killed stay dead for 5 minutes? Haha I’ll just RDM everyone and they’ll all have to wait it out, sucks for them! Then I can just spawn kill them and they’ll be fucked!”

If you think you can rely on moderation and admins to stop that, you should think again. Moderation is only a short-term solution for long-term issues.

I know what you mean ^^. Don’t worry, I have that planned.

  1. Nice idea with the minigame :slight_smile:

  2. I have a database set up, which will save the time you sat out already. (On disconnect => Saved the time you already waited and archived for connect)

  3. If you die, you spawn regularly.

  4. If you get demoted with a !demote “PlayerName” command, your character will be demoted and has not more function in the (Let’s call it survival mode) RP. E.g. You are not able to interact for some time.

  5. No way of abusing, since as I said, it’s not a demotion on death kind of thing.

  6. I’m doing this from scratch, I do not like to copy code from previous modes. (Even though I was thinking about using an updated version of fretta. But It just wouldn’t fit to the GM, since It’s not realistic at all)

  7. I was a “fan” of DarkRP when I first joined Gmod. Since there are many ways to make a GM serious (e.g. asking questions before gaining access to the server, etc.) I do prefer to stay away from any kind of RP.

For the basic knowledge of what Im currently into:

You first join, answer questions (pretty sure kids won’t be able to answer them) and verify that you have more than basic information about how to play the mode. You then create a character and choose between “Enforcer” or “Survivor” on a pretty neat and tidy Derma with live background. (You can only create ONE, giving out the ability to craft multiple characters is highly abusable) When you first join in the actualy map to play on, you eigher go to the west or east side. (Different access for different classes) You will find cars, weapons etc. on your way to the top. Who to trust whilst playing is your decision. RDM and breaking rules is not recommended => Your character will be deleted = No more ability to access the map. (Useless to come back) … As you may or may not have noticed, it’s going to be complex and It will take some time to finish off.

Please don’t get this wrong, I am not making a modified version of any RP like DarkRP. The gamemode I’m developing is more of an strategic and amusing game. The goal is to not get rich or buy the same house over and over and build weird wiremod constructions, NO, the goal is to be serious, to show respect and to fear on special situations. (If you compare fear with fearRP, you did not understand the GM)

Thank you for reading this, there is actually more to come. I need a little help, as I said, I’m new to lua. Understanding all the Hooks, functions etc. is a problem for me.

I want the player to be dead for 5 minutes after someone with access wrote this command “!demote Pakos”. This doesn’t work at all. Eigher every dead players has to wait 5 minutes or nobody. But not the demoted as only one.


--[[ TO-AS.: Demote ]]--
	hook.Add( 'PlayerSay', 'TheOpen127', function( ply, text, isteam )
	
		text = string.lower( text )
		
		if ( string.sub( text, 0, 7 ) == "!demote" ) then
			text = string.Explode( " ", text )
			local victim = TheOpenFind( text[2] )
	
				victim:SetModel( "models/player/hostage/hostage_02.mdl" )
				victim:StripWeapons()
				victim:Spawn()		
				victim:Kill()
				PrintMessage( 3, victim:Nick() .. "'s character has been demoted by " .. ply:Nick() .. " and will now be a citizen. Wait 5 minutes to be able to respawn again." )
				GM:PlayerDeathThink( ply )
				timer.Create( "Demotion", 300, 1, function()
				end )

			return ""
		
		end
	end )

Thank you for helping me out.