Jump to content

Help With Give COmmand


xXMADEXx

Recommended Posts

I have this command ( /give and /pay ) but i dont know how to make it so that the player sending money haves to have the amount of money that there sending. Like, i dont want sender want to be able to go in negative money.

function givecash(thePlayer, command, who, amount) 
    local noobwiegeldkrijgt = getPlayerFromName ( who ) 
    local noobdiegeldgeeft = getPlayerFromName ( thePlayer ) 
    if (getPlayerMoney(thePlayer) >= amount) then 
        givePlayerMoney (noobwiegeldkrijgt, math.abs(tonumber(amount))) 
        takePlayerMoney (thePlayer, math.abs(tonumber(amount))) 
    else 
        outputChatBox("Sorry, You Do Not Have That Much Money To Give.", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ("give", givecash) 
addCommandHandler ("pay", givecash) 

Link to comment
Post the script.
function givecash(thePlayer, command, who, amount) 
    local noobwiegeldkrijgt = getPlayerFromName ( who ) 
    local noobdiegeldgeeft = getPlayerFromName ( thePlayer ) 
    if ( tonumber ( amount ) < 0 ) then return end 
    if (getPlayerMoney(thePlayer) >= amount) then 
        givePlayerMoney (noobwiegeldkrijgt, math.abs(tonumber(amount))) 
        takePlayerMoney (thePlayer, math.abs(tonumber(amount))) 
    else 
        outputChatBox("Sorry, You Do Not Have That Much Money To Give.", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ("give", givecash) 

Link to comment
function givecash(thePlayer, command, who, amount) 
    local noobwiegeldkrijgt = getPlayerFromName ( who ) 
    local noobdiegeldgeeft = getPlayerName ( thePlayer ) 
    if ( tonumber ( amount ) < 0 ) then return end 
    if (getPlayerMoney(thePlayer) >= tonumber(amount)) then 
        givePlayerMoney (noobwiegeldkrijgt, math.abs(tonumber(amount))) 
        takePlayerMoney (thePlayer, math.abs(tonumber(amount))) 
    else 
        outputChatBox("Sorry, You Do Not Have That Much Money To Give.", thePlayer, 255, 0, 0 ) 
    end 
end 
addCommandHandler ("give", givecash) 

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