Jump to content

Alguem pode me ajudar com um script de celular!


Recommended Posts

Queria arrumar o script de transferencia pra ele transferir pelo id pois ele está pelo nome:

 

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) >= 1 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$ 1 !", source, 255, 255, 255,true)
    end
	end
 end
)

 

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