SA-MP Forums Archive
/getallhere command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /getallhere command (/showthread.php?tid=166530)



/getallhere command - Ritchie999 - 09.08.2010

Anyone know how i can convert this

pawn Код:
if(strcmp(cmd,"/getallhere",true)==0)
    {
        new Float:plocx,Float:plocy,Float:plocz;
        new plo;
        plo = ReturnUser(tmp);
        if(PlayerInfo[playerid][pAdmin] < 4) return DenyMessage(playerid, 4);
        GetPlayerName(playerid, playrname, sizeof(playrname));
        format(string, sizeof(string), "[INFO:] %s has just teleported everyone to his location.", playrname);
        SendClientMessageToAll(COLOR_YELLOW, string);
        new Float:x,Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
            if(IsPlayerConnected(i))
                SetPlayerPos(plo,plocx,plocy+2, plocz);
        }
        return 1;
    }
To work in Carlito's Roleplay script
I'm doing a heavy edit of CRP for a clan that i'm in.
It's the script they wanted to use.
Here is the /gethere command from the Carlito's script

pawn Код:
if(strcmp(cmd, "/gethere", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[USAGE:] /gethere [playerid]");
                return 1;
            }
            new Float:plocx,Float:plocy,Float:plocz;
            new plo;
            plo = ReturnUser(tmp);
            if (IsPlayerConnected(plo))
            {
                if(plo != INVALID_PLAYER_ID)
                {
                    if (PlayerInfo[playerid][pAdmin] >= 1)
                    {
                        GetPlayerPos(playerid, plocx, plocy, plocz);
                        new interior = GetPlayerInterior(playerid);
                        new world = GetPlayerVirtualWorld(playerid);

                        if (GetPlayerState(playerid) == 2)
                        {
                            new tmpcar = GetPlayerVehicleID(plo);
                            SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                            SetPlayerVirtualWorld(plo,world);
                            SetPlayerInterior(plo,interior);
                        }
                        else
                        {
                            SetPlayerPos(plo,plocx,plocy+2, plocz);
                            SetPlayerVirtualWorld(plo,world);
                            SetPlayerInterior(plo,interior);
                        }
                        format(string, sizeof(string), "[INFO:] You teleported %s to you.", GetPlayerNameEx(plo));
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, string);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Your not an administrator.");
                    }
                }
            }
            else
            {
                format(string, sizeof(string), "   %d is not an active player.", plo);
                SendClientMessage(playerid, COLOR_GRAD1, string);
            }
        }
        return 1;
    }}



Re: /getallhere command - (.Aztec); - 09.08.2010

I'm sorry, but I can't do it in strcmp.. I'll do it for you in ZCMD & sscanf though, maybe you could convert it from there. Also, I don't think you need ReturnUser, since you're not using a parameter.

pawn Код:
COMMAND:getallhere(playerid, params[])
{
    if(File[playerid][Administrator] >= 4)
    {
        for(new i = 0; i <= MAX_PLAYERS; i++)
        {
            new Float:X, Float:Y, Float:Z;
            GetPlayerPos(playerid, X, Y, Z);
            SetPlayerPos(i, X, Y, Z);
        }
    }
}



Re: /getallhere command - JaTochNietDan - 09.08.2010

pawn Код:
if(strcmp(cmd, "/getallhere", true) == 0)
{
    new Float:plocx,Float:plocy,Float:plocz;
    if (PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Your not an administrator.");
    for(new plo; plo < MAX_PLAYERS; plo++)
    {
        if (IsPlayerConnected(plo) && plo != INVALID_PLAYER_ID)
        {
            GetPlayerPos(playerid, plocx, plocy, plocz);
            new interior = GetPlayerInterior(playerid);
            new world = GetPlayerVirtualWorld(playerid);

            if (GetPlayerState(playerid) == 2)
            {
                new tmpcar = GetPlayerVehicleID(plo);
                SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                SetPlayerVirtualWorld(plo,world);
                SetPlayerInterior(plo,interior);
            }
            else
            {
                SetPlayerPos(plo,plocx,plocy+2, plocz);
                SetPlayerVirtualWorld(plo,world);
                SetPlayerInterior(plo,interior);
            }
        }
    }
    format(string, sizeof(string), "[INFO:] %s has teleported everyone to him", GetPlayerNameEx(playerid));
    SendClientMessageToAll( COLOR_LIGHTYELLOW2, string);
    return 1;
}
Should be compatible with your script.


Re: /getallhere command - Ritchie999 - 09.08.2010

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
pawn Код:
if(strcmp(cmd, "/getallhere", true) == 0)
{
    new Float:plocx,Float:plocy,Float:plocz;
    if (PlayerInfo[playerid][pAdmin] < 1) return SendClientMessage(playerid, COLOR_LIGHTYELLOW2, "[ERROR:] Your not an administrator.");
    for(new plo; plo < MAX_PLAYERS; plo++)
    {
        if (IsPlayerConnected(plo))
        {
            if(plo != INVALID_PLAYER_ID)
            {
                    GetPlayerPos(playerid, plocx, plocy, plocz);
                    new interior = GetPlayerInterior(playerid);
                    new world = GetPlayerVirtualWorld(playerid);

                    if (GetPlayerState(playerid) == 2)
                    {
                        new tmpcar = GetPlayerVehicleID(plo);
                        SetVehiclePos(tmpcar, plocx, plocy+4, plocz);
                        SetPlayerVirtualWorld(plo,world);
                        SetPlayerInterior(plo,interior);
                    }
                    else
                    {
                        SetPlayerPos(plo,plocx,plocy+2, plocz);
                        SetPlayerVirtualWorld(plo,world);
                        SetPlayerInterior(plo,interior);
                    }
                }
            }
        }
    }
    format(string, sizeof(string), "[INFO:] %s has teleported everyone to him", GetPlayerNameEx(playerid));
    SendClientMessageToAll( COLOR_LIGHTYELLOW2, string);
    return 1;
}
Should be compatible with your script.
Had to remove one of the ending brackets. There was too many.
Compiled perfectly though, Testing it now..

Works, Thank you once again