Jump to content

pay money to other player help


samt2497

Recommended Posts

i writting a code and i have a problem with a command for send money to another player

the code is it

function dardinero ( thePlayer, commandName, destplayer, monto )
local dinerojugador = getPlayerMoney(thePlayer)
       local recibidor = getPlayerFromName ( destplayer )
if dinerojugador > monto then
takePlayerMoney ( thePlayer, tonumber(monto) )
givePlayerMoney ( recibidor, tonumber(monto) )
end
end
addCommandHandler ( "dar", dardinero )

but it not work if anyone can help me very much thanks

Link to comment
if dinerojugador > monto then

comparing number to a string there, need to tonumber() the 'monto'. And are the take/givePlayerMoney functions defined? Use debugscript to see your errors

What do you mean defined? They are native MTA functions...

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