Jump to content

givemoney with 2 step


Recommended Posts

function giveMoney(thePlayer) 
            if thePlayer then 
                givePlayerMoney(thePlayer, 400000) 
                outputChatBox("Bạn đã lấy 400000" , thePlayer) 
addEvent("gmoney", true) 
addEventHandler("gmoney", root, giveMoney) 
function start(thePlayer, commandName) 
triggerEvent("gmoney", thePlayer) 
addCommandHandler("smoney", start) 

what wrong? not give money and not debug on cmd mtasa server?

Link to comment

You complicated it too much, if the points is to give 'thePlayer' 400k then just do this

function giveMoney (thePlayer) 
    givePlayerMoney (thePlayer, 400000) 
    outputChatBox ("Ban da lay 400000$", thePlayer) 
addCommandHandler ("gmoney", giveMoney) 

also, you don't need to check 'if player then' as there will surely be the player who wrote the command, but you can check if he is not logged in like that, so you won't give him money, it'll be like:

local account = getPlayerAccount (thePlayer) 
if account and not isGuestAccount (account) then 

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