Advertisement
carlosdorelli

Untitled

Mar 26th, 2020
362
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.67 KB | None | 0 0
  1. //Eventos
  2. event onLoad(){
  3. database.execute("CREATE TABLE IF NOT EXISTS Niveis(
  4. Steamid VARCHAR(17) PRIMARY KEY,
  5. Nome VARCHAR(255),
  6. Tempo INT NOT NULL DEFAULT 0,
  7. Level TINYINT NOT NULL DEFAULT 0,
  8. Progresso INT NOT NULL DEFAULT 0
  9. );");
  10. }
  11.  
  12. event onPlayerJoined(player){
  13. DB = database.execute("SELECT * FROM Niveis WHERE Steamid = '" + player.id + "'");
  14. if(DB.count == 0){
  15. database.execute("INSERT INTO Niveis (Steamid, Nome) VALUES ('" + player.id + "', '" + player.name + "')");
  16. }
  17. }
  18.  
  19. event onInterval(60){
  20. foreach(player in server.players){
  21. DB = database.execute("SELECT * FROM Niveis WHERE Steamid = '" + player.id + "'");
  22. if(DB.count != 0 ){
  23. database.execute("UPDATE Niveis SET Tempo = Tempo + 1 WHERE Steamid = '" + player.id + "'");
  24. database.execute("UPDATE Niveis SET Progresso = Progresso + 1 WHERE Steamid = '" + player.id + "'");
  25. }
  26. }
  27. }
  28.  
  29. event onInterval(30){
  30. foreach(player in server.players){
  31. DB = database.execute("SELECT * FROM Niveis WHERE Steamid = '" + player.id + "'");
  32. DB = DB[0];
  33. pProgresso = DB[4];
  34. pLevel = DB[3];
  35. pProgresso = toNumber(pProgresso);
  36. if(pProgresso == 60 or pProgresso > 60){
  37. database.execute("UPDATE Niveis SET Progresso = Progresso - 60 WHERE Steamid = '" + player.id + "'");
  38. database.execute("UPDATE Niveis SET Level = Level + 1 WHERE Steamid = '" + player.id + "'");
  39. player.message("<color=#00fbff>[Nível] </color><color=#ffffff>Você upou</color><color=#00e85d> 1 nível</color><color=#ffffff> e recebeu seu salário!</color>");
  40. if(player.hasPermission("vip")){
  41. player.experience = player.experience + 800;
  42. player.message("<color=#00fbff>[Nível] </color><color=#ffffff>Você recebeu o seu </color><color=#f0e113>salário VIP</color><color=ffffff>.</color>");
  43. }
  44. player.message("<color=#00fbff>[Nível] </color><color=#ffffff>Você antes era nível </color><color=#f0e113>" + pLevel + "</color><color=#ffffff>.</color>");
  45. if(player.hasPermission("mendigo")){
  46. player.experience = player.experience + 150;
  47. }
  48. if(player.hasPermission("entregadordejornal")){
  49. player.experience = player.experience + 150;
  50. }
  51. if(player.hasPermission("entregadordepizza")){
  52. player.experience = player.experience + 150;
  53. }
  54. if(player.hasPermission("taxista")){
  55. player.experience = player.experience + 150;
  56. }
  57. if(player.hasPermission("gari")){
  58. player.experience = player.experience + 150;
  59. }
  60. if(player.hasPermission("coveiro")){
  61. player.experience = player.experience + 150;
  62. }
  63. if(player.hasPermission("fotografo")){
  64. player.experience = player.experience + 150;
  65. }
  66. if(player.hasPermission("carteiro")){
  67. player.experience = player.experience + 150;
  68. }
  69. if(player.hasPermission("lixeiro")){
  70. player.experience = player.experience + 150;
  71. }
  72. if(player.hasPermission("eletricista")){
  73. player.experience = player.experience + 150;
  74. }
  75. if(player.hasPermission("padre")){
  76. player.experience = player.experience + 150;
  77. }
  78. if(player.hasPermission("pescador")){
  79. player.experience = player.experience + 150;
  80. }
  81. if(player.hasPermission("motoristadeonibus")){
  82. player.experience = player.experience + 150;
  83. }
  84. if(player.hasPermission("fazendeiro")){
  85. player.experience = player.experience + 150;
  86. }
  87. if(player.hasPermission("minerador")){
  88. player.experience = player.experience + 150;
  89. }
  90. if(player.hasPermission("caçador")){
  91. player.experience = player.experience + 150;
  92. }
  93. if(player.hasPermission("reparadorderadares")){
  94. player.experience = player.experience + 150;
  95. }
  96. if(player.hasPermission("reparadordeturbinas")){
  97. player.experience = player.experience + 150;
  98. }
  99. if(player.hasPermission("caminhoneiro")){
  100. player.experience = player.experience + 150;
  101. }
  102. if(player.hasPermission("transportadordeconcreto")){
  103. player.experience = player.experience + 150;
  104. }
  105. if(player.hasPermission("leitero")){
  106. player.experience = player.experience + 150;
  107. }
  108. if(player.hasPermission("lenhador")){
  109. player.experience = player.experience + 150;
  110. }
  111. if(player.hasPermission("transportadordeminérios")){
  112. player.experience = player.experience + 150;
  113. }
  114. if(player.hasPermission("cientista")){
  115. player.experience = player.experience + 150;
  116. }
  117. if(player.hasPermission("piloto")){
  118. player.experience = player.experience + 150;
  119. }
  120. if(player.hasPermission("segurançadecarroforte")){
  121. player.experience = player.experience + 150;
  122. }
  123. if(player.hasPermission("motoristadecarroforte")){
  124. player.experience = player.experience + 150;
  125. }
  126. if(player.hasPermission("transportadordecombustíveis")){
  127. player.experience = player.experience + 150;
  128. }
  129. if(player.hasPermission("maquinista")){
  130. player.experience = player.experience + 150;
  131. }
  132. if(player.hasPermission("capitaonautico")){
  133. player.experience = player.experience + 150;
  134. }
  135. }
  136. }
  137. }
  138.  
  139. // Comandos
  140. command nivel(){
  141. execute(){
  142. DB = database.execute("SELECT * FROM Niveis WHERE Steamid = '" + player.id + "'");
  143. DB = DB[0];
  144. pLevel = DB[3];
  145. pTempo = DB[2];
  146. pProgresso = DB[4];
  147. player.message("Nível: " + pLevel + ".");
  148. }
  149. }
  150.  
  151. command playtime(){
  152. execute(){
  153. DB = database.execute("SELECT * FROM Niveis WHERE Steamid = '" + player.id + "'");
  154. DB = DB[0];
  155. pTempo = DB[2];
  156. player.message("Você tem " + pTempo + " minutos de jogo em nosso servidor.");
  157. }
  158. }
  159.  
  160. command up(){
  161. execute(){
  162. DB = database.execute("SELECT * FROM Niveis WHERE Steamid = '" + player.id + "'");
  163. DB = DB[0];
  164. pTempo = DB[2];
  165. pProgresso = DB[4];
  166. player.message("Você está a " + pProgresso + "% de upar.");
  167. }
  168. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement