SteezCram / extDB3

An archive repository of extDB3
Other
63 stars 35 forks source link

SQL_CUSTOM #16

Closed otherwiseGG closed 1 year ago

otherwiseGG commented 1 year ago

Hey!

I've been trying to create a Script that logs Playtime of a Player.

playerList = allPlayers;

// Define the interval in seconds between updates
interval = 10;

while {true} do
{
    // Loop through all players
    {
        // Get the player UID
        playerUID = getPlayerUID _x;

        // Get the player's current playtime
        playtime = missionTime;

        // Check if the player's data exists in the database
        "extDB3" callExtension "0:sql:checkPlayer:[playerUID]";

        // If the player's data exists in the database, update it
        if (playerDataExists) then
        {
            "extDB3" callExtension "0:sql:updatePlayerTime:[playerUID, playtime]";
        } else {
            "extDB3" callExtension "0:sql:insertPlayerTime:[playerUID, playtime]";
        }
    } forEach playerList;

    // Wait for the specified interval before updating again
    sleep interval;
};

And for this i created a sql_custom.ini

[Default]

Version = 1  
;; Used incase there is ever a breaking change, or to inform user in log about a new feature.

Strip Chars = ";[]"
;; List of characters to strip out  
Strip Chars Mode = 0
;; 0 = Strip Bad Chars, 1 = Strip + Log Bad Chars, 2 = Return Error & Log Bad Chars  
;;     Note: Logging on works when sending data to database.

Input SQF Parser = false  
;; Expermential  
;;   If enabled will use SQF Array Parser instead of : seperator for values  
;;   i.e   0:SQL:UpdatePlayer:["Joe",[1,2,0],0.22333,"PlayerBackpack",-3]  
;;   Advantage is that you don't need to strip : seperator from user inputted values  

Number of Retrys = 5  
;; Number of Retrys if Error Encountered  
;;  Note: If doing multiple SQL i.e SQL1_1 SQL2_1 etc, it will retry everything.  

[checkPlayer]
Prepared Statement = false
Strip Chars = ""
Strip Chars Mode = 0

SQL1_1 = SELECT * FROM players WHERE PlayerUID = "$CUSTOM_1$";
SQL1_INPUTS = 1-mysql_escape, 2-mysql_escape

[updatePlayerTime]
Prepared Statement = false
Strip Chars = ""
Strip Chars Mode = 0

SQL1_1 = UPDATE players SET playtime = "$CUSTOM_2$" WHERE PlayerUID = "$CUSTOM_1$";
SQL1_INPUTS = 1-mysql_escape, 2-mysql_escape

[insertPlayerTime]
Prepared Statement = false
Strip Chars = ""
Strip Chars Mode = 0

SQL1_1 = INSERT INTO players (PlayerUID, playtime) VALUES ("$CUSTOM_1$", "$CUSTOM_2$");
SQL1_INPUTS = 1-mysql_escape, 2-mysql_escape

There are no Log Errors and also the extDB3 Logs are as follows:

extDB3: https://bitbucket.org/torndeco/extdb3/wiki/Home
extDB3: Version: 1.027
extDB3: Windows Version
Message: All development for extDB3 is done on a Linux Dedicated Server
Message: If you would like to Donate to extDB3 Development
Message: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2SUEFTGABTAM2
Message: Also leave a message if there is any particular feature you would like to see added.
Message: Thanks for all the people that have donated.
Message: Torndeco: 18/05/15

extDB3: Found extdb3-conf.ini
extDB3: Detected 12 Cores, Setting up 6 Worker Threads
extDB3: ...
extDB3: ...
extDB3: ...
extDB3: ...
extDB3: ...
extDB3: ...

Is there anyone that can help me? :D

SteezCram commented 1 year ago

Hello, I can't help you with SQL custom, I'm not in Arma 3 anymore.

otherwiseGG commented 1 year ago

Hello, I can't help you with SQL custom, I'm not in Arma 3 anymore.

Thanks for your fast response - know any place i can go to by any chance?

SteezCram commented 1 year ago

Unfortunately, no 😢

147panda commented 1 year ago

Hi otherwiseGG did you add your database and database protocol and locked it ? https://github.com/SteezCram/extDB3/wiki/extDB3---System