ZuKi|R Posted November 24, 2017 Share Posted November 24, 2017 Have an error in server.lua Goes out me this in the console : ERROR: SistemaDeLevels/server.lua:10: attempt to perform arithmetic on global 'exp_kill' (a boolean value) Some help please ? code .. nivel_maximo = get("nivel.NivelMaximo") nivel_minimo = get("nivel.NivelInicial") exp_kill = get("nivel.ExpPorKill") exp_nivel = get("nivel.ExpParaNivel") perder_exp = get("nivel.PerderExpAlMorir") -- Valores true o false function morir ( ammo, killer, weapon, bodypart ) if ( killer ) and ( killer ~= source ) then exp_reciente = getElementData(killer, "exp") + exp_kill if exports.zombies:isPedZombie(source) then if exp_reciente >= exp_nivel then if getElementData(killer, "nivel") < nivel_maximo then setElementData(killer, "nivel", getElementData(killer, "nivel")+1) setElementData(killer, "exp", exp_reciente-exp_nivel) outputChatBox("[Sistema de Niveles]: ¡Has subido de nivel! Ahora tu nivel es:#FF0000 "..getElementData(killer, "nivel")..".", killer, 0, 255, 0, true) if getElementData(killer, "nivel") >= 50 then outputChatBox("Excelente Pasaste al Siguiente Nivel.", killer, 0, 255, 0, true) end end else setElementData(killer, "exp", exp_reciente) end end end end addEventHandler ( "onPedWasted", getRootElement(), morir ) Link to comment
Moderators IIYAMA Posted November 25, 2017 Moderators Share Posted November 25, 2017 Check if the setting is added to the meta.xml and filled in correctly. If that doesn't work, you can do something like this: (replace line 3) exp_kill = get("nivel.ExpPorKill") or 10 -- fill in a fallback value Link to comment
ZuKi|R Posted November 25, 2017 Author Share Posted November 25, 2017 16 minutes ago, IIYAMA said: Compruebe si la configuración se agrega al meta.xml y se completa correctamente. Si eso no funciona, puede hacer algo como esto: (reemplace la línea 3) In the put this configured of this way meta.xml <settings> <setting name="*NivelMaximo" value="[10000]" /> <!-- nivel maximo por defecto es 10000 --> <setting name="*NivelInicial" value="[1]" /> <!-- nivel inicial por defecto es 1 --> <setting name="*ExpPorKill" value="[100]" /> <!-- experiencia que se gana al matar, por defecto es 100 --> <setting name="*ExpParaNivel" value="[5000]" /> <!-- experiencia que se necesita para subir de nivel, por defecto es 1000 --> <setting name="*PerderExpAlMorir" value="true" /> <!-- experiencia que pierde el jugador al morir, por defecto está habilitado --> </settings> Link to comment
Moderators IIYAMA Posted November 25, 2017 Moderators Share Posted November 25, 2017 exp_kill = get("ExpPorKill") -- no need for: nivel. Unless it is used by another resource. <setting name="*ExpPorKill" value="100" /> 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