pickupe teleport
#1

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);
	}
Reply
#2

Hello!

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

how to add teleport via truck to the car
Reply
#4

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?
Reply
#5

When you pick a pickup during driving, you get teleported ?
Reply
#6

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!
Reply
#7

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);
    }

Reply
#8

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);

Reply
#9

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.
Reply
#10

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


Forum Jump:


Users browsing this thread: 3 Guest(s)