SA-MP Forums Archive
Internal to External Teleport - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Internal to External Teleport (/showthread.php?tid=647366)



Internal to External Teleport - spyro9696 - 04.01.2018

Hello, I've this problem with my teleports: when I'm in an interior and I type a command to go in an external place, for example Los Santos, everything appears white, as if I am always in the world of the interior.

This is my teleport to Los Santos, what should I add in order to teleport correctly a player from an interior to the outside?

PHP код:
COMMAND:ls(playeridparams[])
{
     if(
IsPlayerInAnyVehicle(playerid))
     {
          new 
vehid=GetPlayerVehicleID(playerid);
          
SetPlayerPos(playerid,2489.4968, -1672.578913.3792);
          
SetVehiclePos(vehid2489.4968, -1672.578913.3792);
          
PutPlayerInVehicle(playerid,vehid,0);
     } else
     
SetPlayerPos(playerid2489.4968, -1672.578913.3792);
     
// Do something
     
return 1;




Re: Internal to External Teleport - JaKe Elite - 04.01.2018

PHP код:
COMMAND:ls(playeridparams[]) 

    if(
IsPlayerInAnyVehicle(playerid)) 
    { 
        new 
vehid=GetPlayerVehicleID(playerid); 
        
SetPlayerInterior(playerid0); // set interor to 0
        
LinkVehicleToInterior(vehidGetPlayerInterior(playerid)); // do the same to the vehicle that he is currently riding in
        
SetVehiclePos(vehid2489.4968, -1672.578913.3792); 
    } 
    else 
    {
        
SetPlayerInterior(playerid0); // set interior to 0
        
SetPlayerPos(playerid2489.4968, -1672.578913.3792); 
    }
    return 
1




Re: Internal to External Teleport - spyro9696 - 04.01.2018

congratulations, it works !!


Re: Internal to External Teleport - spyro9696 - 04.01.2018

There is a little problem: if I am in an interior with a vehicle and I teleport myself to outside, there is the same problem, everything appears white and my vehicle becomes invisible.
Is this problem resolvable?


Re: Internal to External Teleport - JaKe Elite - 04.01.2018

Are you using the same command when teleporting outside? It should work


Re: Internal to External Teleport - spyro9696 - 04.01.2018

Yes, the same command...


Re: Internal to External Teleport - JesterlJoker - 04.01.2018

PHP код:
COMMAND:ls(playeridparams[]) 

    if(
IsPlayerInAnyVehicle(playerid)) 
    { 
        new 
vehid=GetPlayerVehicleID(playerid);
        
SetPlayerPos(playerid2489.4968, -1672.578913.3792); //Teleport player first
        
SetPlayerInterior(playerid0); // Set Players Interior After it's a given coz sometimes a bug happens when you set the players interior without setting position
        
SetPlayerVirtualWorld(playerid0); // Now finally teleport your player on virtual world 0 so that you will be in 
        
SetVehiclePos(vehid2489.4968, -1672.5789+0.313.3792); // Now set vehicle position to the same place as the player. I added 0.3 so that the vehicle would not fall on the player which will damage the player even if it was just a nanosecond difference
        
LinkVehicleToInterior(vehid0); // Just like how the player should be teleported first before going into the interior
        
SetVehicleVirtualWorld(vehid0); // Place vehicle to San Andreas Map
        
PutPlayerInVehicle(playeridvehid0); // Puts player into the vehicle
    

    else 
    {
        
SetPlayerPos(playerid2489.4968, -1672.578913.3792);  // Like what is said above player teleport before interior teleport its just to make sure it does work, well without a vehicle it works either way but it kinda became part of my coding
        
SetPlayerInterior(playerid0); // Now finally teleport to interior so that the player will appear there.
        
SetPlayerVirtualWorld(playerid0); // Now finally teleport your player on virtual world 0 so that you will be in the San Andreas map
    
}
    return 
1

I'm using this though I have a shorter one that works but its better to show this so that you can understand why it works and why it doesnt

AHh yeah one final thing make sure your virtual world is 0, example you might have entered an interior with a virtual world that is not 0 like some house system that uses +100/ or an incremental number so that they won't match so make sure when you exit you make sure it is 0... since the virtual world of San Andreas map is 0


Re: Internal to External Teleport - spyro9696 - 04.01.2018

Ah no sorry, it works also with vehicle, but the only problem is that when I teleport myself from an interior to esterior, the vehicle becomes invisible.


Re: Internal to External Teleport - JesterlJoker - 04.01.2018

reread it I forgot to add some things. It might be the problem


Re: Internal to External Teleport - spyro9696 - 04.01.2018

Perfect, it works. Thanks.