14.11.2012, 19:32
What is the call to teleport a player from their location to another one?
COMMAND:gethere(playerid, params[])
{
new targetid;
if(sscanf(params,"u", targetid)) return SendClientMessage(playerid,COLOR_RED,""WHITE"Usage: "GREEN"/gethere "WHITE"[id]");
if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_WHITE, "Invalid Player ID."RED"(Player Is Not Connected)!");
if(targetid == playerid) return SendClientMessage(playerid, COLOR_BRIGHTRED, "You can't use this command on yourself !");
new Float:X,Float:Y,Float:Z;new interior,world;new string[128];
GetPlayerName(targetid, giveplayer, sizeof(giveplayer));
GetPlayerPos(playerid, X, Y, Z);
interior = GetPlayerInterior(playerid);
world = GetPlayerVirtualWorld(playerid);
if(IsPlayerInAnyVehicle(targetid))
{
SetVehiclePos(GetPlayerVehicleID(targetid),X+5,Y+3,Z);
new vehicle = GetPlayerVehicleID(targetid);
LinkVehicleToInterior(vehicle,interior);
SetVehicleVirtualWorld(GetPlayerVehicleID(targetid), world);
}
else
{
SetPlayerPos(targetid, X, Y+1, Z);
SetPlayerInterior(targetid, interior);
SetPlayerVirtualWorld(targetid, world);
}
new Name[MAX_PLAYER_NAME];
GetPlayerName(playerid, Name, sizeof(Name));
format(string, sizeof(string), ""WHITE"You Have Teleported "ORANGE"\"%s\""WHITE" To Your Position.", giveplayer);
SendClientMessage(playerid,COLOR_WHITE, string);
format(string, sizeof(string), ""WHITE"You have Been Teleported by "ORANGE"\"%s\""WHITE" To His Position.", Name);
SendClientMessage(targetid, COLOR_WHITE, string);
return 1;
}