Jump to content

[HELP] Compare boolean with number


Recommended Posts

Hello, I made this set wanted level function but I keep getting the error "Attempt to compare boolean with number".

function setPlayerWanted(thePlayer, cmd, who, amountWanted) 
    if isPlayerOwner(thePlayer) or isPlayerSuperMod(thePlayer) then  
        if not (who) then 
            outputChatBox("SYNTAXA: /"..cmd.." [Name] [Wanted]", thePlayer, 255, 255, 0) 
        else 
            local amountWanted = tonumber(amountWanted) 
            local player = exports["(wG)Tools"]:findPlayer(who) 
            if not amountWanted < 7 and not amountWanted > -1 then 
                return 
            else 
                setElementData(who, "wantedPoints", amountWanted) 
            end 
        end 
    end 
end 
addCommandHandler("setwanted", setPlayerWanted) 

Here is the error:

if not amountWanted < 7 and not amountWanted > -1 then 

Even though I put a number when I type the command, and when I've defined "amountWanted" as a tonumber, it still reads it as a boolean... Any ideas what's wrong?

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...