Jump to content

Setcash command


bartje01

Recommended Posts

  • Moderators

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

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