PHP код:
if(strcmp(cmd, "/teleport", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /teleport [playerid]");
return 1;
}
giveplayerid = strval(tmp);
new Float:x,Float:y,Float:z;
GetPlayerPos(giveplayerid, x, y ,z);
new giveplayerint = GetPlayerInterior(giveplayerid);
new giveplayervir = GetPlayerVirtualWorld(giveplayerid);
if ((IsPlayerAdmin(playerid)) || PlayerInfo[playerid][pAdmin] >= 101)
{
if (IsPlayerInAnyVehicle(playerid))
{
new playervec = GetPlayerVehicleID(playerid);
SetVehiclePos(playervec, x, y, z+3.5);
LinkVehicleToInterior(playervec, giveplayerint);
SetVehicleVirtualWorld(playervec, giveplayerint);
SetPlayerInterior(playerid, giveplayerint);
SetPlayerVirtualWorld(playerid, giveplayervir);
SetVehicleZAngle(playervec, z);
PutPlayerInVehicle(playerid, playervec, 0);
format(string, sizeof(string), "You have teleported to %s",PlayerName[giveplayerid]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "%s teleported to you.",PlayerName[playerid]);
SendClientMessage(giveplayerid, COLOR_GREY, string);
if(IsPlayerInHouse[giveplayerid] != INVALID_HOUSE_ID && IsPlayerInHouse[playerid] == INVALID_HOUSE_ID){IsPlayerInHouse[playerid] = IsPlayerInHouse[giveplayerid];}
else{IsPlayerInHouse[playerid] = INVALID_HOUSE_ID;}
}
else
{
SetPlayerInterior(playerid, giveplayerint);
SetPlayerVirtualWorld(playerid, giveplayervir);
SetPlayerPos(playerid, x, y, z+3.5);
format(string, sizeof(string), "You have teleported to %s",PlayerName[giveplayerid]);
SendClientMessage(playerid, COLOR_GREY, string);
format(string, sizeof(string), "%s teleported to you.",PlayerName[playerid]);
SendClientMessage(giveplayerid, COLOR_GREY, string);
if(IsPlayerInHouse[giveplayerid] != INVALID_HOUSE_ID && IsPlayerInHouse[playerid] == INVALID_HOUSE_ID){IsPlayerInHouse[playerid] = IsPlayerInHouse[giveplayerid];}
else{IsPlayerInHouse[playerid] = INVALID_HOUSE_ID;}
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not allowed to use this command.");
}
return 1;
}