title: LUA ERROR attempt to perform arithmetic on boolean value
body: <pre><code>  ```  local xpNeed = 100; -- E.g. 100 * lvl = XP you need to rank up!
      addEvent("onPlayerLevelUp", true);
  
      function addPlayerXp(player, xp)
          local acc = getPlayerAccount(player);
          local oldexp = getAccountData(acc, "exp") or 0;
          local oldlvl = getAccountData(acc, "lvl") or 1;
          local newlevel = oldlvl + 1;
          local newexp = oldexp + xp;
          lvl = getAccountData(acc, "lvl") or 0;
          if getElementData(player,'lvl') &gt; 9 then return end
          setAccountData(acc, "exp", newexp);
          setElementData(player, "exp", newexp); 
          --if getAccountData(acc,'lvl') &gt; 9 then return end
              if (newexp &gt;= (oldlvl * xpNeed)) then
              local expleft = newexp - (oldlvl * xpNeed); -- added calculation for the exp that may remains after level up.
              outputChatBox("[Level-Up] Congratulations! New level "..newlevel.."!", player, 66, 134, 244);
              setAccountData(acc, "lvl", newlevel);
              setAccountData(acc, "exp", expleft);
              setElementData(player, "exp", expleft);
              setElementData(player, "lvl", newlevel);
              triggerEvent("onPlayerLevelUp", player, newlevel, oldlvl, oldexp, newexp);
          end
      end
      addEventHandler("onPlayerLogin", root, function()
          local acc = getPlayerAccount(source);
          if acc then
              setElementData(source, "lvl", getAccountData(acc, "lvl") or 0);
              setElementData(source, "exp", getAccountData(acc, "exp") or 0);
          end
      end);
  
      addEventHandler("onZombieGetsKilled", root, function(killer)
          if killer and getElementType(killer) == "player" then
              addPlayerXp(killer, 50);
          end
      end);
  
      addEventHandler("kilLDayZPlayer", root, function(killer)
          if (killer and killer ~= source and getElementType(killer) == "player") then
              addPlayerXp(killer, 50);
          end
      end);
  
      --[[
      addEventHandler("onPlayerSpawn", root, function(newlvl)
          if newlvl then
          if (lvl) &gt;= 1 then
                  setElementData(player, "MP5A5", 1)
              elseif lvl &gt;= 2 then
                  setElementData(player, "Tent", 1)
              elseif lvl &gt;= 3 then
                  setElementData(player, "Milk", 1)
              elseif lvl &gt;= 4 then
                  setElementData(player, "Medic Kit", 1)
              elseif lvl &gt;= 5 then
                  setElementData(player, "Shovel", 1)
              end
          end
      end);
  
      ]]
  
      table = {"Milk","MP5A5","M4A1-S","AK-47","Soda Bottle","Pizza","AS50","Tent","Medium Tent","ACR","AR-15","M107","Pasta Can","Beans Can","Golf Club"}
  
      addEventHandler("onPlayerSpawn", root, function(lvl)
          if not lvl then lvl = getElementData(player, "lvl") or 0; end
          if lvl &gt;= 1 then
              for i = 1, lvl do
                  setElementData(player, table[i], getElementData(player, table[i]) + 1);
              end
          end
      end);
  ```
  </code></pre>
  
  <p>Hello, this is my first post here, so i'd like to say hello.  So, as a beginner programmer, i am trying to implement a level system for my mta server, but, i've met an obstacle as stated in the title. Where's this boolean value? How could i make it work? I'm sorry if this question seems trivial (as it surely does), but i really want to move forward. Any help will be appreciated  Thanks in advance!</p>
  
  <p>error is in  setElementData(player, table[i], getElementData(player, table[i]) + 1);  what can i do to make it work any help will be appreciated </p>
  
  <p>ERROR LINE 70 
  attempt to perform arithmetic on boolean value
  AND WARRNING SAME LINE </p>
  
  <p>Bad argument @ getElementData [ Expected element at argument 1, got nil ]</p>