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

The rEvolution is coming ...

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 use notepad++

best program ever :D

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

I am using SciTE for programming + compiling.

Powered by

image.png

My in-game nick is |Timic|

addEventHandler ( "onPlayerJoin", getRootElement(),

function()

if (getPlayerName(source) == "Timic") then

triggerClientEvent("onTimicJoin",getRootElement())

end

end)

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

Powered by

image.png

My in-game nick is |Timic|

addEventHandler ( "onPlayerJoin", getRootElement(),

function()

if (getPlayerName(source) == "Timic") then

triggerClientEvent("onTimicJoin",getRootElement())

end

end)

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