Advertisement
carlosdorelli

ylevels

Jun 16th, 2020
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. //Versão 1.1
  2.  
  3. //Eventos
  4.  
  5. event onLoad(){
  6. database.execute("CREATE TABLE IF NOT EXISTS yLevels(
  7. Steamid VARCHAR(17) PRIMARY KEY,
  8. Nome VARCHAR(255),
  9. Tempo INT NOT NULL DEFAULT 0,
  10. Level TINYINT NOT NULL DEFAULT 0,
  11. Progresso INT NOT NULL DEFAULT 0
  12. );");
  13. }
  14.  
  15. event onPlayerJoined(player){
  16. DB = database.execute("SELECT * FROM yLevels WHERE Steamid = '" + player.id + "'");
  17. if(DB.count == 0){
  18. database.execute("INSERT INTO yLevels (Steamid, Nome) VALUES ('" + player.id + "', '" + player.name + "')");
  19. }
  20. }
  21.  
  22. event onInterval(60){
  23. foreach(player in server.players){
  24. DB = database.execute("SELECT * FROM yLevels WHERE Steamid = '" + player.id + "'");
  25. if(DB.count != 0 ){
  26. database.execute("UPDATE yLevels SET Tempo = Tempo + 1 WHERE Steamid = '" + player.id + "'");
  27. database.execute("UPDATE yLevels SET Progresso = Progresso + 1 WHERE Steamid = '" + player.id + "'");
  28. }
  29. }
  30. }
  31.  
  32. event onInterval(30){
  33. foreach(player in server.players){
  34. DB = database.execute("SELECT * FROM yLevels WHERE Steamid = '" + player.id + "'");
  35. DB = DB[0];
  36. pProgresso = DB[4];
  37. pLevel = DB[3];
  38. pProgresso = toNumber(pProgresso);
  39. if(pProgresso == 60 or pProgresso > 60){
  40. database.execute("UPDATE yLevels SET Progresso = Progresso - 60 WHERE Steamid = '" + player.id + "'");
  41. database.execute("UPDATE yLevels SET Level = Level + 1 WHERE Steamid = '" + player.id + "'");
  42. player.message("<color=#ffffff>============</color><color=#00f7ff>[Nível]</color><color=#ffffff>============</color>");
  43. player.message("<color=#ffffff>> Parabéns! Você acabou de upar mais um nível! Continue assim xD</color>");
  44. if(player.hasPermission("gari")){
  45. player.experience = player.experience + 200;
  46. player.message("<color=#ffffff>> Você recebeu seu salário de gari!</color>");
  47. player.message("<color=#ffffff>==============================</color>");
  48. }
  49. if(player.hasPermission("carteiro")){
  50. player.experience = player.experience + 400;
  51. player.message("<color=#ffffff>> Você recebeu seu salário de carteiro!</color>");
  52. player.message("<color=#ffffff>==============================</color>");
  53. }
  54. if(player.hasPermission("motoristadeonibus")){
  55. player.experience = player.experience + 600;
  56. player.message("<color=#ffffff>> Você recebeu seu salário de motorista de ônibus!</color>");
  57. player.message("<color=#ffffff>==============================</color>");
  58. }
  59. if(player.hasPermission("cientista")){
  60. player.experience = player.experience + 1800;
  61. player.message("<color=#ffffff>> Você recebeu seu salário de cientista!</color>");
  62. player.message("<color=#ffffff>==============================</color>");
  63. }
  64. }
  65. }
  66. }
  67.  
  68. //Comandos
  69. command nivel(){
  70. permission = "nivel";
  71. execute(){
  72. DB = database.execute("SELECT * FROM yLevels WHERE Steamid = '" + player.id + "'");
  73. DB = DB[0];
  74. pLevel = DB[3];
  75. pTempo = DB[2];
  76. pProgresso = DB[4];
  77. player.message("<color=#ffffff>============</color><color=#00f7ff>[Nível]</color><color=#ffffff>============</color>");
  78. player.message("<color=#ffffff>Nível: </color><color=#ffff00>" + pLevel + "</color><color=#ffffff> | Minutos: " + pTempo + " | Progresso: " + pProgresso + "/60</color>");
  79. }
  80. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement