[Pedido] Puxar varios players
#1

serб que existe uma possibilidade de existir um comando para puxar alguns players, tipo:
/Puxar [ID] [ID] [ID] [ID] [ID] [ID]
Exemplo:
/Puxar 1 2 3 4 5 6
Reply
#2

zcmd e sscanf.

pawn Код:
CMD:puxargeral(playerid, params[])
{
    new ID, ID1, ID2, ID3, ID4, ID5;
    if (sscanf (params, "iiiiii", ID, ID1, ID2, ID3, ID4, ID5)) return SendClientMessage(playerid, -1, "/puxar ID ID ID ID ID ID");
    new Float: X, Float: Y, Float: Z;
    GetPlayerPos(playerid, X, Y, Z);
    SetPlayerPos(ID, X, Y , Z);
    SetPlayerPos(ID1, X, Y , Z);
    SetPlayerPos(ID2, X, Y , Z);
    SetPlayerPos(ID3, X, Y , Z);
    SetPlayerPos(ID4, X, Y , Z);
    SetPlayerPos(ID5, X, Y , Z);
    return 1;
}
Reply
#3

Existe Um Que vc Puxa Todos Os Players On , Serve ?

@Edit

pawn Код:
if(strcmp(cmd, "/trazertodos", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(string, sizeof(string), "(INFO) O Administrador %s (%d) trouxe todos para sua posiзгo.", aname,playerid);
SendClientMessageToAll(tcadm, string);
for(new i=0;i<MAX_PLAYERS;i++){
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] > 1){
if(IsPlayerConnected(i)){
new interiormeu;
interiormeu = GetPlayerInterior(playerid);
SetPlayerInterior(i, interiormeu);
new Float:X, Float:Y, Float:Z;
GetPlayerPos(playerid, X, Y, Z);
SetPlayerPos(i, X, Y, Z);
}
}
}
return 1;
}
Ta Aew ...
Reply
#4

pawn Код:
YCMD:puxar ( playerid, params [ ], help )
{
    new
        targetid [ 6 ];

    if ( sscanf ( params, "uuuuuu", targetid [ 0 ], targetid [ 1 ], targetid [ 2 ], targetid [ 3 ], targetid [ 4 ], targetid [ 5 ] ) )
        return SendClientMessage ( playerid, -1, "Use: /puxar [ID] [ID] [ID] [ID] [ID] [ID]" );

    new
        Float: plr_pos [ MAX_PLAYERS ] [ 4 ];

    GetPlayerPos ( playerid, plr_pos [ playerid ] [ 0 ], plr_pos [ playerid ] [ 1 ], plr_pos [ playerid ] [ 2 ] );
    GetPlayerFacingAngle ( playerid, plr_pos [ playerid ] [ 3 ] );

    for ( new i = 0; i < 6; i++ )
    {
        SetPlayerPos ( i, plr_pos [ playerid ] [ 0 ], plr_pos [ playerid ] [ 1 ], plr_pos [ playerid ] [ 2 ] );
        SetPlayerFacingAngle ( i, plr_pos [ playerid ] [ 3 ] );
    }
   
    return 1;
}
Reply
#5

Quote:
Originally Posted by Lуs
Посмотреть сообщение
pawn Код:
YCMD:puxar ( playerid, params [ ], help )
{
    new
        targetid [ 6 ];

    if ( sscanf ( params, "uuuuuu", targetid [ 0 ], targetid [ 1 ], targetid [ 2 ], targetid [ 3 ], targetid [ 4 ], targetid [ 5 ] ) )
        return SendClientMessage ( playerid, -1, "Use: /puxar [ID] [ID] [ID] [ID] [ID] [ID]" );

    new
        Float: plr_pos [ MAX_PLAYERS ] [ 4 ];

    GetPlayerPos ( playerid, plr_pos [ playerid ] [ 0 ], plr_pos [ playerid ] [ 1 ], plr_pos [ playerid ] [ 2 ] );
    GetPlayerFacingAngle ( playerid, plr_pos [ playerid ] [ 3 ] );

    for ( new i = 0; i < 6; i++ )
    {
        SetPlayerPos ( i, plr_pos [ playerid ] [ 0 ], plr_pos [ playerid ] [ 1 ], plr_pos [ playerid ] [ 2 ] );
        SetPlayerFacingAngle ( i, plr_pos [ playerid ] [ 3 ] );
    }
   
    return 1;
}
plr_pos precisava realmente ter 2 dimensхes?
Reply
#6

Quote:
Originally Posted by Jason`
Посмотреть сообщение
plr_pos precisava realmente ter 2 dimensхes?
Aн й vocк que decide, criei para cada jogador pois tive um problema recente referente a isso, mas aн й com vocк, nгo vai influenciar muita coisa...

pawn Код:
YCMD:puxar ( playerid, params [ ], help )
{
    new
        targetid [ 6 ];

    if ( sscanf ( params, "uuuuuu", targetid [ 0 ], targetid [ 1 ], targetid [ 2 ], targetid [ 3 ], targetid [ 4 ], targetid [ 5 ] ) )
        return SendClientMessage ( playerid, -1, "Use: /puxar [ID] [ID] [ID] [ID] [ID] [ID]" );

    new
        Float: plr_pos [ 4 ];

    GetPlayerPos ( playerid, plr_pos [ 0 ], plr_pos [ 1 ], plr_pos [ 2 ] );
    GetPlayerFacingAngle ( playerid, plr_pos [ 3 ] );

    for ( new i = 0; i < 6; i++ )
    {
        SetPlayerPos ( i, plr_pos [ 0 ], plr_pos [ 1 ], plr_pos [ 2 ] );
        SetPlayerFacingAngle ( i, plr_pos [ 3 ] );
    }

    return 1;
}
Reply
#7

Obrigado a todos, ajudou bastante
Reply
#8

[I]Se preferir:

pawn Код:
CMD:puxar(playerid, params[]) {

    if(isnull(params)) return SendClientMessage(playerid, -1, "USO: /puxar [ID'S]");

    new param[64]; //Aumenta o limite, sendo a metada + 1 o mбximo suportado.
    Split(params, param, ' ');

    new Float: p[3];
    GetPlayerPos(playerid, p[0], p[1], p[2]);
    for(new i; i != strlen(param); i++) SetPlayerPos(param[i], p[0], p[1], p[2]);
    return 1;
}

Split(const strsrc[], strdest[], delimiter) {
    new i, aNum, bool: a;
    while(i != (strlen(strsrc) + 1)) {
        if(!(strsrc[i] == delimiter || i == strlen(strsrc))) {
            if(strsrc[i] > '/' && strsrc[i] < ':') {
                if(strsrc[(i + 1)] == delimiter || (i + 1) == strlen(strsrc)) strdest[aNum] = (a ? ((strdest[(aNum - 1)] * 10) + (strsrc[i] - '0')) : (strsrc[i] - '0'));
                a = true;
            }
        } else {
            aNum++;
            a = false;
        }
        i++;
    }
    return aNum;
}[/i]


Esse comando й infinito, ou seja, o limite й definido pela quantidade de cйlulas..
USO: /puxar [QUANTO ID's QUISER, SEPARADOS POR ESPAЗO]
Ex: /puxar 1 3 5 4 9 8 10 25 64 89 41...
Reply
#9

Quote:
Originally Posted by paulor
Посмотреть сообщение
[I]Se preferir:

pawn Код:
CMD:puxar(playerid, params[]) {

    if(isnull(params)) return SendClientMessage(playerid, -1, "USO: /puxar [ID'S]");

    new param[64]; //Aumenta o limite, sendo a metada + 1 o mбximo suportado.
    Split(params, param, ' ');

    new Float: p[3];
    GetPlayerPos(playerid, p[0], p[1], p[2]);
    for(new i; i != strlen(param); i++) SetPlayerPos(param[i], p[0], p[1], p[2]);
    return 1;
}

Split(const strsrc[], strdest[], delimiter) {
    new i, aNum, bool: a;
    while(i != (strlen(strsrc) + 1)) {
        if(!(strsrc[i] == delimiter || i == strlen(strsrc))) {
            if(strsrc[i] > '/' && strsrc[i] < ':') {
                if(strsrc[(i + 1)] == delimiter || (i + 1) == strlen(strsrc)) strdest[aNum] = (a ? ((strdest[(aNum - 1)] * 10) + (strsrc[i] - '0')) : (strsrc[i] - '0'));
                a = true;
            }
        } else {
            aNum++;
            a = false;
        }
        i++;
    }
    return aNum;
}[/i]


Esse comando й infinito, ou seja, o limite й definido pela quantidade de cйlulas..
USO: /puxar [QUANTO ID's QUISER, SEPARADOS POR ESPAЗO]
Ex: /puxar 1 3 5 4 9 8 10 25 64 89 41...
pawn Код:
sscanf(inputtext, "p< >a<u>[64]", param);
Sу nгo tenho certeza se com espaзo vai funcionar.
Reply
#10

Quote:
Originally Posted by Lуs
Посмотреть сообщение
pawn Код:
sscanf(inputtext, "p< >a<u>[64]", param);
Sу nгo tenho certeza se com espaзo vai funcionar.
Nгo sou muito fг do sscanf plugin, mas se realmente funciona, bem legal!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)