Making a teleport in Carentan
Posted: May 25th, 2010, 7:41 pm
Hey, I am trying to make a teleporter in carentan. I tried using the distance command to check for the players origin and if they are within like 5 feet and press f they will be teleported but for some reason it doesn't work. Maybe I got the coordinates wrong... but dunno. I used the command /viewpos while in call of duty to get the coordinates of where my players was standing.
Here is my code:
Here is my code:
Code: Select all
s_tele3()//teleporter in carentan
{
self endon("boot");
setcvar("s_tele3", "");
while(1)
{
if(getcvar("s_tele3") != "")
{
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
if (getcvar("mapname") == "mp_carentan")
{
iprintln("Map is Carentan");//Check 1
players[i].useheld = .2;
if(((distance(players[i].origin,(247, 1111, 68))) < 25))
{
iprintlnBold("Check Origin");//Check 2
if(players[i] useButtonPressed() == true)
{
iprintlnBold("Check Use Key");//Check 3
if (players[i].useheld == 0.2)
{
iprintlnBold("Check Use Key Held");//Check 4
players[i] setorigin((366, 1254, 684));
iprintlnBold("Teleported and Check Complete");//Check 5
}
}
}
}
else
{
iprintlnBold("Wrong map");
}
}
setcvar("s_tele3", "");
}
wait 0.05;
}
}