Teleport With InPoly

Started by MacTavish, Mar 11, 2015, 08:33 AM

Previous topic - Next topic

MacTavish

Guys i've made an teleport system by using inpoly it works well on localhost but it seems does'nt working well on VPS donno its happening cause of pings or my code


Here is the full system

Main.nut // i am returning false when they step again InPoly, onPlayerPart, onPlayerDeath, onPlayerKill
class PlayerStats
{
frombank = false;
}

function onPlayerMove( player, lastX, lastY, lastZ, newX, newY, newZ )
{
isbank(player);
}

Here is function of isbank
function isbank(player)
{
if(InPoly(player.Pos.x, player.Pos.y, -939.308, -352.559, -939.308, -350.304, -937.33, -352.558, -937.143, -350.229 ))
{
if ( status[player.ID].frombank == true )
{
 player.Pos = Vector( -933.531, -351.39, 17.8038 ); // From bank locker
 status[player.ID].frombank = false;
 }
else
{
 player.Pos = Vector( -933.277, -351.746, 7.22692 ); // To bank locker
status[player.ID].frombank = true;
}
}
}

The problem is when i step on my InPoly ( only in vps ) then it teleports me to bank locker then its instantly again teleport me back to Where i was Mean Near of Bank Locker Lift


I wrote this topic in hurry cause my laptop bettery gonna be dead

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

rObInX

Using a Timer would be way better.

status[player.ID].frombank = false;
Remove it.

MacTavish

Quote from: rObInX on Mar 11, 2015, 10:07 AMUsing a Timer would be way better.

status[player.ID].frombank = false;
Remove it.

Now i've chage it to this
onScriptLoad()
{
NewTimer( "Check", 2000, 0 );
}

function Check()
{
 for ( local i = 0; i < GetMaxPlayers(); i++ )
 {
 local player = FindPlayer( i );
 if (player)
 {
if(InPoly(player.Pos.x, player.Pos.y, -939.308, -352.559, -939.308, -350.304, -937.33, -352.558, -937.143, -350.229 ))
{
if ( status[player.ID].frombank == true )
{
 player.Pos = Vector( -933.531, -351.39, 17.8038 ); // From bank locker
 status[player.ID].frombank = false;
 }
else
{
 player.Pos = Vector( -933.277, -351.746, 7.22692 ); // To bank locker
status[player.ID].frombank = true;
}
}
}
}

And status[player.ID].frombank = false;
Is necessary because bank lift has same poly

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

DizzasTeR

Just use a pickup for teleportation..

MacTavish

Quote from: Doom_Killer on Mar 11, 2015, 11:24 AMJust use a pickup for teleportation..

Yea but its little bit annoy, Is there any way to add this ???



it looks better than a pickup

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Sebastian

Yep, you can simulate that pink sphere, via custom objects.
(like I simulated the checkpoints in eXtreme Servers)

DizzasTeR

Quote from: sseebbyy on Mar 11, 2015, 12:50 PMYep, you can simulate that pink sphere, via custom objects.
(like I simulated the checkpoints in eXtreme Servers)

Maybe you should create a video on it, i mean i know you have one on custom objects but instead on how to add that sphere thingy using custom object..

Thijn

Quote from: Doom_Killer on Mar 11, 2015, 03:58 PM
Quote from: sseebbyy on Mar 11, 2015, 12:50 PMYep, you can simulate that pink sphere, via custom objects.
(like I simulated the checkpoints in eXtreme Servers)

Maybe you should create a video on it, i mean i know you have one on custom objects but instead on how to add that sphere thingy using custom object..
It's exactly the same, just a different object.

DizzasTeR

Quote from: Thijn on Mar 11, 2015, 05:10 PM
Quote from: Doom_Killer on Mar 11, 2015, 03:58 PM
Quote from: sseebbyy on Mar 11, 2015, 12:50 PMYep, you can simulate that pink sphere, via custom objects.
(like I simulated the checkpoints in eXtreme Servers)

Maybe you should create a video on it, i mean i know you have one on custom objects but instead on how to add that sphere thingy using custom object..
It's exactly the same, just a different object.

And to be honest i didn't understand any of those tutorials except the sprite one.

Thijn

Quote from: Doom_Killer on Mar 12, 2015, 03:44 AM
Quote from: Thijn on Mar 11, 2015, 05:10 PM
Quote from: Doom_Killer on Mar 11, 2015, 03:58 PM
Quote from: sseebbyy on Mar 11, 2015, 12:50 PMYep, you can simulate that pink sphere, via custom objects.
(like I simulated the checkpoints in eXtreme Servers)

Maybe you should create a video on it, i mean i know you have one on custom objects but instead on how to add that sphere thingy using custom object..
It's exactly the same, just a different object.

And to be honest i didn't understand any of those tutorials except the sprite one.
The tutorials are pretty clear. If you didn't understand it then there's no point in making a new one because you wont understand that one either then :P

MacTavish

Well for my own server i am using pickups but how can i set pickup.Alpha in server.conf ???

Grand Hunting Project
Join #SLC, #KAKAN, #Doom, #GHP @LUnet

Retired VC:MP Player/Scripter :P

Sebastian

Well, it would be better if you would use CreatePickup instead, but I believe there is still a chance to get the pickup instance by using FindPickup( ID )