Is MySQL even possible on 1.12.2 spigot?

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Hypenexy

New Member
Jan 23, 2020
7
1
3
28
I've been looking for 2 years, but, as the title says, I still can't find a way to use MySQL with SkQuery.
 
I've been looking for 2 years, but, as the title says, I still can't find a way to use MySQL with SkQuery.
I made this example in less than 3 minutes, but I think this will work

Code:
script options:
    $ init com.mysql.jdbc.Driver
    $ db url jdbc:mysql://localhost:3306/yourdatabase
    $ db username youruser # default is 'root'
    $ db password yourpssword

on load:
    # create a table
    update "CREATE TABLE IF NOT EXISTS yourtable(playername varchar(16), uuid varchar(36), joined varchar(100), kills int, deaths int"
    stop

on first join:
    # add player's info
    update "INSERT INTO `yourtable` (`playername`, `uuid`, `joined`, `kills`, `deaths`) VALUES ('%player%', '%player's uuid%', '%now%', '0', '0')"
    stop

on death of a player:
    set death message to ""
    if attacker is a player:
        broadcast "&a%attacker% killed &c%player%&7."
        #
        #    get 'attacker's kills' and 'player's deaths values from table
        #
        set {_kills%attacker%::*} to objects in column "kills" from result of query "SELECT * FROM yourtable WHERE uuid = '%attacker's uuid%'" and close
        set {_deaths%player%::*} to objects in column "deaths" from result of query "SELECT * FROM yourtable WHERE uuid = '%player's uuid%'" and close
    
        set {_kills.%attacker%} to "%{_kills%attacker%::*}%" parsed as integer
        set {_deaths.%player%} to "%{_deaths%player%::*}%" parsed as integer

        #
        #    update 'attacker's kills' and 'player's deaths' into database
        #
        update "UPDATE `yourtable` SET `kills` = '%{_kills.%attacker%} +1%' WHERE `uuid` = '%attacker's uuid%'"
        update "UPDATE `yourtable` SET `kills` = '%{_deaths.%player%} +1%' WHERE `uuid` = '%player's uuid%'"
        stop
    else:
        broadcast "&c%player% &7died."
       # get 'player's kills' from databse and update
        set {_deaths%player%::*} to objects in column "deaths" from result of query "SELECT * FROM yourtable WHERE uuid = '%player's uuid%'" and close
        set {_deaths.%player%} to "%{_deaths%player%::*}%" parsed as integer
        update "UPDATE `yourtable` SET `kills` = '%{_deaths.%player%} +1%' WHERE `uuid` = '%player's uuid%'"
        stop

command /statistics [<offlineplayer>] [<text>]:
    trigger:
        if arg-1 is set:
            if arg-1 is online:
                if arg-2 is not set:
                    set {_kills%arg-1%::*} to objects in column "kills" from result of query "SELECT * FROM stats WHERE uuid = '%arg-1's uuid%'" and close
                    set {_deaths%arg-1%::*} to objects in column "deaths" from result of query "SELECT * FROM stats WHERE uuid = '%arg-1's uuid%'" and close
                    send "----------------------"
                    send "&6%arg-1%&7's statistics"
                    send "&7• &aKills: &f%{_kills%arg-1%::*}%"
                    send "&7• &cDeaths: &f%{_deaths%arg-1%::*}%"
                    send "----------------------"
                    stop
                else:
                    send "Unknown command."
            else:
                send "&cNo player matching &e%arg-1% &cis connected to this server."
        else:
            send "&cUsage: /statistics <player>"
 
Last edited:
  • Like
Reactions: Hypenexy
Ok, so. I've tried similar skripts but for some reason I also get this console error but no skript reload errors. Any ideas how to fix that? I've read through forums but couldn't find anything.
upload_2020-6-23_13-21-34.png


Edit:
https://imgur.com/a/ipkbGhL
Here's the rest but it didn't let me upload.
 
Ok, so. I've tried similar skripts but for some reason I also get this console error but no skript reload errors. Any ideas how to fix that? I've read through forums but couldn't find anything.View attachment 4904

Edit:
https://imgur.com/a/ipkbGhL
Here's the rest but it didn't let me upload.
why u didn't tried my example? try using the lastest version of skquery and also, which skript version are u using? or send me the code
 
Last edited:
I tried your example. I am using SkQuery-4.1.2 and the newest Skript 2.5-alpha3.
Aaand the code is the one you sent.
 
Yeah, I have the same issuse. I think the plugin is bugged. For me the intergrated mysql thingy in skript doesnt work. Also Skript-DB and skellett nothing work. Also i get the same syntax thing as the problem.
 
idk what to say, skript-db doesnt works at all and doesnt have support, skript mysql works but it only save variables, you cannot create tables, rows in it and I got the same problem with skquery but I tried reinstalling and now works without problems
[doublepost=1593292319,1593292205][/doublepost]
Yeah, I have the same issuse. I think the plugin is bugged. For me the intergrated mysql thingy in skript doesnt work. Also Skript-DB and skellett nothing work. Also i get the same syntax thing as the problem.
yo wait, what are u using for database? im using xampp, be sure if your password section isnt empty cuz all databases has no password by default
 
So, in conclusion it's not possible.
as u can see, there's a problem with credentials, so its possible, as I said, i had te sa,me problem before and I tried installing it in a new test server and then works
also, im running with paperspigot, I dont really know if this makes a difference but ok
 
  • Like
Reactions: Hypenexy
I haven't checked the forums in a while and if you're saying it works on clean 1.12.2 server then it must be some addon we both use that interferes with the credentials! Edit: Could you please tell me what plugins and version you were using so I can try it as well? Edit 2: Can we take this conversation to Discord or PMs?
 
Last edited:
Status
Not open for further replies.