[Help] Teleporting issues. - 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: [Help] Teleporting issues. (
/showthread.php?tid=433581)
[Help] Teleporting issues. -
xXRealLegitXx - 27.04.2013
I need this command:
Код:
CMD:tp(playerid, params[])
{
new targetid;
new target[MAX_PLAYER_NAME];
new Float:x, Float:y, Float:z;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /tp [id]");
GetPlayerName(targetid, target, sizeof(target));
GetPlayerPos(targetid, x, y, z);
if(IsPlayerInAnyVehicle(playerid))
{
new getvehicle = GetPlayerVehicleID(playerid);
SetVehiclePos(getvehicle, x, y + 5, z);
}
else
{
SetPlayerPos(playerid, x, y, z);
}
SendClientMessage(targetid, COLOR_WHITE, "An admin teleported to you.");
return 1;
}
to get the targets interior, and set the players interior.
So say someone is in burger shot.
I teleport to them using /tp. I should be put in that interior. How do I do this?
Re: [Help] Teleporting issues. -
RVRP - 27.04.2013
Use the function SetPlayerInterior to change a player's interior. If you want the targetid to have the same interior as the person using the command, add the following to the command.
pawn Код:
SetPlayerInterior(targetid, GetPlayerInterior(playerid));
Re: [Help] Teleporting issues. -
stabker - 27.04.2013
Try it
pawn Код:
CMD:tp(const playerid, const params[])
{
new targetid, target[MAX_PLAYER_NAME], Float:x, Float:y, Float:z;
if(sscanf(params, "u", targetid)) return SendClientMessage(playerid, -1, "Usage: /tp [id]");
if(u == INVALID_PLAYER_ID) return SendClientMessage(playerid, -1, "your message here");
GetPlayerName(targetid, target, sizeof(target)), GetPlayerPos(targetid, x, y, z);
if(IsPlayerInAnyVehicle(playerid))
{
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid));
SetPlayerInterior(playerid, GetPlayerInterior(targetid));
new veh = GetPlayerVehicleID(playerid);
LinkVehicleToInterior(veh, GetPlayerInterior(targetid));
SetVehicleVirtualWorld(veh, GetPlayerVirtualWorld(targetid));
SetVehiclePos(veh, x, y + 5, z + 1);
}
else SetPlayerPos(playerid, x, y, z + 1), SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(targetid)), SetPlayerInterior(playerid, GetPlayerInterior(targetid));
SendClientMessage(targetid, COLOR_WHITE, "An admin teleported to you.");
return 1;
}