Teleporting with the vehicle. - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Teleporting with the vehicle. (
/showthread.php?tid=257056)
Teleporting with the vehicle. -
GangsTa_ - 23.05.2011
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.
Re: Teleporting with the vehicle. -
Seven_of_Nine - 23.05.2011
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
Re: Teleporting with the vehicle. -
Sascha - 23.05.2011
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^^
Re: Teleporting with the vehicle. -
GangsTa_ - 24.05.2011
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.");
}
Re: Teleporting with the vehicle. -
GangsTa_ - 24.05.2011
Fuck u forgot to tell me to add another braket on if(IsPlayerInAnyVehicle(playerid) lol.