teleports
#1

im am now currently adding some tele cmds for my admins script, but i am having some trobble..

i am wondering iof this code will work to tele to another player:

Код:
if((strcmp(cmdtext, "/teleto", true, 5)== 0))
	{
  if(!strlen(cmdtext[6]))
  {
    SendClientMessage(playerid, 0xFF0000AA, "Use: /teleto [playerid]");
    return 1;
  }
  new toid = strval(cmdtext[6]);
  new pName[24], str[64];
  if(IsPlayerConnected(toid))
  {
    GetPlayerName(toid, pName, 24);
    SendClientMessage(playerid, 0xFF0000AA, "Teleported");
    new Float:X,Float:Y,Float:Z;
		GetPlayerPos(toid,X,Y,Z);
		SetPlayerPos(playerid,X,Y,Z);
  }
  return 1;
	}
and just switching some things arround to tele them to me:
Код:
if((strcmp(cmdtext, "/teleto", true, 5)== 0))
	{
  if(!strlen(cmdtext[6]))
  {
    SendClientMessage(playerid, 0xFF0000AA, "Use: /teletome [playerid]");
    return 1;
  }
  new fromid = strval(cmdtext[6]);
  new pName[24], str[64];
  if(IsPlayerConnected(fromid))
  {
    GetPlayerName(fromid, pName, 24);
    SendClientMessage(playerid, 0xFF0000AA, "Teleported");
    new Float:X,Float:Y,Float:Z;
		GetPlayerPos(playerid,X,Y,Z);
		SetPlayerPos(fromid,X,Y,Z);
  }
  return 1;
	}
that pretty much it! look over it and tell me if it looks right!
Reply
#2

Why don't you try it :P
Reply
#3

You may also need to factor in interiors and virtual worlds etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)