Teleporting with the vehicle.
#1

Hello.
I'm using a function which teleports you when you type /enter, but how to teleport you with the car which you're in?
When I'm doing /enter, I just get teleported without the car, and the car remains at the old position, but I want to teleport and to remain in the car. Help please.
Reply
#2

pawn Код:
if(IsPlayerInAnyVehicle(playerid) {
    new veh = GetPlayerVehicleID(playerid);
    SetVehiclePos(veh,X,Y,Z); //Teleport location
    switch(GetPlayerState(playerid)) {
        case 2: PutPlayerInVehicle(playerid,veh,0);
        case 3: PutPlayerInVehicle(playerid,veh,1);
    }
}
EDIT: Hah? :P
Reply
#3

you don't even need the "PutPlayerInVehicle" (which would bug anyways if you are passenger)
just leave that line out and you'll be fine^^
Reply
#4

Look, here's my code, but I get an error, unexpected tooken something due to one bracket down than if(IsPlayerInAnyVehicle)

pawn Код:
else if (PlayerToPoint(5.0, playerid, 135.2309,1949.3778,19.3824)) // hfp gate
{
               if(PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3)
               {
                           if(IsPlayerInAnyVehicle(playerid)
                           {
                               new veh = GetPlayerVehicleID(playerid);
                           SetVehiclePos(veh,135.2043,1934.6794,19.2593);
                   }
                   else
                   {
                       SetPlayerPos(playerid, 135.2043,1934.6794,19.2593);
                   }
              }
              else return SendClientMessage(playerid, COLOR_GREY, "No access.");
}
Reply
#5

Fuck u forgot to tell me to add another braket on if(IsPlayerInAnyVehicle(playerid) lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)