teleporting to another player / tele other player to me
#4

Bring Player To You
pawn Код:
dcmd_bp(playerid, params[])
{
  new idx, iString[255], strSend[128];
  iString = strtok(params, idx);
  if(!strlen(iString))
  {
    return SendClientMessage(playerid, 0xFF2B2BFF, ":ERR: Correct usage: /bp [id]");
  }
  else
  {
    new eid = strval(iString);
    if(IsPlayerConnected(eid) && eid != playerid)
    {
      new Float:px, Float:py, Float:pz, pi;
      GetPlayerPos(playerid, px, py, pz);
      pi = GetPlayerInterior(playerid);
      SetPlayerInterior(eid, pi);
      SetPlayerPos(eid, px+1, py+1, pz);
      format(strSend, 128, ":SNX: You've been brought to Id:[%d]", playerid);
      SendClientMessage(eid, 0xFFFF00AA, strSend);
      format(strSend, 128, ":SNX: You brought Id:[%d] to you.", eid);
      return SendClientMessage(playerid, 0xFFFF00AA, strSend);
    }
    else return SendClientMessage(playerid, 0xFF2B2BFF, ":ERR: Invalid Player ID");
  }
}
Change a few variables and you got teleport.
pawn Код:
dcmd_tp(playerid, params[])
{
  new idx, iString[255], strSend[128];
  iString = strtok(params, idx);
  if(!strlen(iString))
  {
    return SendClientMessage(playerid, 0xFF2B2BFF, ":ERR: Correct usage: /tp [id]");
  }
  else
  {
    new eid = strval(iString);
    if(IsPlayerConnected(eid) && eid != playerid)
    {
      new Float:px, Float:py, Float:pz, pi;
      GetPlayerPos(eid, px, py, pz);
      pi = GetPlayerInterior(eid);
      SetPlayerInterior(playerid, pi);
      SetPlayerPos(playerid, px+1, py+1, pz);
      format(strSend, 128, ":SNX: Id:[%d] has teleported to you.", playerid);
      SendClientMessage(eid, 0xFFFF00AA, strSend);
      format(strSend, 128, ":SNX: You teleported to Id:[%d].", eid);
      return SendClientMessage(playerid, 0xFFFF00AA, strSend);
    }
    else return SendClientMessage(playerid, 0xFF2B2BFF, ":ERR: Invalid Player ID");
  }
}
And I'm a 100% sure yopu could have found this if you looked for it cus so many did it in so many different ways i did that a year ago.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)