why? - 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: why? (
/showthread.php?tid=372094)
why? -
Windrush - 25.08.2012
How to tele the cars example
im in the car if i tele the car will never tele
I want my car tele
Re: why? -
clarencecuzz - 25.08.2012
wiki.sa-mp.com/wiki/SetVehiclePos
Example:
pawn Код:
if(strcmp(cmdtext, "/myteleport", true) == 0)
{
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER) //They are driving a vehicle
{
SetVehiclePos(GetPlayerVehicleID(playerid), X, Y, Z);
}
else //They are on-foot or a passenger
{
SetPlayerPos(playerid, X, Y, Z);
}
return 1;
}
Re: why? -
lamarr007 - 25.08.2012
Use my function:
pawn Код:
stock TeleportPlayerTo(playerid, interior, Float:x, Float:y, Float:z, Float:angle)
{
SetPlayerInterior(playerid, interior);
if(IsPlayerInAnyVehicle(playerid)){
new vehicle = GetPlayerVehicleID(playerid);
SetVehicleVirtualWorld(vehicle, vworld);
LinkVehicleToInterior(vehicle, interior);
SetVehiclePos(vehicle, x, y, z);
SetVehicleZAngle(vehicle, angle);
SetCameraBehindPlayer(playerid);}else{
SetPlayerPos(playerid, x, y, z);
SetPlayerFacingAngle(playerid, angle);
SetCameraBehindPlayer(playerid);}
}
Re: why? -
clarencecuzz - 25.08.2012
Quote:
Originally Posted by lamarr007
Use my function:
pawn Код:
stock TeleportPlayerTo(playerid, interior, Float:x, Float:y, Float:z, Float:angle) { SetPlayerInterior(playerid, interior); if(IsPlayerInAnyVehicle(playerid)){ new vehicle = GetPlayerVehicleID(playerid); SetVehicleVirtualWorld(vehicle, vworld); LinkVehicleToInterior(vehicle, interior); SetVehiclePos(vehicle, x, y, z); SetVehicleZAngle(vehicle, angle); SetCameraBehindPlayer(playerid);}else{ SetPlayerPos(playerid, x, y, z); SetPlayerFacingAngle(playerid, angle); SetCameraBehindPlayer(playerid);} }
|
Wrong.
if(IsPlayerInAnyVehicle(playerid)) would still detect passengers as well. So if they are driving along with somebody and decide to teleport, the driver of the vehicle will be teleported with them... not very convenient.
Re: why? -
lamarr007 - 25.08.2012
Hm, if you driving with friend and want to teleport to anywhere with him.. I think itґs not wrong