SAMP /GETALL Player CMD??? - Is this possible? With Timer??
#1

The title ask , How can i make Get All player cmd? . With timer

Thanks in advance!


Imma give +rep
Reply
#2

Quote:
Originally Posted by S4MSUNG
Посмотреть сообщение
The title ask , How can i make Get All player cmd? . With timer

Thanks in advance!


Imma give +rep
Easy man, you can make a loop.

pawn Код:
for(new i = 0;i < MAX_PLAYERS; i++)
{
new Float:Pos[3];
GetPlayerPos(playerid,Pos[1],Pos[2],Pos[3]);
SetPlayerPos(i,Pos[1],Pos[2],Pos[3])
SendClientMessageToAll(-1, "Admin teleported all!");
}
Then you use the funciуn GetPlayerPos and apply SetPlayerPos to "i".

I'm on my phone and i can't make the code now. Search loop con sa-mp wiki and you will make it fast.
Reply
#3

pawn Код:
COMMAND:getall(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return 0;
    SetTimerEx("GetAllPlayers", 5000, 0, "i", playerid);
    SendClientMessageToAll(-1, "You will all be teleported to admin in 5 seconds....");
    return 1;
}

forward GetAllPlayers(playerid);
public GetAllPlayers(playerid)
{
    new Float:X, Float:Y, Float:Z, Float:iX, Float:iY;
    GetPlayerPos(playerid, X, Y, Z);
    for(new i; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(IsPlayerInAnyVehicle(i)) RemovePlayerFromVehicle(i);
            iX = floatadd(floatsub(random(30), 15.0), X);
            iY = floatadd(floatsub(random(30), 15.0), Y);
            SetPlayerPos(i, iX, iY, (Z+1.0));
            SendClientMessage(i, -1, "You've been teleported to the admin");
        }
    }
    return 1;
}
Reply
#4

Quote:
Originally Posted by xHanks
Посмотреть сообщение
Easy man, you can make a loop.

pawn Код:
for(new i = 0;i < MAX_PLAYERS; i++)
{
new Float:Pos[3];
GetPlayerPos(playerid,Pos[1],Pos[2],Pos[3]);
SetPlayerPos(i,Pos[1],Pos[2],Pos[3])
SendClientMessageToAll(-1, "Admin teleported all!");
}
Then you use the funciуn GetPlayerPos and apply SetPlayerPos to "i".

I'm on my phone and i can't make the code now. Search loop con sa-mp wiki and you will make it fast.
pawn Код:
SendClientMessageToAll(-1, "Admin teleported all!");
will spam chat box !
use it out of loop or use send client message
Reply
#5

THANK YOU GUYS SUPER MUCH APPRECIATED, PROBLEM SOLVED THANKS FOR HELPING ME

+REP TO ALL OF YOU <3
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)