Get info all player
#1

how do i get info all player and how do i find the largest killer
like this:
pawn Код:
if(PlayerInfo[playerid][pKill] == largest)
sorry for bad english
Reply
#2

I would say you need to make a loop, which would be something like this:
pawn Код:
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerKills(x) >= HighestKills) // you know what to do before, you need to store a new variable for highestkills and make a stock for GetPlayerKills I guess
Reply
#3

http://forum.sa-mp.com/search.php?searchid=6682820
Reply
#4

Quote:
Originally Posted by Jefff
Посмотреть сообщение
Please give me example or something... and how do i kick all player
Reply
#5

To kick all
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++) {
if(IsPlayerConnected(i) && (i != playerid) && i != IsPlayerAdmin(playerid))
 {
Kick(i);
}
Thats an example of a loop, that will kick all players except RCON admin
Reply
#6

and about the get the largest kill ?
Reply
#7

As I've said before, use a loop to see who got the highest kills, something like this:
pawn Код:
for(new x=0; x<MAX_PLAYERS; x++) if (IsPlayerConnected(x)) if (GetPlayerKills(x) >= HighestKills)
And you know what to do from here.
Reply
#8

Sorry for my bad English but I need like if the player has largest kill then setplayerpos(playerid,x,y,z);
Understand me?
Reply
#9

pawn Код:
for(new playerIndex; playerIndex < MAX_PLAYERS; playerIndex++)
{
    // playerIndex is the current player
}
In general coding, this is called a loop. It will go from 0 to 500 (by default) or to however many maximum players your script specifies 1 by 1 so anything put in this loop will happen for every player if you specify playerIndex as the playerid parameter to a player function. To check for the highest kill, you're going to want to create two variables outside of the loop and then in the loop you want to check if the player's kills are greater than the first variable, if so, set the variable to the player's kills and set the second variable to playerIndex. After the loop, the ID of the player with the highest amount of kills will be stored in the second variable.

This is a HELP section and you need to try to do some things on your own. You won't always receive a complete answer to everything.
Reply
#10

pawn Код:
stock GetHighestKills() // it will return the id of highest kills
    {
        new id = -1;
        new id2;
        for(new i = 0;i < MAX_PLAYERS)
            {
                if(IsPlayerConnected(i))
                    {
                        id2 = PlayerInfo[playerid][pKill];
                            if(id2 > id && id != -1)
                                {
                                    id = i;
                                }
                    }
            }
        return id; //if the was was empty it will return to -1; which you can say its INVALID PLAYER ID
    }
Not tested..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)