itHyperoX Posted November 26, 2016 Share Posted November 26, 2016 Hiii. Whats the problem? I can pay money to player - amount, or when i pay more than money i have, the system give that amount to player. function payfunction(player,cmd,playername,money) if playername and money then local player2 = getPlayerFromNamePart(playername) if player2 then if tonumber(money) and tonumber(money) >= 1 then givePlayerMoney(player2,tonumber(money)) takePlayerMoney(player,tonumber(money)) end end else outputChatBox("/pay [Player] [Amount]",player) end end addCommandHandler("pay",payfunction) function getPlayerFromNamePart(name) local name = name and name:gsub("#%x%x%x%x%x%x", ""):lower() or nil if name then for _, player in ipairs(getElementsByType("player")) do local name_ = getPlayerName(player):gsub("#%x%x%x%x%x%x", ""):lower() if name_:find(name, 1, true) then return player end end end end Link to comment
Rose Posted November 26, 2016 Share Posted November 26, 2016 Use something like that this to specify that the player's money is greater than or equal to money's variable: local mymoney = getPlayerMoney(player) if (mymoney >= money) then -- givePlayerMoney(player2, tonumber(money)) -- takePlayerMoney(player, tonumber(money)) end Link to comment
itHyperoX Posted November 27, 2016 Author Share Posted November 27, 2016 not working, but thanks Link to comment
iPrestege Posted November 27, 2016 Share Posted November 27, 2016 it should work post what you did. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now