question
#1

How can i get the next player ascendingly who have some features on , for example: specing rcon admins ascendingly
Код:
CMD:specadmins(playerid, params[])
{
     foreach(new i : Character)
     {
          if(IsPlayerAdmin(i)) TogglePlayerSpectating(playerid, 1); PlayerSpectatePlayer(playerid, i, 
          SPECTATE_MODE_NORMAL);
     }
     return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     if(newkeys & SPRINT_KEY)
     {
         //Spectating the next admin
     }
     return 1;
}
Reply
#2

I hope i helped u. [I didn't test the code]

Код:
new SpectateID[MAX_PLAYERS];

hook OnPlayerConnect(playerid)
{
     SpectateID[playerid] = -1;
     return 1;
}

hook OnPlayerDisconnect(playerid)
{
     SpectateID[playerid] = -1;
     return 1;
}

CMD:specadmins(playerid, params[])
{
     foreach(new i : Player)
     {
          if(IsPlayerAdmin(i)) 
          {
                  TogglePlayerSpectating(playerid, 1);
                  PlayerSpectatePlayer(playerid, i, SPECTATE_MODE_NORMAL);
                  SpectateID[playerid] = i;
                  return 1;
          } 
     }
     return 1;
}

hook OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
     if(newkeys & SPRINT_KEY)
     {
            if(SpectateID[playerid] != -1)
            {
                    foreach(new i : Player)
                    {
                             if(IsPlayerAdmin(i) && i != SpectateID[playerid])
                             {
                                    PlayerSpectatePlayer(playerid, i, SPECTATE_MODE_NORMAL);
                                    SendClientMessage(playerid, -1, "You now spectateing the next admin.");
                                    SpectateID[playerid] = i;
                             }
                     }
             }
     }
     return 1;
}
Reply
#3

Thanks for help , but thats not what i exactly mean , i mean to do it for example with bigger id , or who been rcon before who. This code will select players randomly due internet connection of loops , i need to do it 1 by 1
Reply
#4

Nvm , i found how to do it, thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)