Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp> // Zahrnuje SA-MP nativní funkce
- //Infoooooooooo by Vankin,exploit, SuperGrand
- #define MAX_SERVERS 50 // Maximální počet serverů
- #define MAX_PLAYER_NAME 24 // Maximální délka jména hráče
- #define MAX_GAME_MODE_LENGTH 32 // Maximální délka názvu herního módu
- #define MAX_MAP_NAME_LENGTH 32 // Maximální délka názvu mapy
- new g_ServerData[MAX_SERVERS][6]; // Pole pro uložení dat o serverech: IP, port, název, počet hráčů, herní mód, mapa
- // Načtení dat o serverech při startu
- public OnGameModeInit()
- {
- GetServerData();
- return 1;
- }
- // Funkce pro získání dat o serverech
- public GetServerData()
- {
- new File:fileHandle = fopen("server_data.txt", io_read);
- if (!fileHandle)
- {
- printf("Chyba: Nepodařilo se otevřít soubor 'server_data.txt'!");
- return 0;
- }
- new line[128], idx = 0;
- while (!feof(fileHandle) && idx < MAX_SERVERS)
- {
- fgets(fileHandle, line, sizeof(line));
- sscanf(line, "%s %d %s %d %s %s", g_ServerData[idx][0], g_ServerData[idx][1], g_ServerData[idx][2], g_ServerData[idx][3], g_ServerData[idx][4], g_ServerData[idx][5]);
- idx++;
- }
- fclose(fileHandle);
- printf("Data o serverech načtena úspěšně.");
- return 1;
- }
- // Příkaz pro zobrazení informací o konkrétním serveru
- CMD:info(playerid)
- {
- new serverIndex = GetPlayerServerIndex(playerid); // Získání indexu serveru, na který je hráč připojen
- if (serverIndex != INVALID_SERVER_INDEX)
- {
- new serverIP[24], serverName[64], playerCount;
- format(serverIP, sizeof(serverIP), "%s:%d", g_ServerData[serverIndex][0], g_ServerData[serverIndex][1]);
- format(serverName, sizeof(serverName), "%s", g_ServerData[serverIndex][2]);
- playerCount = g_ServerData[serverIndex][3];
- new gameMode[MAX_GAME_MODE_LENGTH], mapName[MAX_MAP_NAME_LENGTH];
- format(gameMode, sizeof(gameMode), "%s", g_ServerData[serverIndex][4]);
- format(mapName, sizeof(mapName), "%s", g_ServerData[serverIndex][5]);
- SendClientMessage(playerid, COLOR_WHITE, "Informace o serveru:");
- SendClientMessage(playerid, COLOR_WHITE, "IP: %s", serverIP);
- SendClientMessage(playerid, COLOR_WHITE, "Název: %s", serverName);
- SendClientMessage(playerid, COLOR_WHITE, "Hráči online: %d", playerCount);
- SendClientMessage(playerid, COLOR_WHITE, "Herní mód: %s", gameMode);
- SendClientMessage(playerid, COLOR_WHITE, "Mapa: %s", mapName);
- }
- else
- {
- SendClientMessage(playerid, COLOR_RED, "Nejste připojeni na žádný server.");
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement