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!
You can always check out skUnity Downloads for downloads and any other information about Skript!
I made this example in less than 3 minutes, but I think this will workI've been looking for 2 years, but, as the title says, I still can't find a way to use MySQL with SkQuery.
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>"
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 codeOk, 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.
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 defaultYeah, 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.
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 worksSo, in conclusion it's not possible.