Jump to content

Setcash command


bartje01

Recommended Posts

  • Moderators
Posted

Yeah I forgot the return thanks The Kid but I forgot another in the line 2

The full code

function setCash ( sourcePlayer,cmd,who,amount) 
    if ( not who and not amount ) then outputChatBox("*Use /setcash [Name] [amount]", sourcePlayer, 180, 0, 0 ) return end 
    local gived = getPlayerFromName ( who ) 
    if not gived then outputChatBox("The player "..who.." is not connected", sourcePlayer, 180, 0, 0 ) return end  
    account = getPlayerAccount(gived) 
    if not isGuestAccount ( account ) then 
        local playerCash = getAccountData ( account, "data.cash" ) 
        local success = setAccountData ( account, "data.cash", tonumber(playerCash)+tonumber(amount) ) 
        if success then 
            outputChatBox ( "Your cash has been setted.", gived ) 
            outputChatBox ( "You've setted his cash.", sourcePlayer ) 
        else 
            outputChatBox("ERROR: His cash his not setted", sourcePlayer, 180, 0, 0 ) 
        end 
    end 
end 
addCommandHandler ( "setcash", setCash ) 

Try this

Posted

OH MAN it finaly works!!. Thankyou so much everyone.

No errors no warnings. all becaues of you guys ;)

Thanks.

PS:

What program are you guys using for scripting?

Posted
I am using SciTE for programming + compiling.

You mean in *.luac ?

When I compile it, it creates new file. Yeah, like *.luac

Btw, it is the best =D

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