23.12.2014, 00:31
This basically just gets some very simple server(but nevertheless) useful data such as the IP address, port, maxplayers, etc. There are a few self-explanatory functions.
===============================
GetServerIP() - Gets the servers IP address. This will not work in OnFilterScriptInit(it will work how-ever in a delayed timer placed in said callback).
GetServerPort() - Returns the servers port as an integer value.
GetServerMaxPlayers() - Returns the maximum amount of players as defined in the server.cfg file.
GetServerMaxNPC() - Returns the maximum amount of NPC's as defined in the server.cfg file.
GetConnectedPlayers(lincludenpc=false) - Returns the amount of connected players. If includenpc is true, NPC's will be included so be careful. If left blank, NPC's will be excluded from the player-count.
===============================
That's basically it so here's the download!
- View in Browser -
- Direct download -
Example filterscript:
If you have any questions feel free to ask.
===============================
GetServerIP() - Gets the servers IP address. This will not work in OnFilterScriptInit(it will work how-ever in a delayed timer placed in said callback).
GetServerPort() - Returns the servers port as an integer value.
GetServerMaxPlayers() - Returns the maximum amount of players as defined in the server.cfg file.
GetServerMaxNPC() - Returns the maximum amount of NPC's as defined in the server.cfg file.
GetConnectedPlayers(lincludenpc=false) - Returns the amount of connected players. If includenpc is true, NPC's will be included so be careful. If left blank, NPC's will be excluded from the player-count.
===============================
That's basically it so here's the download!
- View in Browser -
- Direct download -
Example filterscript:
pawn Code:
#include <a_samp>
#include <serverdata>
public OnFilterScriptInit()
{
new port = GetServerPort();
printf("Port: %d", port);
printf("Max Players: %d Max NPCs: %d", GetServerMaxPlayers(), GetServerMaxNPC());
SetTimer("DisplayIP", 5000, false);
return 1;
}
forward DisplayIP();
public DisplayIP()
{
new IPAddress[32];
format(IPAddress, sizeof(IPAddress), "%s", GetServerIP());
printf("The IP address is: %s", IPAddress);
return true;
}