Teleport with vehicle HELP
#1

Hey guys. I was wondering how to make my teleport command to teleport the player with the car and to set the camera behind the player? Here is the command.

pawn Код:
if (strcmp("/ls", cmdtext, true, 10) == 0)
    {
    SetPlayerPos(playerid, 2459.2891,-1658.8856,12.9641);
    SetPlayerFacingAngle(playerid, 89.6031);
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, 280, "%s has been teleported to Los Santos. (/ls)", pname);
    SendClientMessageToAll(COLOR_KNIGHTBLUE, string);
    return 1;
    }
+REP for the dude who help me.
Reply
#2

PHP код:
if (strcmp("/ls"cmdtexttrue10) == 0)
    {
    new 
veh;
    
veh=GetPlayerVehicleID(playerid);
    
SetPlayerPos(playerid2459.2891,-1658.8856,12.9641);
    
SetVehiclePos(veh2459.2891,-1658.8856,12.9641);
    
SetPlayerFacingAngle(playerid89.6031);
    new 
pname[MAX_PLAYER_NAME], string[39 MAX_PLAYER_NAME];
    
GetPlayerName(playeridpnamesizeof(pname));
    
format(string280"%s has been teleported to Los Santos. (/ls)"pname);
    
SendClientMessageToAll(COLOR_KNIGHTBLUEstring);
    return 
1;
    } 
Reply
#3

+REP for you.
Reply
#4

Quote:
Originally Posted by necrobg3
Посмотреть сообщение
+REP for you.
Nvm, edited your quote.
Reply
#5

There are some problems. When i teleport the vehicle get spawned under the player, i mean not in vehicle it needs something like PutPlayerInVehicle. The other problem is the facing angle and the camera look. The facing angle of the car gets randomly, i don't know why becouse i've got SetPlayerFacingAngle. Please can you fix this?
Reply
#6

PHP код:
if (strcmp("/ls"cmdtexttrue10) == 0
    { 
    new 
veh
    
veh=GetPlayerVehicleID(playerid); 
    
SetPlayerPos(playerid2459.2891,-1658.8856,12.9641); 
    
SetVehiclePos(veh2459.2891,-1658.8856,12.9641);
    
PutPlayerInVehicle(playeridveh0);
    
SetPlayerFacingAngle(playerid0); 
    new 
pname[MAX_PLAYER_NAME], string[39 MAX_PLAYER_NAME]; 
    
GetPlayerName(playeridpnamesizeof(pname)); 
    
format(string280"%s has been teleported to Los Santos. (/ls)"pname); 
    
SendClientMessageToAll(COLOR_KNIGHTBLUEstring); 
    return 
1
    } 
When used, the player is Teleported along with the vehicle, Facing angel north.

I guess this is what you needed ?
Reply
#7

Now when i teleport im in, but i want the facing angle of the car to be same like the player facing angle.
Reply
#8

PHP код:
if (strcmp("/ls"cmdtexttrue10) == 0
    { 
    new 
veh
    
veh=GetPlayerVehicleID(playerid); 
    
SetPlayerPos(playerid2459.2891,-1658.8856,12.9641); 
    
SetVehiclePos(veh2459.2891,-1658.8856,12.9641);
    
PutPlayerInVehicle(playeridveh0);
    
SetPlayerFacingAngle(playerid89.6031);
    
SetVehicleZAngle(veh89.6031);
    new 
pname[MAX_PLAYER_NAME], string[39 MAX_PLAYER_NAME]; 
    
GetPlayerName(playeridpnamesizeof(pname)); 
    
format(string280"%s has been teleported to Los Santos. (/ls)"pname); 
    
SendClientMessageToAll(COLOR_KNIGHTBLUEstring); 
    return 
1
    } 
Something like this ?
Reply
#9

Quote:
Originally Posted by =WoR=G4M3Ov3r
Посмотреть сообщение
PHP код:
if (strcmp("/ls"cmdtexttrue10) == 0
    { 
    new 
veh
    
veh=GetPlayerVehicleID(playerid); 
    
SetPlayerPos(playerid2459.2891,-1658.8856,12.9641); 
    
SetVehiclePos(veh2459.2891,-1658.8856,12.9641);
    
PutPlayerInVehicle(playeridveh0);
    
SetPlayerFacingAngle(playerid89.6031);
    
SetVehicleZAngle(veh89.6031);
    new 
pname[MAX_PLAYER_NAME], string[39 MAX_PLAYER_NAME]; 
    
GetPlayerName(playeridpnamesizeof(pname)); 
    
format(string280"%s has been teleported to Los Santos. (/ls)"pname); 
    
SendClientMessageToAll(COLOR_KNIGHTBLUEstring); 
    return 
1
    } 
Something like this ?
More like this:
pawn Код:
if (strcmp("/ls", cmdtext, true, 10) == 0)
 {
    new veh;
    new Float:angle;
    veh=GetPlayerVehicleID(playerid);
    GetPlayerFacingAngle(playerid,angle);
    SetPlayerPos(playerid, 2459.2891,-1658.8856,12.9641);
    SetVehiclePos(veh, 2459.2891,-1658.8856,12.9641);
    PutPlayerInVehicle(playerid, veh, 0);
    SetPlayerFacingAngle(playerid, angle);
    SetVehicleZAngle(veh, angle);
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, 280, "%s has been teleported to Los Santos. (/ls)", pname);
    SendClientMessageToAll(-1, string);
    return 1;
}
Reply
#10

Quote:
Originally Posted by MarinacMrcina
Посмотреть сообщение
More like this:
pawn Код:
if (strcmp("/ls", cmdtext, true, 10) == 0)
 {
    new veh;
    new Float:angle;
    veh=GetPlayerVehicleID(playerid);
    GetPlayerFacingAngle(playerid,angle);
    SetPlayerPos(playerid, 2459.2891,-1658.8856,12.9641);
    SetVehiclePos(veh, 2459.2891,-1658.8856,12.9641);
    PutPlayerInVehicle(playerid, veh, 0);
    SetPlayerFacingAngle(playerid, angle);
    SetVehicleZAngle(veh, angle);
    new pname[MAX_PLAYER_NAME], string[39 + MAX_PLAYER_NAME];
    GetPlayerName(playerid, pname, sizeof(pname));
    format(string, 280, "%s has been teleported to Los Santos. (/ls)", pname);
    SendClientMessageToAll(-1, string);
    return 1;
}
Really ? so you assume 89.6031 is a string ? Its a float, they both work the same way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)