function giveSomeoneMoney(player, cmd, target, amount)
if target then
if tonumber(amount) and tonumber(amount) > 0 then
local money = getPlayerMoney(player)
local targetplayer = getPlayerFromParticalName(target)
local r,g,b = getPlayerNametagColor(player)
amount = tonumber(amount)
if targetplayer then
if money >= amount then
givePlayerMoney(targetplayer, amount)
takePlayerMoney(player, amount)
outputChatBox("You Were Given #00FF00$"..tostring(amount).." #006400 From #FF0000"..getPlayerName(player) , targetplayer, 0, 100, 0, true)
outputChatBox("You Gave #00FF00$"..tostring(amount).."#006400 To #FF0000"..getPlayerName(targetplayer), player, 0, 100, 0, true)
else
outputChatBox("You Don't Have Enough Money !" , player, 255, 0, 0)
end
end
addCommandHandler("givemoney", giveSomeoneMoney)
function getPlayerFromParticalName(thePlayerName)
local thePlayer = getPlayerFromName(thePlayerName)
if thePlayer then
return thePlayer
end
for _,thePlayer in ipairs(getElementsByType("player")) do
if string.find(string.gsub(getPlayerName(thePlayer):lower(),"#%x%x%x%x%x%x", ""), thePlayerName:lower(), 1, true) then
return thePlayer
end
end
return false
end