SA-MP Forums Archive
Teleport with vehicle HELP - 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)
+--- Thread: Teleport with vehicle HELP (/showthread.php?tid=370964)



Teleport with vehicle HELP - necrobg3 - 21.08.2012

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.


Re: Teleport with vehicle HELP - =WoR=G4M3Ov3r - 21.08.2012

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



Re: Teleport with vehicle HELP - necrobg3 - 21.08.2012

+REP for you.


Re: Teleport with vehicle HELP - =WoR=G4M3Ov3r - 21.08.2012

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


Re: Teleport with vehicle HELP - necrobg3 - 21.08.2012

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?


Re: Teleport with vehicle HELP - =WoR=G4M3Ov3r - 21.08.2012

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 ?


Re: Teleport with vehicle HELP - necrobg3 - 22.08.2012

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


Re: Teleport with vehicle HELP - =WoR=G4M3Ov3r - 22.08.2012

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 ?


Re: Teleport with vehicle HELP - MarinacMrcina - 22.08.2012

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



Re: Teleport with vehicle HELP - =WoR=G4M3Ov3r - 22.08.2012

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.