• Print

Author Topic: Teleport to original spawn  (Read 4298 times)

0 Members and 1 Guest are viewing this topic.

Offline frustratedgamers

  • Newbie
  • *
  • Posts: 36
  • Karma: -1
Teleport to original spawn
« on: February 03, 2014, 04:53:03 pm »
Is it possible to make a command that would allow a player to teleport to an original spawn point?
Also if it could be limited to 1 time use that would be great as well.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: Teleport to original spawn
« Reply #1 on: February 03, 2014, 05:58:51 pm »
Check out my !unstuck command for my gamemode. Some things would need to be changed to work with yours, but you should get the general idea.

Code: Lua
  1. function SGS_UnStick(ply, _, args)
  2.         if CurTime() < ( ply.nextunstuck or 0 ) then
  3.                 if math.floor((ply.nextunstuck - CurTime()) / 60) > 0 then
  4.                         ply:SendMessage("You must wait " .. math.floor((ply.nextunstuck - CurTime()) / 60) .. " more minutes.", 60, Color(255, 0, 0, 255))
  5.                 else
  6.                         ply:SendMessage("You must wait " .. math.floor( ply.nextunstuck - CurTime() ) .. " more seconds.", 60, Color(255, 0, 0, 255))
  7.                 end
  8.                 return
  9.         end
  10.        
  11.         local spawnarea = ents.FindByClass( "info_player_start" )
  12.         local random_entry = math.random(#spawnarea)
  13.         local newpos = spawnarea[random_entry]:GetPos()
  14.        
  15.         ply:SetPos(newpos)
  16.         ply.nextunstuck = CurTime() + 300
  17.         ply:SendMessage("You have been returned to the spawn area.", 60, Color(255, 255, 128, 255))
  18. end
  19. concommand.Add( "sgs_unstuck", SGS_UnStick )
  20.  

Offline frustratedgamers

  • Newbie
  • *
  • Posts: 36
  • Karma: -1
Re: Teleport to original spawn
« Reply #2 on: February 03, 2014, 09:27:45 pm »
nice! thank you for that, I'll see what I can do :D

  • Print