Jump to content

Problem with my money script


FSXTim

Recommended Posts

Hello,

I have more than 61000 dollars and I type "/givemoney FSXTim 100", but the console says:

"You don't have enough money!" (line 9 in the script)

function giveMoney(player, command, target, m) 
    local target = getPlayerFromName(target) 
    local money = tonumber(m) 
    if isElement(target) then 
        if tonumber(getElementData(player, "Geld") == money) or tonumber(getElementData(player, "Geld") > money) then 
            setElementData(player, "Geld", getElementData(player, "Geld") - money)  
            setElementData(target, "Geld", getElementData(target, "Geld") + money)  
        else 
            outputChatBox("You don't have enough money!", player, 255, 48, 48) 
        end 
    end  
end 
addCommandHandler("givemoney", giveMoney) 

Greets

Link to comment
Guest Guest4401

Replace this

if tonumber(getElementData(player, "Geld") == money) or tonumber(getElementData(player, "Geld") > money) then 

with this

if tonumber(getElementData(player,"Geld")) >= money then 

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