Sande Posted August 9, 2013 Share Posted August 9, 2013 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
Castillo Posted August 9, 2013 Share Posted August 9, 2013 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now