Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.89 KB | None | 0 0
  1. #-----------------
  2. # Auteur : cercus
  3. # Version : 1.0
  4. # Description : Skript de coins pour tout le serveur AdventSky
  5. #-----------------
  6.  
  7. # MODIFIER LA DATABASE
  8.  
  9. script options:
  10. $ db url jdbc:mysql://localhost:3306/<db_name>
  11. $ db username <username>
  12. $ db password <mdp>
  13.  
  14. options:
  15. refresh: 300
  16. table_prefix: Coins_
  17.  
  18. On load:
  19. if {Stats-Reloader} is set:
  20. set {_period} to difference between {Stats-Reload-sec} and now
  21. send "&3Coins &9» &7Le skript a été rechargé en &a%{_period}%" to {Stats-Reloader}
  22. clear {Stats-Reloader}
  23.  
  24. On skript load:
  25. update "CREATE TABLE IF NOT EXISTS '{@table_prefix}Player' ('Player' varchar(255),'Coins' varchar(255))"
  26. send "&2&l[&a&lCoins&2&l] &eLA database a été update" to player
  27.  
  28. On join:
  29. if {firstjoin-%player%} is not set:
  30. set {coins.%player%} to 0
  31. add player to {coinslistplayer::*}
  32. set {firstjoin-%player%} to "%now%"
  33. update "INSERT INTO '{@table_prefix}Player' ('Player', 'Coins', 'FirstJoin') VALUES ('%player%', '0','%now%',)"
  34.  
  35. command /coins [<text>] [<offline player>] [<integer>]:
  36. trigger:
  37. if arg-1 is "help":
  38. send "&3&l=&9&l=&3&l=&9&l=&3&l=&9&l= &2&l[&a&lCoins&2&l] &3&l=&9&l=&3&l=&9&l=&3&l=&9&l=" to player
  39. send "" to player
  40. send "&9/coins help : &7Affiche les commandes disponibles" to player
  41. send "&9/coins view <player> : &7Affiche le nombre de coins du joueur" to player
  42. if player has permission "coins.admin":
  43. send "&9/coins add <player> <nombre> : &7Ajouter des coins au joueur" to player
  44. send "&9/coins remove <player> <nombre> : &7Enlever des coins au joueur" to player
  45. send "&9/coins set <player> <nombre> : &7Mettre un nombre defini de coins au joueur" to player
  46. send "&9/coins purge : &7Purge la DB et reset les variables" to player
  47. send "&9/coins sync : &7Synchronise les coins avec la database" to player
  48. send "&9/coins reload : &7Reload le skript de coins" to player
  49.  
  50. if arg-1 is "view":
  51. if arg-2 is not online:
  52. send "&2&l[&a&lCoins&2&l] &cCe joueur n'est pas en ligne" to player
  53. if arg-2 is online:
  54. send "&2&l[&a&lCoins&2&l] &aNombre de coins de %arg-2% : %{coins.%arg-2%}% coins" to player
  55.  
  56. if arg-1 is "reload":
  57. set {Stats-Reload-sec} to now
  58. set {Stats-Reloader} to player
  59. make console execute command "/skript reload Coins.sk"
  60.  
  61. if arg-1 is "purge":
  62. if player has permission "coins.admin":
  63. loop {coinslistplayer::*}:
  64. set {coins.%loop-value%} to 0
  65. update "TRUNCATE TABLE '{@table_prefix}Player'"
  66.  
  67. if arg-1 is "sync":
  68. if player has permission "coins.admin":
  69. loop all players:
  70. update "UPDATE '{@table_prefix}Player' SET '{@table_prefix}Player'.'Coins' = 'Coins'+%{coins.%loop-player%}% WHERE '{@table_prefix}Player'.'Player' = '%loop-player%'"
  71. send "&2&l[&a&lCoins&2&l] &eLa DB a été synchronisé avec les variables" to player
  72.  
  73. if arg-1 is "add":
  74. if arg-2 is not online:
  75. send "&2&l[&a&lCoins&2&l] &cCe joueur n'est pas en ligne" to player
  76. if arg-2 is online:
  77. if arg-3 is set:
  78. if player has permission "coins.admin":
  79. add arg-3 to {coins.%arg-2%}
  80. update "UPDATE '{@table_prefix}Player' SET '{@table_prefix}Player'.'Coins' = 'Coins'+%{coins.%arg-2%}% WHERE '{@table_prefix}Player'.'Player' = '%arg-2%'"
  81. send "&2&l[&a&lCoins&2&l] &eVous avez ajouté %arg-3% à %arg-2% : Il a maintenant %{coins.%arg-2%}%"
  82. else:
  83. send "&2&l[&a&lCoins&2&l] &cVous n'avez pas la permission" to player
  84.  
  85. if arg-1 is "remove":
  86. if arg-2 is not online:
  87. send "&2&l[&a&lCoins&2&l] &cCe joueur n'est pas en ligne" to player
  88. if arg-2 is online:
  89. if arg-3 is set:
  90. if player has permission "coins.admin":
  91. remove arg-3 from {coins.%arg-2%}
  92. update "UPDATE '{@table_prefix}Player' SET '{@table_prefix}Player'.'Coins' = 'Coins'+%{coins.%arg-2%}% WHERE '{@table_prefix}Player'.'Player' = '%arg-2%'"
  93. send "&2&l[&a&lCoins&2&l] &eVous avez enlevé %arg-3% à %arg-2% : Il a maintenant %{coins.%arg-2%}%"
  94. else:
  95. send "&2&l[&a&lCoins&2&l] &cVous n'avez pas la permission" to player
  96.  
  97. if arg-1 is "set":
  98. if arg-2 is not online:
  99. send "&2&l[&a&lCoins&2&l] &cCe joueur n'est pas en ligne" to player
  100. if arg-2 is online:
  101. if arg-3 is set:
  102. if player has permission "coins.admin":
  103. set arg-3 to {coins.%arg-2%}
  104. update "UPDATE '{@table_prefix}Player' SET '{@table_prefix}Player'.'Coins' = 'Coins'+%{coins.%arg-2%}% WHERE '{@table_prefix}Player'.'Player' = '%arg-2%'"
  105. send "&2&l[&a&lCoins&2&l] &eVous avez set %arg-3% à %arg-2% : Il a maintenant %{coins.%arg-2%}%"
  106. else:
  107. send "&2&l[&a&lCoins&2&l] &cVous n'avez pas la permission" to player
  108.  
  109. every {@refresh} seconds:
  110. loop all players:
  111. update "UPDATE '{@table_prefix}Player' SET '{@table_prefix}Player'.'Coins' = 'Deaths'+%{deaths-%loop-player%}% WHERE '{@table_prefix}Player'.'Player' = '%loop-player%'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement