Get info all player -
xganyx - 20.07.2013
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
Re: Get info all player -
JimmyCh - 20.07.2013
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
Re: Get info all player -
Jefff - 20.07.2013
http://forum.sa-mp.com/search.php?searchid=6682820
Re: Get info all player -
xganyx - 20.07.2013
Quote:
Originally Posted by Jefff
|
Please give me example or something... and how do i kick all player
Re: Get info all player -
JimmyCh - 20.07.2013
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
Re: Get info all player -
xganyx - 20.07.2013
and about the get the largest kill ?
Re: Get info all player -
JimmyCh - 20.07.2013
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.
Re: Get info all player -
xganyx - 20.07.2013
Sorry for my bad English but I need like if the player has largest kill then setplayerpos(playerid,x,y,z);
Understand me?
Re: Get info all player -
SuperViper - 21.07.2013
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.
Re: Get info all player -
[D]ry[D]esert - 21.07.2013
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..