Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.15 KB | None | 0 0
  1. #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  2. #MySQL Options
  3. on script load:
  4. set {sql::SkQuerySQLforAlgorithm} to the database "mysql://localhost:3306/rainbow?username=root&password=adminchange&useSSL=false"
  5. #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  6. on load:
  7. execute "CREATE TABLE IF NOT EXISTS `info` (`uuid` varchar(255), `rank` varchar(10))" in {sql::SkQuerySQLforAlgorithm}
  8.  
  9. on join:
  10. execute "SELECT `rank` FROM `rainbow`.`info` WHERE uuid = %player's uuid%" in {sql::SkQuerySQLforAlgorithm} and store the result in {_sqlOutput::*}
  11. set {_checkIfNone::*} to {_sqlOutput::rank::*}
  12. if "%{_checkIfNone::*}%" is "<none>":
  13. execute "INSERT INTO info (`uuid`, `rank`) VALUES (%player's uuid%, 'default')" in {sql::SkQuerySQLforAlgorithm}
  14. send "&7You're a new player! Giving you the default rank!" to player
  15. else:
  16. execute "UPDATE `info` SET `rank` = 'default' WHERE uuid = %player's UUID%" in {sql::SkQuerySQLforAlgorithm}
  17. send "&7You're not a new player! Giving you the default rank, so Andrew knows all of the SQL queries. xD" to player
  18.  
  19. on quit:
  20. execute "DELETE FROM `info` WHERE `uuid` = %player's UUID% AND `rank` = 'default'" in {sql::SkQuerySQLforAlgorithm}
  21. broadcast "&7Yea boi!!!!!!!! DELETED rank data from database to save data!! Just kidding, delted it so Andrew knows all of the SQL queries. xD"
  22.  
  23. command /tell [<offline player>] [<string>]:
  24. trigger:
  25. if arg 1 is online:
  26. if arg 1 is player:
  27. send "&9Sorry, you can't message yourself."
  28. stop
  29. else:
  30. execute "SELECT `rank` FROM `rainbow`.`info` WHERE uuid = %player's uuid%" in {sql::SkQuerySQLforAlgorithm} and store the result in {_sqlOutput::*}
  31. set {_rank::*} to {_sqlOutput::rank::*}
  32. execute "SELECT `rank` FROM `rainbow`.`info` WHERE uuid = %arg-1's uuid%" in {sql::SkQuerySQLforAlgorithm} and store the result in {_sqlOutput::*}
  33. set {_rankTwo::*} to {_sqlOutput::rank::*}
  34. send "%{_rank::*}% %player% -> %arg-2%" to arg-1
  35. send "%{_rank::*}% %player% -> %arg-2%" to player
  36. else:
  37. send "&9Sorry, they're offline."
  38.  
  39. #UPDATE
  40. #Multiple checks SQL
  41. on chat:
  42. cancel event
  43. execute "SELECT `rank` FROM `rainbow`.`info` WHERE uuid = %player's uuid% AND username = %player%" in {sql::SkQuerySQLforAlgorithm} and store the result in {_sqlOutput::*}
  44. set {_checkIfNone::*} to {_sqlOutput::rank::*}
  45. if "%{_checkIfNone::*}%" is not "<none>":
  46. broadcast "%{_checkIfNone::1}% %player% %message%"
  47. else:
  48. send "Eh you might have to rejoin so we can get the data."
  49. #----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement