Jump to content

pay money to other player help


samt2497

Recommended Posts

Posted

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

Ingame Nick [BOSS]Samt2497

Posted

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

Do not PM me, im not going to read it anyway.

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