Castillo Posted June 23, 2010 Posted June 23, 2010 hey there, i got a problem in my send money function, all works fine but when i send to someone -2222 or -9999 it gives to me that money also, here is my code. function ( playerNick, amount ) local cash = getPlayerMoney(source) if (cash > tonumber(amount)) then toWho = getPlayerFromName(playerNick) if (toWho ~= false) then givePlayerMoney(toWho,amount) name = getPlayerName(source) takePlayerMoney(source,amount) outputChatBox("You've given money amount of: " .. amount .. "$ to: " .. playerNick,source,255,255,150) outputChatBox(name .. " has given you money amount of: " .. amount .. "$!",toWho,255,255,245) else outputChatBox("Player did not exist",source,255,0,0) end else outputChatBox("Insufficient founds!",source,255,0,0) end end) btw, i have the GUI part in client side where i trigger user and amount San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
dzek (varez) Posted June 23, 2010 Posted June 23, 2010 just check (can be client side) if somebody put in edit field a negative value - if yes - dont send it.. function (playerNick, amount) local cash = getPlayerMoney(source) if (tonumber(amount)>0) then if (cash>=tonumber(amount)) then toWho = getPlayerFromName(playerNick) if (toWho ~= false) then givePlayerMoney(toWho,amount) takePlayerMoney(source,amount) name = getPlayerName(source) outputChatBox("You've given money amount of: " .. amount .. "$ to: " .. playerNick,source,255,255,150) outputChatBox(name .. " has given you money amount of: " .. amount .. "$!",toWho,255,255,245) else outputChatBox("Player did not exist",source,255,0,0) end else outputChatBox("Insufficient founds!",source,255,0,0) end else outputChatBox("Amount have to be greater than 0!",source,255,0,0) end end) btw: use indentations! they really help! Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
kevin11 Posted June 23, 2010 Posted June 23, 2010 has this anything to do with userpanel?? because it works for me -999 isnt working
Castillo Posted June 23, 2010 Author Posted June 23, 2010 Thanks it worked San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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