1. Dashboard
  2. Forum
    1. Unerledigte Themen
  3. Downloads
  4. Galerie
    1. Alben
  5. Toolbox
    1. Passwort Generator
    2. Portchecker
  6. Mitglieder
    1. Mitgliedersuche
    2. Benutzer online
    3. Trophäen
    4. Team
Sa: 31 Mai 2025
  • Anmelden oder registrieren
  • Suche
Dieses Thema
  • Alles
  • Dieses Thema
  • Dieses Forum
  • Artikel
  • Forum
  • Dateien
  • Seiten
  • Bilder
  • Erweiterte Suche

Schön, dass du den Weg zu NodeZone.net gefunden hast! Aktuell bist du nicht angemeldet und kannst deshalb nur eingeschränkt auf unsere Community zugreifen. Um alle Funktionen freizuschalten, spannende Inhalte zu entdecken und dich aktiv einzubringen, registriere dich jetzt kostenlos oder melde dich mit deinem Account an.

Anmelden oder registrieren
    1. Nodezone.net Community
    2. Forum
    3. Gameserver & Hosting
    4. ArmA Series - ArmA 3 / Reforger
    5. Hilfeforum

    How to read the database contents on the server

      • Altis Life
    • apple123
    • 11. Februar 2020 um 23:03
    • Erledigt
    • apple123
      Anfänger
      Reaktionen
      4
      Trophäen
      6
      Beiträge
      65
      • 11. Februar 2020 um 23:03
      • #1

      I want to implement a script so that when a new player enters the game as a civilian, he must have the player's UID in a specific table in the database. Otherwise, the task ends. This is my script.

      Code: fn_initciv.sqf
      private _uid = getPlayerUID player;
      if !(_uid in _whitelist)then{
      ["NotWhitelisted",false,true] call BIS_fnc_endMission;
      };
      [_whitelist] remoteExec ["DB_fnc_whitelist", 2];
      Code: pwhitelist.sql
      CREATE TABLE `pwhitelist` (
       `playerUID` VARCHAR(32) NULL DEFAULT NULL,
       `reason` VARCHAR(17) NULL DEFAULT NULL,
       PRIMARY KEY (`playerUID`)
      )
      COLLATE='utf8mb4_general_ci'
      ENGINE=InnoDB
      AUTO_INCREMENT=1
      ;
      Code: whitelist.sqf
      //life_server
      params [
      ["_whitelist","",[""]],
      ["_reason","",[""]]
      ];

      I don't know how to write next, so that I can add player UID to the database before players can play. This is similar to a whitelisting system, any help would be greatly appreciated!:D:D:D

    • LETUS
      Schüler
      Reaktionen
      15
      Trophäen
      9
      Beiträge
      110
      Bilder
      1
      • 12. Februar 2020 um 08:55
      • #2

      Hey,

      take a look at the fn_queryRequest.sqf:

      https://github.com/AsYetUntitled/…ueryRequest.sqf

      In these lines(31) you see the creation of the sql request:

      Code
      format ["SELECT pid, name, cash, bankacc, adminlevel, donorlevel, civ_licenses, arrested, civ_gear, civ_stats, civ_alive, civ_position, playtime FROM players WHERE pid='%1'",_uid];


      and here you send the query to the DB. For more informations about this, take a look at the header of the asyncCall function.

      Code
      _queryResult = [_query,2] call DB_fnc_asyncCall;

      In "_queryResult" you can find the result from the database.

    • apple123
      Anfänger
      Reaktionen
      4
      Trophäen
      6
      Beiträge
      65
      • 12. Februar 2020 um 12:41
      • #3
      Zitat von LETUS

      Hey,

      take a look at the fn_queryRequest.sqf:

      https://github.com/AsYetUntitled/…ueryRequest.sqf

      In these lines(31) you see the creation of the sql request:

      Code
      format ["SELECT pid, name, cash, bankacc, adminlevel, donorlevel, civ_licenses, arrested, civ_gear, civ_stats, civ_alive, civ_position, playtime FROM players WHERE pid='%1'",_uid];


      and here you send the query to the DB. For more informations about this, take a look at the header of the asyncCall function.

      Code
      _queryResult = [_query,2] call DB_fnc_asyncCall;

      In "_queryResult" you can find the result from the database.

      Alles anzeigen

      i know that,but I don't know how to make the server read the player uid so that whitelist is equal to the player uid in the database and runs at the same time as the server.

    • LETUS
      Schüler
      Reaktionen
      15
      Trophäen
      9
      Beiträge
      110
      Bilder
      1
      • 12. Februar 2020 um 13:08
      • #4

      OK,

      so, a way is to add the player over an webinterface or an extra programm. You need an html form with an little bit of php at the backend take an look here:

      https://www.w3schools.com/php/php_forms.asp and here https://www.cloudways.com/blog/connect-mysql-with-php/ you can also find a loot of tutorials an youtube. Also take a look at security that you can prevent an SQL Injection, you can also find a lot of tutorials on the internet.

      You can also do it from ingame. But isnt that good because you need to join on the server every time you would like to whitlist someone.

    • apple123
      Anfänger
      Reaktionen
      4
      Trophäen
      6
      Beiträge
      65
      • 12. Februar 2020 um 13:27
      • #5
      Zitat von LETUS

      OK,

      so, a way is to add the player over an webinterface or an extra programm. You need an html form with an little bit of php at the backend take an look here:

      https://www.w3schools.com/php/php_forms.asp and here https://www.cloudways.com/blog/connect-mysql-with-php/ you can also find a loot of tutorials an youtube. Also take a look at security that you can prevent an SQL Injection, you can also find a lot of tutorials on the internet.

      You can also do it from ingame. But isnt that good because you need to join on the server every time you would like to whitlist someone.

      Sorry, you misunderstood me. I have created a new table "pwhitelist" in the database table. My idea is that only when I add the player's uid - "player uid", can the server read it, and then the client remoteexec arrives, the player can enter the game.

    • LETUS
      Schüler
      Reaktionen
      15
      Trophäen
      9
      Beiträge
      110
      Bilder
      1
      • 12. Februar 2020 um 13:43
      • #6

      Yeah, like in my first answer. You read the data from the database. When the response is empty, in extDB it lokes like this i think: [1, []] you can pass an error to the client and kick him from the Server.

      When you get any data(expect you got an error then you got no 1 at the first place) in the array( [1, ["My Player ID"]] the user is in the database so you can pass an success to the client over remoteExec.

    Registrieren oder Einloggen

    Du bist noch kein Mitglied von NodeZone.net? Registriere dich kostenlos und werde Teil einer großartigen Community!

    Registrieren

    Tags

    • AltisLife 5.0

    Benutzer online in diesem Thema

    • 2 Besucher

    Wichtige Links & Informationen

    Server & Hosting-Ressourcen

      Server Administration & Hosting Basics

      Windows Server Support & Guides

      Linux Server Configuration & Help

      Setting up TeamSpeak 3 & VoIP Servers

      Domains & Web Hosting for Beginners & Professionals

      Cloud Hosting, Docker & Kubernetes Tutorials

    Gameserver & Modding-Ressourcen

      ArmA 3 Tutorials & Script Collection

      Renting & Operating Gameservers

      DayZ Server Management & Help

      FiveM (GTA V) Server & Script Development

      Rust Server Modding & Administration

      Setting up & Optimizing ARK Survival Servers

    NodeZone.net – Deine Community für Gameserver, Server-Hosting & Modding

      NodeZone.net ist dein Forum für Gameserver-Hosting, Rootserver, vServer, Webhosting und Modding. Seit 2015 bietet unsere Community eine zentrale Anlaufstelle für Server-Admins, Gamer und Technikbegeisterte, die sich über Server-Management, Hosting-Lösungen und Spielemodding austauschen möchten.


      Ob Anleitungen für eigene Gameserver, Hilfe bei Root- und vServer-Konfigurationen oder Tipps zu Modding & Scripting – bei uns findest du fundiertes Wissen und praxisnahe Tutorials. Mit einer stetig wachsenden Community findest du hier Antworten auf deine Fragen, Projektpartner und Gleichgesinnte für deine Gaming- und Serverprojekte. Schließe dich NodeZone.net an und werde Teil einer aktiven Community rund um Server-Hosting, Gameserver-Management und Modding-Ressourcen.

    Wer jetzt nicht teilt ist selber Schuld:
    1. Nutzungsbestimmungen
    2. Datenschutzerklärung
    3. Impressum
    4. Urheberrechts- oder Lizenzverstoß melden
  • Trimax Design coded & layout by Gino Zantarelli 2023-2025©
    Community-Software: WoltLab Suite™