Agregar comando para ir a una posicion [Solucionado]
#1

Hola, me gustaria agregar un comando para ir a una posicion que yo quiera....

EJ: "/pos 2779.3843,-2434.2644,13.3568"

Al poner eso me lleve a esa cordenada, es posible eso?
PD: Todo los "AddStaticVehicle" son coches de faccion & jobs?
Reply
#2

pawn Код:
//definicion de dcmd, arriba de todo, debajo de los includes
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
pawn Код:
//definicion del comando
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(pos,3,cmdtext);
  return 0;
}
pawn Код:
//comando en si
dcmd_pos(playerid, params){
  new tmp[256], tmp2[256], tmp3[256], Index;
  tmp = strtok(params, Index);
  tmp2 = strtok(params, Index);
  tmp3 = strtok(params, Index);
  if(!strlen(tmp) || !strlen(tmp2) || strlen(tmp3))return SendClientMessage(playerid, 0xFFFF00FF, "Uso: /ir coordenada x, coordenada y, coordenada z");
  new Float:X, Float:Y, Float:Z, str[128];
  X = strval(tmp);
  Y = strval(tmp2);
  Z = strval(tmp3);
  SetPlayerPos(playerid, X, Y, Z);
  format(str, sizeof(str), "Has sido teleportado a la posiciуn: %s, %s, %s", X, Y, Z);
  return sendClientMessage(playerid, 0xFFFF00FF, str);
}
espero que te sirva, si no anda decime y me fijo q esta mal
Reply
#3

Mira, mirando ese codigo vi que el GM que tengo (raven's roleplay) ya lo tiene es "/xgoto" pero no me anda en el juego..
Codigo:
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
pawn Код:
dcmd_xgoto(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    if (sscanf(params, "fff", x, y, z)) SendClientMessage(playerid, 0xFF0000AA, "USE: \"/xgoto <X Float> <Y Float> <Z Float>\"");
    else
    {
      new string[64];
      SetPlayerPos(playerid, x, y, z);
      format(string, sizeof(string), "You've set your coord to %f, %f, %f", x, y, z);
      SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    return 0;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(xgoto, 9, cmdtext);
  return 0;
}
Reply
#4

Quote:
Originally Posted by Distrito 79
Mira, mirando ese codigo vi que el GM que tengo (raven's roleplay) ya lo tiene es "/xgoto" pero no me anda en el juego..
Codigo:
pawn Код:
#define dcmd(%1,%2,%3) if ((strcmp((%3)[1], #%1, true, (%2)) == 0) && ((((%3)[(%2) + 1] == 0) && (dcmd_%1(playerid, "")))||(((%3)[(%2) + 1] == 32) && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
pawn Код:
dcmd_xgoto(playerid, params[])
{
    new Float:x, Float:y, Float:z;
    if (sscanf(params, "fff", x, y, z)) SendClientMessage(playerid, 0xFF0000AA, "USE: \"/xgoto <X Float> <Y Float> <Z Float>\"");
    else
    {
      new string[64];
      SetPlayerPos(playerid, x, y, z);
      format(string, sizeof(string), "You've set your coord to %f, %f, %f", x, y, z);
      SendClientMessage(playerid, 0xFFFFFFFF, string);
    }
    return 0;
}
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
  dcmd(xgoto, 9, cmdtext);
  return 0;
}
Porque tienes puesto:
dcmd(xgoto, 9, cmdtext);
prueba asн
dcmd(xgoto, 5, cmdtext);
Reply
#5

Impecable, ahora si quedo anda a Full Mil gracias!
Reply
#6

Quote:
Originally Posted by Distrito 79
Impecable, ahora si quedo anda a Full Mil gracias!
xD, de nada.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)