One way to prevent being ejected/kicked while teleporting drivers.
[SNIPPET] BanInfo Command. »

ℛḝξ☂

  • Jr. Member
  • Posts: 97
One way to prevent being ejected/kicked while teleporting drivers.
« on May 11th, 2018, 02:07 PM »Last edited on June 16th, 2018, 04:30 PM
About some months ago, some people including me were working on a new server called Rob The Vehicles, at the beginning there's a very terrible bug that whenever server teleported players in vehicles, it ejects players in vehicles or sometimes the drivers are even kicked, we were confused about this, soon it was SahiL who came up with this idea and our server is now using this function to teleport players, no matter you're in vehicles or not, you can teleport to the place. Now I'm going to share the codes with you.

1 -> Place a vehicle at a place where nobody could be able to enter it, this vehicle is only used to "eject" players, remember you have got ID of the vehicle.

2 -> Paste the following function in your script, remember that you have to change the ID_OF_THE_SPECIAL_VEHICLE to the ID you created.
Code: [Select]
function Teleport( player, posx, posy, posz )
{
    if ( player.IsSpawned )
    {
        if ( player.Vehicle ) player.Vehicle = FindVehicle( ID_OF_THE_SPECIAL_VEHICLE );
        player.Pos = Vector( posx, posy, posz );
    }
}

3 -> Use this function above whenever you need to teleport players, here is a drowning function:
Code: [Select]
function Drown( player, reason )
{
        Message( "Admin server drowned [ " + player.Name + " ] reason:[ " + reason + " ]." );
Teleport( player, -376.6, 47.8846, 10.7041 ); //teleporting the player
}

I may be a slow walker but I am always walking.

MatheuS

  • Wiki Contributor
  • LBR | Co-Leader & Brasil Real RPG | Developer
  • Posts: 470
Re: One way to prevent being ejected/kicked while teleporting drivers.
« Reply #1, on May 11th, 2018, 05:40 PM »Last edited on May 12th, 2018, 04:00 PM
Code: [Select]
function Teleport( player, posx, posy, posz )
{
    if ( player.IsSpawned )
    {
        if ( player.Vehicle ) player.Vehicle.Pos = Vector( posx, posy, posz );
        else {
                   player.Pos = Vector( posx, posy, posz );
        }
    }
}

(Edited)
Code: [Select]
if( !sucess ) tryAgain();

ℛḝξ☂

  • Jr. Member
  • Posts: 97
I may be a slow walker but I am always walking.

MatheuS

  • Wiki Contributor
  • LBR | Co-Leader & Brasil Real RPG | Developer
  • Posts: 470
Re: One way to prevent being ejected/kicked while teleporting drivers.
« Reply #3, on May 12th, 2018, 03:56 PM »Last edited on May 12th, 2018, 03:59 PM
Quote from Rest on May 12th, 2018, 01:59 AM
Quote from MatheuS on May 11th, 2018, 05:40 PM
Eu não entendi direito o que você quis dizer, mas é algo como isso: ???
Please keep it in English, I couldn't understand what you said without translator.

This is one way, but the vehicles are tped, too
Ops, sorry!

Code: [Select]
function Teleport( player, posx, posy, posz )
{
    if ( player.IsSpawned )
    {
        if ( player.Vehicle ) player.Pos = player.Pos, player.Pos = Vector( posx, posy, posz );
        else {
                   player.Pos = Vector( posx, posy, posz );
        }
    }
}

I've tested and works fine for me
Code: [Select]
if( !sucess ) tryAgain();

ℛḝξ☂

  • Jr. Member
  • Posts: 97
Re: One way to prevent being ejected/kicked while teleporting drivers.
« Reply #4, on May 13th, 2018, 05:09 AM »
Quote from MatheuS on May 12th, 2018, 03:56 PM
Quote from Rest on May 12th, 2018, 01:59 AM
Quote from MatheuS on May 11th, 2018, 05:40 PM
Eu não entendi direito o que você quis dizer, mas é algo como isso: ???
Please keep it in English, I couldn't understand what you said without translator.

This is one way, but the vehicles are tped, too
Ops, sorry!

Code: [Select]
function Teleport( player, posx, posy, posz )
{
    if ( player.IsSpawned )
    {
        if ( player.Vehicle ) player.Pos = player.Pos, player.Pos = Vector( posx, posy, posz );
        else {
                   player.Pos = Vector( posx, posy, posz );
        }
    }
}

I've tested and works fine for me
I tried this way from the very beginning since I faced this problem, but it doesn't work, just now I've tested on my server again, it did not work perfectly, still..
I may be a slow walker but I am always walking.

SahiL

  • Newbie
  • Posts: 7
Re: One way to prevent being ejected/kicked while teleporting drivers.
« Reply #5, on May 18th, 2018, 08:33 PM »
Code: [Select]
function Teleport( player, posx, posy, posz )
{
    if ( player.IsSpawned )
    {
        if ( player.Vehicle ) player.Vehicle = FindVehicle( ID_OF_THE_SPECIAL_VEHICLE ), player.Pos = Vector( posx, posy, posz );
        else {
                   player.Pos = Vector( posx, posy, posz );
        }
    }
}
As far as I remember this should work fine, have fun.

=RK=MarineForce

  • Sr. Member
  • WAR IS HELL!
  • Posts: 462
Re: One way to prevent being ejected/kicked while teleporting drivers.
« Reply #6, on May 22nd, 2018, 11:29 PM »Last edited on May 23rd, 2018, 12:07 AM
some cmds

Code: [Select]
else if ( cmd == "goto" )
{
if(player.Health == < 50 ) MessagePlayer(" Erorr Your HP Must be Gr8ter Than 50 For goto ",player);
if(player.In.Vehicle == true ) MessagePlayer(" You cannot Goto when u in vehicle ",player); /// i think some bugs in this
if(!text) MessagePlayer(" " + cmd + " Plr ",player);
local plr = FindPlayer(text);
else{
plr.Pos = player.Pos;
MessagePlayer(" " + player.Name + " Teleporting up to " + plr.Name + " ",player);
MessagePlayer("  " + player.Name + " Teleporting To You ",plr);
Message(" " + player.Name + " Sucess TelePort TO " + plr + " );
}
}
Untested some more bugs i think 

Code: [Select]
else if ( cmd == "gotoplr" )
{
local plr = FindPlayer(text);
if(!text) MessagePlayer(" " + CMD " + plr to plr ",player);
else{
plr.Pos = plr.Pos;
}
}
Try to UnderStand ME!

Milos

  • Jr. Member
  • Posts: 83
Re: One way to prevent being ejected/kicked while teleporting drivers.
« Reply #7, on May 27th, 2018, 08:31 PM »
Quote from =RK=MarineForce on May 22nd, 2018, 11:29 PM
some cmds

Code: [Select]
else if ( cmd == "goto" )
{
if(player.Health == < 50 ) MessagePlayer(" Erorr Your HP Must be Gr8ter Than 50 For goto ",player);
if(player.In.Vehicle == true ) MessagePlayer(" You cannot Goto when u in vehicle ",player); /// i think some bugs in this
if(!text) MessagePlayer(" " + cmd + " Plr ",player);
local plr = FindPlayer(text);
else{
plr.Pos = player.Pos;
MessagePlayer(" " + player.Name + " Teleporting up to " + plr.Name + " ",player);
MessagePlayer("  " + player.Name + " Teleporting To You ",plr);
Message(" " + player.Name + " Sucess TelePort TO " + plr + " );
}
}
Untested some more bugs i think 

Code: [Select]
else if ( cmd == "gotoplr" )
{
local plr = FindPlayer(text);
if(!text) MessagePlayer(" " + CMD " + plr to plr ",player);
else{
plr.Pos = plr.Pos;
}
}
Where do you find these crap?
Everyone posting good proposals and you show up with this $hit.
People come in search of good scripting ways. Just one line of this so my server f*cks.

KingOfVC

  • Full Member
  • Posts: 109
[13:51] <&RastySpoon> [10] =RKr=HearTz_Hz: MOL and gre and for noobs like imkiki

Athanatos

  • Hero Member
  • F = d(mv)/dx
  • Posts: 969

=RK=MarineForce

  • Sr. Member
  • WAR IS HELL!
  • Posts: 462
Try to UnderStand ME!

KingOfVC

  • Full Member
  • Posts: 109
[13:51] <&RastySpoon> [10] =RKr=HearTz_Hz: MOL and gre and for noobs like imkiki

=RK=MarineForce

  • Sr. Member
  • WAR IS HELL!
  • Posts: 462
Try to UnderStand ME!

Athanatos

  • Hero Member
  • F = d(mv)/dx
  • Posts: 969
Re: One way to prevent being ejected/kicked while teleporting drivers.
« Reply #13, on May 29th, 2018, 06:57 PM »Last edited on May 29th, 2018, 07:00 PM
Quote from =RK=MarineForce on May 28th, 2018, 01:37 PM
Kiki angry? Banned From VC-MP Reason Aimlock should be banned from VC-MP Forum ?

I know more about VC-MP So Shut Ur ass .
Nice grammar here. Please stop posting nonsense.

I'm sure that I have more programming knowledge than you, I don't see a reason to rage.

All grammar and typing mistakes are marked with bold.

Thanks to users like you that post random bullshit, I'll spam some more useless posts, because why not?