[HELP] Teleports cmd help plz [please]
#1

i was sitting on vehicle as a passenger and when i type /lvair so i teleported there with the bike and my friend also teleport there, he was driving.

Here are the codes:

PHP код:
CMD:lvair(playeridparams[])
{
    new 
idFloat:X,Float:Y,Float:Z;
    new 
Interior GetPlayerInterior(id);
    if(
IsPlayerInAnyVehicle(playerid))
    {
        
SetVehiclePos(GetPlayerVehicleID(playerid), 1509.1740,1811.2737,10.3846);
        
LinkVehicleToInterior(GetPlayerVehicleID(playerid),Interior);
    }
    else 
SetPlayerPos(playerid1537.9845,1839.4662,10.9263);
    return 
1;

Reply
#2

Quote:
Originally Posted by NGEN123
Посмотреть сообщение
i was sitting on vehicle as a passenger and when i type /lvair so i teleported there with the bike and my friend also teleport there, he was driving.

Here are the codes:

PHP код:
CMD:lvair(playeridparams[])
{
    new 
idFloat:X,Float:Y,Float:Z;
    new 
Interior GetPlayerInterior(id);
    if(
IsPlayerInAnyVehicle(playerid))
    {
        
SetVehiclePos(GetPlayerVehicleID(playerid), 1509.1740,1811.2737,10.3846);
        
LinkVehicleToInterior(GetPlayerVehicleID(playerid),Interior);
    }
    else 
SetPlayerPos(playerid1537.9845,1839.4662,10.9263);
    return 
1;

I can't understand what is your problem
Reply
#3

i mean, i was sitting in car besides the driver seat .. and when i type /lvair so the car also teleported there .. instead of getting on foot. now understand (
Reply
#4

Quote:
Originally Posted by NGEN123
Посмотреть сообщение
i mean, i was sitting in car besides the driver seat .. and when i type /lvair so the car also teleported there .. instead of getting on foot. now understand (
You must be sitting as driver to teleport your car to /lvair. Not when you are sitting as passenger.
Reply
#5

lol .. imagine i'm sitting with my friend in car as passenger and i want to tele there so how can i evade driver to don't tele there ..

like this
PHP код:
    if(is_driver(playerid)) 
is there is any code like:

PHP код:
    if(is_passenger(playerid)) 
Reply
#6

pawn Код:
CMD:lvair(playerid, params[])
{
    new id, Float:X,Float:Y,Float:Z;
    new veh = GetPlayerVehicleID(playerid);
    new Interior = GetPlayerInterior(id);
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehiclePos(veh, 1509.1740,1811.2737,10.3846);
        LinkVehicleToInterior(veh,Interior);
        PutPlayerInVehicle(playerid, veh, 0);
    }
    SetPlayerPos(playerid, 1537.9845,1839.4662,10.9263);
    return 1;
}
EDIT: he wants to put the player inside the vehicle when teleported. I think...
Reply
#7

pawn Код:
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
        new Float:X, Float:Y, Float:Z;
        GetPlayerPos(clickedplayerid, X, Y, Z);
        if (IsPlayerInAnyVehicle(playerid)) SetVehiclePos(GetPlayerVehicleID(playerid), X+5, Y+5, Z);
        else SetPlayerPos(playerid, X+1, Y+1, Z);
        return 1;
}
Note:
Код:
When teleporting to someone, check if the other player is in a car.
If they are, check if there are any passenger seats available.
If there are, teleport to their car as a passenger.
Otherwise just teleport normally.
More iNfO:
CLICK HERE
Reply
#8

;(((((

another example

PHP код:
new State GetPlayerState(playerid);
if (
IsPlayerInAnyVehicle(playerid) && State == PLAYER_STATE_PASSENGER
How can i add these code in my teleport cmd .. which is given above
Reply
#9

Quote:
Originally Posted by IamPRO
Посмотреть сообщение
pawn Код:
CMD:lvair(playerid, params[])
{
    new id, Float:X,Float:Y,Float:Z;
    new veh = GetPlayerVehicleID(playerid);
    new Interior = GetPlayerInterior(id);
    if(IsPlayerInAnyVehicle(playerid))
    {
        SetVehiclePos(veh, 1509.1740,1811.2737,10.3846);
        LinkVehicleToInterior(veh,Interior);
        PutPlayerInVehicle(playerid, veh, 0);
    }
    SetPlayerPos(playerid, 1537.9845,1839.4662,10.9263);
    return 1;
}
EDIT: he wants to put the player inside the vehicle when teleported. I think...
No No No
Reply
#10

pawn Код:
CMD:lvair(playerid, params[])
{
    new id, Float:X,Float:Y,Float:Z;
    new veh = GetPlayerVehicleID(playerid);
    new Interior = GetPlayerInterior(id);
    if(IsPlayerInAnyVehicle(playerid) && GetPlayerVehicleSeat(playerid) != 0) //passenger
    {
        SetVehiclePos(veh, 1509.1740,1811.2737,10.3846);
        LinkVehicleToInterior(veh,Interior);
        PutPlayerInVehicle(playerid, veh, 0);
    }
    SetPlayerPos(playerid, 1537.9845,1839.4662,10.9263);
    return 1;
}
Use GetPlayerVehicleSeat(playerid); more info here: https://sampwiki.blast.hk/wiki/GetPlayerVehicleSeat
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)