• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How use math.abs?

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
Might someone say use me like math.abs?, in my ot I have a bankSystem via talkaction, but if the person for example deposits a quantity with a negative value (Ex-:!deposit -150000000), the quantity will be added and when he should withdraw of his balance, will be able to extract this quantity of money though it did not have it :S!, for this reason I need to be able place like in the script, which negative values could not use, Raliuga said to me that it might do it using the function "math.abs"
 
Then.. al i need to put in my script is math.abs(param)?..

because in my script i have the parameter "m = tonumber(param)" then..

i need to put abs(param) or abs(m)?

This is my script

Code:
function sendMessage(cid, message)
	return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, message)
end

function deposit(cid, money)
	return doPlayerDepositMoney(cid, money)
end

function onSay(cid, words, param)

if(param == "") then
	sendMessage(cid, "Command requires param.")
	return TRUE
end

local m = tonumber(param)

if(not m) then
	sendMessage(cid, "Command requires numeric param.")
	return TRUE
end

if m <= getPlayerMoney(cid) then
	deposit(cid, m)
	sendMessage(cid, "Alright, you have added the amount of " .. m .. " gold to your balance. You can withdraw your money anytime you want to. Your account balance is " .. getPlayerBalance(cid) .. ".")

else
	sendMessage(cid, "You do not have enough money.")
end
	return TRUE
end
 
Back
Top