SA-MP Forums Archive
pickupe 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: pickupe teleport (/showthread.php?tid=611420)



pickupe teleport - hillko - 06.07.2016

how to add in the teleport, teleport at pickupe by car

Код HTML:
	else if(pickupid == Pickups[motoex])
	{
		SetPlayerPos(playerid, 2145.2996,-1177.1656,23.8203);
	}



Re: pickupe teleport - Mencent - 06.07.2016

Hello!

Sorry, I don't know what do you mean. Can you try to explain this?


Re: pickupe teleport - hillko - 06.07.2016

how to add teleport via truck to the car


Re: pickupe teleport - Mencent - 06.07.2016

I think I understand this:
You want that when you are sitting in a car that you and your car will teleport to a position. That's right?


Re: pickupe teleport - Dayrion - 06.07.2016

When you pick a pickup during driving, you get teleported ?


Re: pickupe teleport - hillko - 06.07.2016

Quote:
Originally Posted by Mencent
Посмотреть сообщение
I think I understand this:
You want that when you are sitting in a car that you and your car will teleport to a position. That's right?
yes!


Re: pickupe teleport - Mencent - 06.07.2016

Try this.
PHP код:
else if(pickupid == Pickups[motoex])
{
    if(
IsPlayerInAnyVehicle(playerid))
    {
        new 
vehicle_id GetPlayerVehicleID(playerid);
        
SetVehiclePos(vehicleid,2145.2996,-1177.1656,23.8203);
        
PutPlayerInVehicle(playerid,vehicle_id,0);
    }
    else
    {
        
SetPlayerPos(playerid2145.2996,-1177.1656,23.8203);
    }




Re: pickupe teleport - Dayrion - 06.07.2016

It's better, no?
PHP код:
else if(pickupid == Pickups[motoex]) 

    if(!
IsPlayerInAnyVehicle(playerid)) SetPlayerPos(playerid2145.2996,-1177.1656,23.8203); 
    new 
        
vehicle_id GetPlayerVehicleID(playerid); 
    
SetVehiclePos(vehicleid,2145.2996,-1177.1656,23.8203); 
    
PutPlayerInVehicle(playerid,vehicle_id,0);




Re: pickupe teleport - Sjn - 06.07.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
It's better, no?
PHP код:
else if(pickupid == Pickups[motoex]) 

    if(!
IsPlayerInAnyVehicle(playerid)) SetPlayerPos(playerid2145.2996,-1177.1656,23.8203); 
    new 
        
vehicle_id GetPlayerVehicleID(playerid); 
    
SetVehiclePos(vehicleid,2145.2996,-1177.1656,23.8203); 
    
PutPlayerInVehicle(playerid,vehicle_id,0);

This is the same, you just swapped the position with the negative statement using ! operator and removing some brackets. This works the same anyway. People finds it better just because it reduces some lines from your code, "the less code lines the more better code" is just a theory.


Re: pickupe teleport - Stinged - 06.07.2016

Quote:
Originally Posted by Dayrion
Посмотреть сообщение
It's better, no?
PHP код:
else if(pickupid == Pickups[motoex]) 

    if(!
IsPlayerInAnyVehicle(playerid)) SetPlayerPos(playerid2145.2996,-1177.1656,23.8203); 
    new 
        
vehicle_id GetPlayerVehicleID(playerid); 
    
SetVehiclePos(vehicleid,2145.2996,-1177.1656,23.8203); 
    
PutPlayerInVehicle(playerid,vehicle_id,0);

Actually no, your code will run what's under if (!IsPlayerInAnyVehicle because you're not stopping it by returning something, while the code with if () else () don't run both if the first one is true.