Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: MacTavish on Mar 11, 2015, 08:33 AM

Title: Teleport With InPoly
Post by: MacTavish on Mar 11, 2015, 08:33 AM
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
Title: Re: Teleport With InPoly
Post by: rObInX on Mar 11, 2015, 10:07 AM
Using a Timer would be way better.

status[player.ID].frombank = false;
Remove it.
Title: Re: Teleport With InPoly
Post by: MacTavish on Mar 11, 2015, 10:51 AM
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
Title: Re: Teleport With InPoly
Post by: DizzasTeR on Mar 11, 2015, 11:24 AM
Just use a pickup for teleportation..
Title: Re: Teleport With InPoly
Post by: MacTavish on Mar 11, 2015, 12:41 PM
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 ???

(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi57.tinypic.com%2F20jhk6s.jpg&hash=d72fbd01a1cc979582cd96641266942c07b06b65)

it looks better than a pickup
Title: Re: Teleport With InPoly
Post by: Sebastian on Mar 11, 2015, 12:50 PM
Yep, you can simulate that pink sphere, via custom objects.
(like I simulated the checkpoints in eXtreme Servers)
Title: Re: Teleport With InPoly
Post by: DizzasTeR 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..
Title: Re: Teleport With InPoly
Post by: 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.
Title: Re: Teleport With InPoly
Post by: DizzasTeR 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.
Title: Re: Teleport With InPoly
Post by: Thijn on Mar 12, 2015, 06:49 AM
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
Title: Re: Teleport With InPoly
Post by: MacTavish on Mar 12, 2015, 06:56 AM
Well for my own server i am using pickups but how can i set pickup.Alpha in server.conf ???
Title: Re: Teleport With InPoly
Post by: Sebastian on Mar 12, 2015, 12:12 PM
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 )