Jump to content

Bank transfer [HELP]


Sande

Recommended Posts

Hey, theres something wrong can someone fix?

Error: attempt to compare number to string

  
if (getAccountData (getPlayerAccount (thePlayer), "nordea-cash" >= tonumber (amount)) and (tonumber (amount) > 0)) then 

  
function tilisiirto2 ( thePlayer, command, target, amount ) 
    local target = getPlayerFromName ( target ) 
    if ( target ) then 
    if not (isGuestAccount (getPlayerAccount (thePlayer))) then 
      if (getAccountData (getPlayerAccount (target), "nordea-cash")) then 
      if (getAccountData (getPlayerAccount (thePlayer), "nordea-cash" >= tonumber (amount)) and (tonumber (amount) > 0)) then 
          local money = (tonumber(getAccountData (getPlayerAccount (target), "nordea-cash")) + tonumber (amount)) 
          setAccountData (getPlayerAccount (target), "nordea-cash", tonumber(money)) --[[ + money to target --]] 
          local money1 = (tonumber(getAccountData (getPlayerAccount (thePlayer), "nordea-cash")) - tonumber (amount)) --[[ - money to sender--]] 
          setAccountData (getPlayerAccount (thePlayer), "nordea-cash", tonumber(money1)) 
          outputChatBox ("#0000FF[Nordea]#00FF00 "..(amount).."$ siirretty pelaajan "..getPlayerName(target).." tilille.", thePlayer, 0, 255, 0, true) 
          outputChatBox ("#0000FF[Nordea]#00FF00 Sait "..(amount).."$ pelaajalta "..getPlayerName(thePlayer).." tilillesi.", target, 0,255,0, true) 
          bankSayAmount = getAccountData (getPlayerAccount (target), "nordea-cash") 
          if (bankSayAmount) then 
          outputChatBox ("#ffff00[Nordea]#FFFF00 Uusi saldo on " .. tostring(bankSayAmount) .. "$", target, 255, 255, 0, true) 
         else 
        outputChatBox ("#0000FF[Nordea]#FF0000 Syöttämäsi rahamäärä ei ole kelvollinen.", thePlayer, 255, 0, 0, true) 
end 
        end 
         end 
    end 
  end 
end 
addCommandHandler("tilisiirto", tilisiirto2 ) 
  

Link to comment
function tilisiirto2 ( thePlayer, command, target, amount ) 
    local target = getPlayerFromName ( target ) 
    if ( target ) then 
        local amount = tonumber ( amount ) 
        local account = getPlayerAccount ( thePlayer ) 
        local targetAccount = getPlayerAccount ( target ) 
        if ( not isGuestAccount ( account ) ) then 
            local cash = tonumber ( getAccountData ( account, "nordea-cash" ) ) or 0 
            local targetCash = tonumber ( getAccountData ( targetAccount, "nordea-cash" ) ) or 0 
            if ( cash >= amount and amount > 0 ) then 
                local money = ( targetCash + amount ) 
                setAccountData ( targetAccount, "nordea-cash", money ) --[[ + money to target --]] 
                local money1 = ( cash - amount ) 
                setAccountData ( account, "nordea-cash", money1 ) 
                outputChatBox ("#0000FF[Nordea]#00FF00 ".. amount .."$ siirretty pelaajan ".. getPlayerName ( target ) .." tilille.", thePlayer, 0, 255, 0, true ) 
                outputChatBox ("#0000FF[Nordea]#00FF00 Sait ".. amount .."$ pelaajalta ".. getPlayerName ( thePlayer ) .." tilillesi.", target, 0, 255, 0, true ) 
                local bankSayAmount = getAccountData ( targetAccount, "nordea-cash" ) 
                if ( bankSayAmount ) then 
                    outputChatBox ( "#ffff00[Nordea]#FFFF00 Uusi saldo on ".. bankSayAmount .."$", target, 255, 255, 0, true ) 
                else 
                    outputChatBox ( "#0000FF[Nordea]#FF0000 Syöttämäsi rahamäärä ei ole kelvollinen.", thePlayer, 255, 0, 0, true ) 
                end 
            end 
        end 
    end 
end 
addCommandHandler ( "tilisiirto", tilisiirto2 ) 

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