Код:
if(strcmp("/tpto", cmd, true) == 0)
{
if(IsPlayerConnected(playerid))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "{33CCFF}USAGE:{FFFFFF} /tpto [playerid/PartOfName]");
return 1;
}
giveplayerid = ReturnUser(tmp);
if (PlayerInfo[playerid][admin] < 1)
{
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
GetPlayerPos(giveplayerid,retx[giveplayerid],rety[giveplayerid],retz[giveplayerid]);
if(IsPlayerInAnyVehicle(playerid))
{
new vid = GetPlayerVehicleID(playerid);
SetVehiclePos(vid, retx[giveplayerid]+3,rety[giveplayerid],retz[giveplayerid]);
LinkVehicleToInterior(vid, GetPlayerInterior(giveplayerid));
SetVehicleVirtualWorld(vid, GetPlayerVirtualWorld(giveplayerid));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
}
else
{
SetPlayerPos(playerid, retx[giveplayerid]+3,rety[giveplayerid],retz[giveplayerid]);
SetPlayerInterior(playerid, GetPlayerInterior(giveplayerid));
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(giveplayerid));
}
return 1;
}
}
else
{
new string[256];
format(string, sizeof(string), " %d is not an active player.", giveplayerid);
SendClientMessage(playerid, COLOR_GREY, string);
}
}
else return SendClientMessage(playerid, COLOR_GREY, " {BCD4E6}Error: {FFFFFF}Sorry, you cant use this command.");
}
return 1;
}