error403 ツ Posted December 9, 2018 Posted December 9, 2018 (edited) function DarExp(Jugador, cmd,Usuario,Cantidad) local CuentaJugador = getAccountName (getPlayerAccount(Jugador)) if isObjectInACLGroup ( "user." .. CuentaJugador, aclGetGroup ( "Admin" ) ) then local Nombrejugador = getPlayerFromName(Usuario) local lvl = getElementData(Nombrejugador,"Nivel") local Exp = getElementData(Nombrejugador,"Experiencia") local progresoMaximo = getElementData(Nombrejugador, "ProgresoMaximo") local setPlayerLevel = setElementData(Nombrejugador,"Experiencia",Cantidad) if Cantidad >= progresoMaximo then if Exp >= progresoMaximo then setElementData(Nombrejugador, "Nivel", level + 1) end end end end addCommandHandler("exp", DarExp) Hola a todos, tengo una duda trato de hacer un comando que me de experiencia y si la experiencia es igual al progreso maximo suba de nivel y sume la experiencia resultante. Edited December 9, 2018 by MedicenMarcos
alex17" Posted December 13, 2018 Posted December 13, 2018 function DarExp(Jugador, cmd,Usuario,Cantidad) local CuentaJugador = getAccountName (getPlayerAccount(Jugador)) if isObjectInACLGroup ( "user." .. CuentaJugador, aclGetGroup ( "Admin" ) ) then local Nombrejugador = getPlayerFromName(Usuario) local lvl = getElementData(Nombrejugador,"Nivel") local Exp = getElementData(Nombrejugador,"Experiencia") local progresoMaximo = getElementData(Nombrejugador, "ProgresoMaximo") local newexp = Exp + Cantidad setElementData(Nombrejugador,"Experiencia",newex) if newex >= progresoMaximo then setElementData(Nombrejugador, "Nivel", lvl + 1) end end end addCommandHandler("exp", DarExp)
error403 ツ Posted April 30, 2019 Author Posted April 30, 2019 (edited) On 12/12/2018 at 21:44, alex17" said: function DarExp(Jugador, cmd,Usuario,Cantidad) local CuentaJugador = getAccountName (getPlayerAccount(Jugador)) if isObjectInACLGroup ( "user." .. CuentaJugador, aclGetGroup ( "Admin" ) ) then local Nombrejugador = getPlayerFromName(Usuario) local lvl = getElementData(Nombrejugador,"Nivel") local Exp = getElementData(Nombrejugador,"Experiencia") local progresoMaximo = getElementData(Nombrejugador, "ProgresoMaximo") local newexp = Exp + Cantidad setElementData(Nombrejugador,"Experiencia",newex) if newex >= progresoMaximo then setElementData(Nombrejugador, "Nivel", lvl + 1) end end end addCommandHandler("exp", DarExp) no me funciono function Exp(user, cmd, Player, Quantity) local AccountPlayer = getAccountName(getPlayerAccount(user)) if isObjectInACLGroup("user."..AccountPlayer, aclGetGroup("Admin")) then if Player and Quantity then local Playername = getPlayerFromName(Player) if Playername then if Quantity:match("^%d+$") then local lvl = getElementData(Playername, "Level") or 1 local exp = getElementData(Playername, "Exp") or 0 local Maximumprogress = getElementData(Playername, "maximumprogress") if tonumber(exp) + tonumber(Quantity) >= Maximumprogress then setElementData(Playername, "Level", tonumber(lvl) + 1) setElementData(Playername, "Exp", 0) else setElementData(Playername, "Exp", tonumber(exp) + tonumber(Quantity)) end else outputChatBox("Quantity must be a number.", user, 255, 0, 0) end else outputChatBox("Player not found.", user, 255, 0, 0) end else outputChatBox("/exp [Player, Quantity].", user, 255, 0, 0) end else outputChatBox("You don't have rights.", user, 255, 0, 0) end end addCommandHandler("exp", Exp) Esto me lo pasaron pero no hace lo que quiero! Edited April 30, 2019 by JouninGakure
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