How to get multiple ID's?
#1

I mean like:


/get [Multiple ID's] (Maximum id's can be selected are 10)



/get 1 6 9 8 4 7
Reply
#2

Im using dcmd....

I want a command like

/gethere [Id's]
Usage: You can teleport from 1 to 10 to you.
Reply
#3

Can you please make it on dcmd?
Reply
#4

Show Your cmd
Reply
#5

pawn Код:
CMD:getplayers(playerid, params[])
{
    if (PlayerInfo[playerid][pAdmin] >= 2)
    {
        new fp1,fp2,fp3,fp4,fp5,fp6;
        if(!sscanf(params, "uuuuuu", fp1,fp2,fp3,fp4,fp5,fp6))
        {
            if (IsPlayerConnected(fp1))
            {
                new Float:fp1x,Float:fp1y,Float:fp1z;
                new world = GetPlayerVirtualWorld(playerid);
                new intid = GetPlayerInterior(playerid);
                GetPlayerPos(playerid, fp1x, fp1y, fp1z);
                SetPlayerVirtualWorld(fp1, world);
                SetPlayerPos(fp1,fp1x,fp1y+1, fp1z);
                SetPlayerInterior(fp1, intid);
                SendClientMessage(fp1, COLOR_GREY, "An admin teleported you.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "   Invalid player!");
                return 1;
            }
            if (IsPlayerConnected(fp2))
            {
                new Float:fp2x,Float:fp2y,Float:fp2z;
                new world = GetPlayerVirtualWorld(playerid);
                new intid = GetPlayerInterior(playerid);
                GetPlayerPos(playerid, fp2x, fp2y, fp2z);
                SetPlayerVirtualWorld(fp2, world);
                SetPlayerPos(fp2,fp2x,fp2y+1, fp2z);
                SetPlayerInterior(fp2, intid);
                SendClientMessage(fp2, COLOR_GREY, "An admin teleported you.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "   Invalid player!");
                return 1;
            }
            if (IsPlayerConnected(fp3))
            {
                new Float:fp3x,Float:fp3y,Float:fp3z;
                new world = GetPlayerVirtualWorld(playerid);
                new intid = GetPlayerInterior(playerid);
                GetPlayerPos(playerid, fp3x, fp3y, fp3z);
                SetPlayerVirtualWorld(fp3, world);
                SetPlayerPos(fp3,fp3x,fp3y+1, fp3z);
                SetPlayerInterior(fp3, intid);
                SendClientMessage(fp3, COLOR_GREY, "An admin teleported you.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "   Invalid player!");
                return 1;
            }
            if (IsPlayerConnected(fp4))
            {
                new Float:fp4x,Float:fp4y,Float:fp4z;
                new world = GetPlayerVirtualWorld(playerid);
                new intid = GetPlayerInterior(playerid);
                GetPlayerPos(playerid, fp4x, fp4y, fp4z);
                SetPlayerVirtualWorld(fp4, world);
                SetPlayerPos(fp4,fp4x,fp4y+1, fp4z);
                SetPlayerInterior(fp4, intid);
                SendClientMessage(fp4, COLOR_GREY, "An admin teleported you.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "   Invalid player!");
                return 1;
            }
            if (IsPlayerConnected(fp5))
            {
                new Float:fp5x,Float:fp5y,Float:fp5z;
                new world = GetPlayerVirtualWorld(playerid);
                new intid = GetPlayerInterior(playerid);
                GetPlayerPos(playerid, fp5x, fp5y, fp5z);
                SetPlayerVirtualWorld(fp5, world);
                SetPlayerPos(fp5,fp5x,fp5y+1, fp5z);
                SetPlayerInterior(fp5, intid);
                SendClientMessage(fp5, COLOR_GREY, "An admin teleported you.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "   Invalid player!");
                return 1;
            }
            if (IsPlayerConnected(fp6))
            {
                new Float:fp6x,Float:fp6y,Float:fp6z;
                new world = GetPlayerVirtualWorld(playerid);
                new intid = GetPlayerInterior(playerid);
                GetPlayerPos(playerid, fp6x, fp6y, fp6z);
                SetPlayerVirtualWorld(fp6, world);
                SetPlayerPos(fp6,fp6x,fp6y+1, fp6z);
                SetPlayerInterior(fp6, intid);
                SendClientMessage(fp6, COLOR_GREY, "An admin teleported you.");
                return 1;
            }
            else
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "   Invalid player!");
                return 1;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /Getplayers[players (1 2 3 4 5 6)/PartOfName]");
            return 1;
        }
    }
    return 1;
}
That to DCMD please.
Reply
#6

Misread - withdrawn lol
Reply
#7

So can anybody convert that to DCMD?
Reply
#8

Try
pawn Код:
dcmd_gethere(playerid,params[])
{
    new pID[10];
    sscanf(params, "A<i>(999)[10]",pID);
    if(pID[0] == 999) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /gethere [players ID1 ID2 ...]");
    new Float:Pos[4],K[2];
    K[0] = GetPlayerInterior(playerid);
    K[1] = GetPlayerVirtualWorld(playerid);
    GetPlayerPos(playerid,P[0],P[1],P[2]);
    GetPlayerFacingAngle(playerid,P[3]);
    for(new d; d < sizeof(pID); d++)
        if(pID[d] != 999)
            if(IsPlayerConnected(pID[d]))
            {
                SetPlayerInterior(pID[d],K[0]);
                SetPlayerVirtualWorld(pID[d],K[1]);
                SetPlayerPos(pID[d],P[0],P[1],P[2]);
                SetPlayerFacingAngle(pID[d],P[3]);
                SendClientMessage(pID[d], COLOR_GREY, "An admin teleported you.");
            }
    return 1;
}
Reply
#9

pawn Код:
dcmd_getplayers(playerid, params[])
{
    new GPL[9];
    new VirWorld = GetPlayerVirtualWorld(playerid);
    new Int = GetPlayerInterior(playerid);
    new Float:X, Float:Y, Float:Z;
    GetPlayerPos(playerid, X, Y, Z);
    if(IsNull(params)) { SendClientMessage(playerid, 0xFFFFFFFF, "USAGE: /getplayers [ID] (Up to 10 players at a time)"); return 1; }
    sscanf(params, "uuuuuuuuuu", GPL[0], GPL[1], GPL[2], GPL[3], GPL[4], GPL[5], GPL[6], GPL[7], GPL[8], GPL[9])
    for(new i=0; i<10; i++)
    {
        if(IsPlayerConnected(GPL[i] && GPL[i] != INVALID_PLAYER_ID)
        {
            SetPlayerPos(GPL[i], X, Y, Z));
            SetPlayerVirtualWorld(GPL[i], VirWorld);
            SetPlayerInterior(GPL[i], Int);
        }
    }
}
Reply
#10

Ya. Im not too comfortable with sscanf tho, I'm not entirely sure if it will return as much as it can or if it will just throw it's hands in the air and return nothing on fail.

If it does the latter, my code won't work for shit
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)