Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Versão 1.1
- //Eventos
- event onLoad(){
- database.execute("CREATE TABLE IF NOT EXISTS yLevels(
- Steamid VARCHAR(17) PRIMARY KEY,
- Nome VARCHAR(255),
- Tempo INT NOT NULL DEFAULT 0,
- Level TINYINT NOT NULL DEFAULT 0,
- Progresso INT NOT NULL DEFAULT 0
- );");
- }
- event onPlayerJoined(player){
- DB = database.execute("SELECT * FROM yLevels WHERE Steamid = '" + player.id + "'");
- if(DB.count == 0){
- database.execute("INSERT INTO yLevels (Steamid, Nome) VALUES ('" + player.id + "', '" + player.name + "')");
- }
- }
- event onInterval(60){
- foreach(player in server.players){
- DB = database.execute("SELECT * FROM yLevels WHERE Steamid = '" + player.id + "'");
- if(DB.count != 0 ){
- database.execute("UPDATE yLevels SET Tempo = Tempo + 1 WHERE Steamid = '" + player.id + "'");
- database.execute("UPDATE yLevels SET Progresso = Progresso + 1 WHERE Steamid = '" + player.id + "'");
- }
- }
- }
- event onInterval(30){
- foreach(player in server.players){
- DB = database.execute("SELECT * FROM yLevels WHERE Steamid = '" + player.id + "'");
- DB = DB[0];
- pProgresso = DB[4];
- pLevel = DB[3];
- pProgresso = toNumber(pProgresso);
- if(pProgresso == 60 or pProgresso > 60){
- database.execute("UPDATE yLevels SET Progresso = Progresso - 60 WHERE Steamid = '" + player.id + "'");
- database.execute("UPDATE yLevels SET Level = Level + 1 WHERE Steamid = '" + player.id + "'");
- player.message("<color=#ffffff>============</color><color=#00f7ff>[Nível]</color><color=#ffffff>============</color>");
- player.message("<color=#ffffff>> Parabéns! Você acabou de upar mais um nível! Continue assim xD</color>");
- if(player.hasPermission("gari")){
- player.experience = player.experience + 200;
- player.message("<color=#ffffff>> Você recebeu seu salário de gari!</color>");
- player.message("<color=#ffffff>==============================</color>");
- }
- if(player.hasPermission("carteiro")){
- player.experience = player.experience + 400;
- player.message("<color=#ffffff>> Você recebeu seu salário de carteiro!</color>");
- player.message("<color=#ffffff>==============================</color>");
- }
- if(player.hasPermission("motoristadeonibus")){
- player.experience = player.experience + 600;
- player.message("<color=#ffffff>> Você recebeu seu salário de motorista de ônibus!</color>");
- player.message("<color=#ffffff>==============================</color>");
- }
- if(player.hasPermission("cientista")){
- player.experience = player.experience + 1800;
- player.message("<color=#ffffff>> Você recebeu seu salário de cientista!</color>");
- player.message("<color=#ffffff>==============================</color>");
- }
- }
- }
- }
- //Comandos
- command nivel(){
- permission = "nivel";
- execute(){
- DB = database.execute("SELECT * FROM yLevels WHERE Steamid = '" + player.id + "'");
- DB = DB[0];
- pLevel = DB[3];
- pTempo = DB[2];
- pProgresso = DB[4];
- player.message("<color=#ffffff>============</color><color=#00f7ff>[Nível]</color><color=#ffffff>============</color>");
- player.message("<color=#ffffff>Nível: </color><color=#ffff00>" + pLevel + "</color><color=#ffffff> | Minutos: " + pTempo + " | Progresso: " + pProgresso + "/60</color>");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement