Jump to content

[HELP] Level System error


Recommended Posts

When the player kills the other in the following script The Following Error

ERROR: [gameplay]\scores\scores.lua : 10 attem to perform arithmetic on a boolean value

function win(ammo, killer, weapon, bodypart) 
    local H = getElementData(killer, "EXP") 
    local S = getElementData(killer, "Level") 
    local killer1 = getPlayerName(killer) 
    local noob = getPlayerName(source) 
    if killer and killer ~=source then 
    setElementData(killer, "EXP", tonumber(H)+1) 
    if tonumber(H) == 10 then 
    setElementData(killer, "Level", "Lvl 1") 
    elseif tonumber(H) == 20 then 
    setElementData(killer, "Level", "Lvl 2") 
    elseif tonumber(H) == 30 then 
    setElementData(killer, "Level", "Lvl 3") 
    elseif tonumber(H) == 40 then 
    setElementData(killer, "Level", "Lvl 4") 
    elseif tonumber(H) == 50 then 
    setElementData(killer, "Level", "Lvl 5") 
    elseif tonumber(H) == 60 then 
    setElementData(killer, "Level", "Lvl 6") 
    outputChatBox(killer1 .. "Killed " .. noob .. " and gained +1 EXP", getRootElement(), 255, 255, 0, false) 
addEventHandler( "onPlayerWasted", getRootElement(), win) 

Link to comment
  • Other Languages Moderators

lol, i saw this code almost 5 - 6 times in Scripting section.

Change this

local H = getElementData(killer, "EXP") 


local H = getElementData(killer, "EXP") or 0 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...