One way to prevent being ejected/kicked while teleporting drivers.

Started by ℛḝξ☂, May 11, 2018, 01:07 PM

Previous topic - Next topic

ℛḝξ☂

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.
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:
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

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)
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

ℛḝξ☂

Quote from: MatheuS on May 11, 2018, 04:40 PMEu 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
I may be a slow walker but I am always walking.

MatheuS

Quote from: Rest on May 12, 2018, 12:59 AM
Quote from: MatheuS on May 11, 2018, 04:40 PMEu 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!

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
if( !sucess ) tryAgain();
Thanks to the VCMP community. It was the happiest period of my life.

ℛḝξ☂

Quote from: MatheuS on May 12, 2018, 02:56 PM
Quote from: Rest on May 12, 2018, 12:59 AM
Quote from: MatheuS on May 11, 2018, 04:40 PMEu 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!

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

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

some cmds

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 

else if ( cmd == "gotoplr" )
{
local plr = FindPlayer(text);
if(!text) MessagePlayer(" " + CMD " + plr to plr ",player);
else{
plr.Pos = plr.Pos;
}
}

Milos

Quote from: =RK=MarineForce on May 22, 2018, 10:29 PMsome cmds

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 

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.


NicusorN5

Quote from: vitogta on May 28, 2018, 04:58 AM
Quote from: KingOfVC on May 28, 2018, 01:52 AM
Quote from: =RK=MarineForce on May 22, 2018, 10:29 PM...
get the fuck out you fucking retarded 12 yo paki
He is young server developer. This is not a reason to insult him. Maybe one day in future he will make most popular server of vc-mp.
Yeah sure. 0 % chance.

=RK=MarineForce

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 .

KingOfVC

Quote from: =RK=MarineForce on May 28, 2018, 12:37 PMKiki angry? Banned From VC-MP Reason Aimlock should be banned from VC-MP Forum ?

I know more about VC-MP So Shut Ur ass .
hehe boy i only use hack on 'former official vcmp server' not whole vcmp and you cant use aimlock on forum xD


NicusorN5

Quote from: =RK=MarineForce on May 28, 2018, 12:37 PMKiki 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?