Skip to content

Commit

Permalink
Update GetPlayers.md
Browse files Browse the repository at this point in the history
  • Loading branch information
adib-yg committed Jan 24, 2024
1 parent 80ea5ca commit cb16191
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions docs/scripting/functions/GetPlayers.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,21 @@ Gets an array variable of the IDs of the current players on the server.
| players[] | An array into which to store the player IDs, passed by reference. |
| size | The size of the array. |

## Returns

The function returns the number of players stored in the array.

## Examples

Suppose there are 5 players on the server:

```c
new players[MAX_PLAYERS];
new length;

GetPlayers(players, sizeof(players));
// The `players` array now contains online player IDs. { 0, 1, 2, 3, 4, ... }
length = GetPlayers(players, sizeof(players));
// The `players` array now contains online player IDs. { 0, 1, 2, 3, 4 }
// The value of the `length` variable is 5
```

## Related Functions
Expand Down

0 comments on commit cb16191

Please sign in to comment.