function getPlayerFromPartialName(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
addEvent("onSendMoney", true)
addEventHandler("onSendMoney", getRootElement(),
function(who, player)
local money = getPlayerMoney(source)
if player ~= nil then
if tonumber(player) >= 200 then
if tonumber(player) <= money then
toWho = getPlayerFromPartialName(who)
conta = getPlayerAccount (source)
if isGuestAccount (conta) then
outputChatBox("#FFFF00Você precisa estar logado.", source, 255, 255, 255, true)
return
end
nick_do_jogador = getPlayerName ( toWho )
if toWho ~= false then
givePlayerMoney(toWho, player)
takePlayerMoney(source, player)
name = getPlayerName(source)
outputChatBox("#FFFF00Você transferiu #00ff00R$" .. player .. "#FFFF00 para #FFFF00" .. nick_do_jogador, source, 255, 255, 255, true)
outputChatBox("".. name .. " #FFFF00lhe transferiu #FFFF00R$" .. player .. " #FFFF00!", toWho, 255, 255, 255, true)
else
outputChatBox("#FFFF00Você não selecionou um jogador da lista!", source, 255, 255, 255,true)
end
else
outputChatBox("#FFFF00Você não tem dinheiro suficiente!", source, 255, 255, 255,true)
end
else
outputChatBox("#FFFF00 O valor mínimo de transferências é R$ 200 !", source, 255, 255, 255,true)
end
end
end
)