Page 1 of 1

tele help for cod4

Posted: May 28th, 2010, 6:58 pm
by Mox09
Hey guys i got this code from my friend xeno. he made it for his cod1 mod. what it does is when player finds the tele it warps me to part on the map but in my case for cod4 when u spawn it keeps u at this location (-185, -56, 467) and u can't move from that spot and it keeps killing me. can someone help me make it so the player spawns at reg spawn point in the map and then if he walks to this (-185, -56, 4679) he gets warped to (-733, 753, 232) on the map.

Code: Select all

shipment_tele()//teleporter in shipment
{   
   if (getdvar("mapname") == "mp_shipment")
   {
      while(1)
      {
         players = getentarray("player", "classname");
         for(i = 0; i < players.size; i++)
         	players[i] thread teleChecker2();
         wait 0.05;
      }
   }
}

teleChecker2()
{
   if(distance(self.origin,(-185, -56, 467)))
   {
      self setorigin((-733, 753, 232));
   }
}

Re: tele help for cod4

Posted: May 28th, 2010, 8:05 pm
by Drofder2004
Mox09 wrote:

Code: Select all

teleChecker2()
{
   if(distance(self.origin,(-185, -56, 467))) //WRONG
   {
      self setorigin((-733, 753, 232));
   }
}
You need to do:

Code: Select all

if(distance(self.origin,(-185, -56, 467)) < 25)