Advertisement
Guest User

.

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