DanilinRDF Posted October 26, 2019 Share Posted October 26, 2019 (edited) Meu sistema de level cada level precisa de mais EXP para upar e quero que upe quando atingir os 1500 EXP tem como?, Quem puder ajudar local recompensa = 100 -- quantidade= function experience () for i, p in ipairs( getElementsByType( "player" ) ) do local exp = getElementData(p, "Exp") local exps = tonumber(getElementData(p, "Exp")) local lvls = tonumber(getElementData(p, "Level")) if lvls and exps then local needexp = lvls * 150 if not exp then setElementData(p, "Level", 0) setElementData(p, "Exp", 0) else if exps >= needexp then setElementData(p, "Level", lvls + 1) setElementData(p, "Exp", 0) givePlayerMoney(p, recompensa) outputChatBox ("#106FE7( #ffffffLEVEL#106FE7 ) #FFFFFF Parabéns você passou para o level #106FE7" .. lvls + 1 .. "", p, 255, 255, 255, true) end end end end end setTimer(experience, 100, 0) function killandexp (ammo, killer, killerweapon, bodypart) local requiredXP = 1500 * (currentLevel+1) if currentXP >= requiredXP then currentLevel = currentLevel+1 end end end end addEventHandler ( "onPlayerWasted", getRootElement(), killandexp) function ChuvaXP (player) if (hasObjectPermissionTo(player, "command.kick", false)) then for id, players in ipairs(getElementsByType("player")) do local exp = getElementData(players, "Exp") local exps = tonumber(getElementData(players, "Exp")) if not exp then setElementData(players, "Exp", 0) else setElementData(players, "Exp", exps + 100) triggerClientEvent(players,"xplevel",players) end end end end addCommandHandler("chuvaxp", ChuvaXP) function ChuvaXPO (player) if (hasObjectPermissionTo(player, "general.tab_bans", false)) then outputChatBox ("#106FE7(#ffffffCHUVA XP#106FE7) ➺ #ffffff".. getPlayerName(player) .." #FFFFFFDeu #106FE7(#FFFFFFXP: #106FE7100 #106FE7) #FFFFFFPara Todos", root, 255, 255, 255, true) end end addCommandHandler("chuvaxp", ChuvaXPO) addEventHandler("onPlayerLogin", root, function(p, c) local lvl = getAccountData(c, "lvl") local exp = getAccountData(c, "exp") if lvl and exp then setElementData(source, "Level", lvl) setElementData(source, "Exp", exp) else setElementData(source, "Level", 0) setElementData(source, "Exp", 0) setAccountData(c, "exp", 0) setAccountData(c, "lvl", 0) end end) addEventHandler("onPlayerQuit", root, function() local acc = getPlayerAccount(source) if acc and not isGuestAccount(acc) then local lvl = getElementData(source, "Level") or 0 local exp = getElementData(source, "Exp") or 1 if lvl and exp then setAccountData(acc, "exp", exp) setAccountData(acc, "lvl", lvl) else setAccountData(acc, "exp", 0) setAccountData(acc, "lvl", 0) end end end) addCommandHandler("setlevel", function(player, cmd, target, amount) local accName = getAccountName(getPlayerAccount(player)) if not isObjectInACLGroup ("user."..accName, aclGetGroup("Console")) then outputChatBox("Você não tem acesso a esta equipe!", player, 255, 0, 0) return end if target then if tonumber(amount) then local targetplayer = getPlayerFromName(target) if targetplayer then setElementData(targetplayer, "Level", amount) setElementData(targetplayer, "Exp", 0) outputChatBox("Você instalou com sucesso "..amount.." nível do jogador "..getPlayerName(targetplayer).."!", player, 0, 255, 0, true) else outputChatBox("Erro: jogador não encontrado", player, 255, 0, 0) end else outputChatBox("Use: / setlevel [Nickname] [Level]", player, 255, 0, 0) end else outputChatBox("Use: / setlevel [Nickname] [Level]", player, 255, 0, 0) end end) local recompensa = 100 -- quantidade= function experience () for i, p in ipairs( getElementsByType( "player" ) ) do local exp = getElementData(p, "Exp") local exps = tonumber(getElementData(p, "Exp")) local lvls = tonumber(getElementData(p, "Level")) if lvls and exps then local needexp = lvls * 150 if not exp then setElementData(p, "Level", 0) setElementData(p, "Exp", 0) else if exps >= needexp then setElementData(p, "Level", lvls + 1) setElementData(p, "Exp", 0) givePlayerMoney(p, recompensa) outputChatBox ("#106FE7( #ffffffLEVEL#106FE7 ) #FFFFFF Parabéns você passou para o level #106FE7" .. lvls + 1 .. "", p, 255, 255, 255, true) end end end end end setTimer(experience, 100, 0) function killandexp (ammo, killer, killerweapon, bodypart) local requiredXP = 1500 * (currentLevel+1) if currentXP >= requiredXP then currentLevel = currentLevel+1 end end end end addEventHandler ( "onPlayerWasted", getRootElement(), killandexp) function ChuvaXP (player) if (hasObjectPermissionTo(player, "command.kick", false)) then for id, players in ipairs(getElementsByType("player")) do local exp = getElementData(players, "Exp") local exps = tonumber(getElementData(players, "Exp")) if not exp then setElementData(players, "Exp", 0) else setElementData(players, "Exp", exps + 100) triggerClientEvent(players,"xplevel",players) end end end end addCommandHandler("chuvaxp", ChuvaXP) function ChuvaXPO (player) if (hasObjectPermissionTo(player, "general.tab_bans", false)) then outputChatBox ("#106FE7(#ffffffCHUVA XP#106FE7) ➺ #ffffff".. getPlayerName(player) .." #FFFFFFDeu #106FE7(#FFFFFFXP: #106FE7100 #106FE7) #FFFFFFPara Todos", root, 255, 255, 255, true) end end addCommandHandler("chuvaxp", ChuvaXPO) addEventHandler("onPlayerLogin", root, function(p, c) local lvl = getAccountData(c, "lvl") local exp = getAccountData(c, "exp") if lvl and exp then setElementData(source, "Level", lvl) setElementData(source, "Exp", exp) else setElementData(source, "Level", 0) setElementData(source, "Exp", 0) setAccountData(c, "exp", 0) setAccountData(c, "lvl", 0) end end) addEventHandler("onPlayerQuit", root, function() local acc = getPlayerAccount(source) if acc and not isGuestAccount(acc) then local lvl = getElementData(source, "Level") or 0 local exp = getElementData(source, "Exp") or 1 if lvl and exp then setAccountData(acc, "exp", exp) setAccountData(acc, "lvl", lvl) else setAccountData(acc, "exp", 0) setAccountData(acc, "lvl", 0) end end end) addCommandHandler("setlevel", function(player, cmd, target, amount) local accName = getAccountName(getPlayerAccount(player)) if not isObjectInACLGroup ("user."..accName, aclGetGroup("Console")) then outputChatBox("Você não tem acesso a esta equipe!", player, 255, 0, 0) return end if target then if tonumber(amount) then local targetplayer = getPlayerFromName(target) if targetplayer then setElementData(targetplayer, "Level", amount) setElementData(targetplayer, "Exp", 0) outputChatBox("Você instalou com sucesso "..amount.." nível do jogador "..getPlayerName(targetplayer).."!", player, 0, 255, 0, true) else outputChatBox("Erro: jogador não encontrado", player, 255, 0, 0) end else outputChatBox("Use: / setlevel [Nickname] [Level]", player, 255, 0, 0) end else outputChatBox("Use: / setlevel [Nickname] [Level]", player, 255, 0, 0) end end) Edited October 26, 2019 by DanilinRDF Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now