Jump to content

Attempt to perform arithmetic on a boolean value


FSXTim

Recommended Posts

Error(Line7): Attempt to perform arithmetic on a boolean value

function repair1_Button (state) 
    local lp = getLocalPlayer() 
    if state == "left" then 
        if source == GUIEditor_Button[1] then 
            if getElementData ( lp, "Money" ) >= 50 then     
                takePlayerMoney ( 50 )   
                setElementData ( lp, "Repair", getElementData ( lp, "Repair" ) + 1 ) 
                outputChatBox ("Du hast Dir ein Auto Repair gekauft!", 0, 255, 0 ) 
            else 
                outputChatBox ( "Du hast nicht genug Geld - Ein Auto Repair kostet 50$", 255, 0, 0 ) 
            end  
        end  
    end 
end 
addEventHandler("onClientGUIClick", getRootElement(), repair1_Button) 

Can anybody help me, please?

Greets

Link to comment
function repair1_Button (state) 
    local lp = getLocalPlayer() 
    if state == "left" then 
        if source == GUIEditor_Button[1] then 
            if tonumber(getElementData(lp, "Money")) >= 50 then    
                takePlayerMoney ( 50 )  
                setElementData(lp, "Repair", tonumber(getElementData(lp,"Repair") or 0) + 1) 
                outputChatBox ("Du hast Dir ein Auto Repair gekauft!", 0, 255, 0 ) 
            else 
                outputChatBox ( "Du hast nicht genug Geld - Ein Auto Repair kostet 50$", 255, 0, 0 ) 
            end  
        end  
    end 
end 
addEventHandler("onClientGUIClick", getRootElement(), repair1_Button) 

Link to comment

You should use MySQL database system and create a table for bought items and when a player buys a item, insert player name, item bought, ...

And when you want to get all bought items just search in the table all rows where player name is the name you want.

Understand?

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