Ir para conteúdo

Bank System [8.60] comando !saldo, !sacar, !depositar ( até no max 100 ) com id de x item

Featured Replies

Postado
2 horas atrás, carloos disse:

nao entendi esse script, onde adiciono ?

talkactions

data > talkactions > scripts > newbank.lua

ai regista no XML
data > talkactions > talkactions.xml
<talkaction words="/newbank; !newbank" event="script" value="newbank.lua"/>

ai pra usar vc precisa digitar:
 

!newbank balance  >   mostra o teu balance
!newbank sacar e a quantidade > !newbank sacar 1000000    >    saca a quantidade digitada
!newbank deposit	>  deposita as moedas configuradas no script

 

  • Respostas 12
  • Visualizações 1.3k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • você n tem essa função na sua lib ou no script bota acima ela   function getTimeString(self) local format = { {'dia', self / 60 / 60 / 24}, {'hora', self / 60 / 60 % 24},

Postado
19 horas atrás, FeeTads disse:

talkactions

data > talkactions > scripts > newbank.lua

ai regista no XML
data > talkactions > talkactions.xml
<talkaction words="/newbank; !newbank" event="script" value="newbank.lua"/>

ai pra usar vc precisa digitar:
 


!newbank balance  >   mostra o teu balance
!newbank sacar e a quantidade > !newbank sacar 1000000    >    saca a quantidade digitada
!newbank deposit	>  deposita as moedas configuradas no script

 

foi isso que eu tinha feito, mas pensei que havia feito algo errado

está dando esse erro. TFS0.4

Spoiler

[Error - TalkAction Interface]
data/talkactions/scripts/tokenbank.lua:onSay
Description:
data/talkactions/scripts/tokenbank.lua:63: attempt to call global 'getTimeString' (a nil value)
stack traceback:
        data/talkactions/scripts/tokenbank.lua:63: in function <data/talkactions/scripts/tokenbank.lua:6>

 

Postado
6 horas atrás, carloos disse:

'getTimeString' (a nil value)

você n tem essa função na sua lib ou no script
bota acima ela
 

function getTimeString(self)
    local format = {
        {'dia', self / 60 / 60 / 24},
        {'hora', self / 60 / 60 % 24},
        {'minuto', self / 60 % 60},
        {'segundo', self % 60}
    }
    
    local out = {}
    for k, t in ipairs(format) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    local ret = table.concat(out)
    if ret:len() < 16 and ret:find('segundo') then
        local a, b = ret:find(' e ')
        ret = ret:sub(b+1)
    end
    return ret
end

 

vai ficar assim o código:
 

Spoiler

function getTimeString(self)
    local format = {
        {'dia', self / 60 / 60 / 24},
        {'hora', self / 60 / 60 % 24},
        {'minuto', self / 60 % 60},
        {'segundo', self % 60}
    }
    
    local out = {}
    for k, t in ipairs(format) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    local ret = table.concat(out)
    if ret:len() < 16 and ret:find('segundo') then
        local a, b = ret:find(' e ')
        ret = ret:sub(b+1)
    end
    return ret
end

local config = {
	s = 10546, -- n mexa
	exhau = 2 -- tempo em seegundos 
}

function onSay(cid, words, param)

	local id_mining = 2328
	local msg = string.lower(param)
	local storage_minings = 5435300
	local retirado = 0
	local save_mining = 0
	local s = string.explode(param, " ")
	
	if (getPlayerStorageValue(cid, config.s) <= os.time()) then
		doPlayerSave(cid)
		if isInArray({"balance", "saldo"}, msg) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você possui ".. tonumber(getPlayerStorageValue(cid, storage_minings)) .." Mining Coins salvo em Storage!")
			setPlayerStorageValue(cid, config.s, os.time()+config.exhau)
		elseif isInArray({"deposit", "depositar"}, msg) then
			local minings = getPlayerItemCount(cid, id_mining)
			if minings > 0 then
				doPlayerRemoveItem(cid, id_mining, minings)
				setPlayerStorageValue(cid, storage_minings, tonumber(getPlayerStorageValue(cid, storage_minings)+minings))
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você Depositou ".. minings .." Mining Coins! Seu saldo é de: "..tonumber(getPlayerStorageValue(cid, storage_minings)))
			else
				doPlayerSendCancel(cid, "Você não tem mining Coins!")
				return true
			end
			setPlayerStorageValue(cid, config.s, os.time()+config.exhau)
		elseif isInArray({"sacar", "withdraw"}, s[1]) then
			if s[2] and tonumber(s[2]) then
				local m = tonumber(s[2])
				if tonumber(getPlayerStorageValue(cid, storage_minings)) < m then
					doPlayerSendTextMessage(cid, 22, "Você não possui ".. m .." mining coins!")
				else
					for i=1, (m/3500)+1 do
						bp = doCreateItemEx(2002, 1)
						if m >= 3500 then 
							doAddContainerItem(bp, id_mining, 3500)
							retirado = 3500
						else
							doAddContainerItem(bp, id_mining, m)
							retirado = m
						end
						receive = doPlayerAddItemEx(cid, bp)
						if receive ~= RETURNVALUE_NOERROR then
							doPlayerSendTextMessage(cid, 22, "Não foi possivel Entregar Tudo, tenha espaço em sua BP!")	
						else
							setPlayerStorageValue(cid, storage_minings, tonumber(getPlayerStorageValue(cid, storage_minings)-retirado))
							m = m -  retirado
							save_mining = save_mining + retirado
						end
					end
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você sacou ".. save_mining .." Mining Coins! Seu saldo é de: "..tonumber(getPlayerStorageValue(cid, storage_minings)))
				end
			else
				doPlayerSendTextMessage(cid, 22, "Insira uma quantidade valida!")
			end
		end
		setPlayerStorageValue(cid, config.s, os.time()+600)
	else
		doPlayerSendCancel(cid, "Voce tem que esperar " .. getTimeString(getPlayerStorageValue(cid, config.s)-os.time()).."!")
	end
	
   return true
end

 

 

Postado
Em 23/11/2022 em 01:34, FeeTads disse:

você n tem essa função na sua lib ou no script
bota acima ela
 



function getTimeString(self)
    local format = {
        {'dia', self / 60 / 60 / 24},
        {'hora', self / 60 / 60 % 24},
        {'minuto', self / 60 % 60},
        {'segundo', self % 60}
    }
    
    local out = {}
    for k, t in ipairs(format) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    local ret = table.concat(out)
    if ret:len() < 16 and ret:find('segundo') then
        local a, b = ret:find(' e ')
        ret = ret:sub(b+1)
    end
    return ret
end

 

vai ficar assim o código:
 

  Ocultar conteúdo




function getTimeString(self)
    local format = {
        {'dia', self / 60 / 60 / 24},
        {'hora', self / 60 / 60 % 24},
        {'minuto', self / 60 % 60},
        {'segundo', self % 60}
    }
    
    local out = {}
    for k, t in ipairs(format) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    local ret = table.concat(out)
    if ret:len() < 16 and ret:find('segundo') then
        local a, b = ret:find(' e ')
        ret = ret:sub(b+1)
    end
    return ret
end

local config = {
	s = 10546, -- n mexa
	exhau = 2 -- tempo em seegundos 
}

function onSay(cid, words, param)

	local id_mining = 2328
	local msg = string.lower(param)
	local storage_minings = 5435300
	local retirado = 0
	local save_mining = 0
	local s = string.explode(param, " ")
	
	if (getPlayerStorageValue(cid, config.s) <= os.time()) then
		doPlayerSave(cid)
		if isInArray({"balance", "saldo"}, msg) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você possui ".. tonumber(getPlayerStorageValue(cid, storage_minings)) .." Mining Coins salvo em Storage!")
			setPlayerStorageValue(cid, config.s, os.time()+config.exhau)
		elseif isInArray({"deposit", "depositar"}, msg) then
			local minings = getPlayerItemCount(cid, id_mining)
			if minings > 0 then
				doPlayerRemoveItem(cid, id_mining, minings)
				setPlayerStorageValue(cid, storage_minings, tonumber(getPlayerStorageValue(cid, storage_minings)+minings))
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você Depositou ".. minings .." Mining Coins! Seu saldo é de: "..tonumber(getPlayerStorageValue(cid, storage_minings)))
			else
				doPlayerSendCancel(cid, "Você não tem mining Coins!")
				return true
			end
			setPlayerStorageValue(cid, config.s, os.time()+config.exhau)
		elseif isInArray({"sacar", "withdraw"}, s[1]) then
			if s[2] and tonumber(s[2]) then
				local m = tonumber(s[2])
				if tonumber(getPlayerStorageValue(cid, storage_minings)) < m then
					doPlayerSendTextMessage(cid, 22, "Você não possui ".. m .." mining coins!")
				else
					for i=1, (m/3500)+1 do
						bp = doCreateItemEx(2002, 1)
						if m >= 3500 then 
							doAddContainerItem(bp, id_mining, 3500)
							retirado = 3500
						else
							doAddContainerItem(bp, id_mining, m)
							retirado = m
						end
						receive = doPlayerAddItemEx(cid, bp)
						if receive ~= RETURNVALUE_NOERROR then
							doPlayerSendTextMessage(cid, 22, "Não foi possivel Entregar Tudo, tenha espaço em sua BP!")	
						else
							setPlayerStorageValue(cid, storage_minings, tonumber(getPlayerStorageValue(cid, storage_minings)-retirado))
							m = m -  retirado
							save_mining = save_mining + retirado
						end
					end
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você sacou ".. save_mining .." Mining Coins! Seu saldo é de: "..tonumber(getPlayerStorageValue(cid, storage_minings)))
				end
			else
				doPlayerSendTextMessage(cid, 22, "Insira uma quantidade valida!")
			end
		end
		setPlayerStorageValue(cid, config.s, os.time()+600)
	else
		doPlayerSendCancel(cid, "Voce tem que esperar " .. getTimeString(getPlayerStorageValue(cid, config.s)-os.time()).."!")
	end
	
   return true
end

 

 

obrigado!

Editado por carloos (veja o histórico de edições)

  • 1 month later...
Postado
Em 23/11/2022 em 01:34, FeeTads disse:

você n tem essa função na sua lib ou no script
bota acima ela
 





function getTimeString(self)
    local format = {
        {'dia', self / 60 / 60 / 24},
        {'hora', self / 60 / 60 % 24},
        {'minuto', self / 60 % 60},
        {'segundo', self % 60}
    }
    
    local out = {}
    for k, t in ipairs(format) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    local ret = table.concat(out)
    if ret:len() < 16 and ret:find('segundo') then
        local a, b = ret:find(' e ')
        ret = ret:sub(b+1)
    end
    return ret
end

 

vai ficar assim o código:
 

  Ocultar conteúdo








function getTimeString(self)
    local format = {
        {'dia', self / 60 / 60 / 24},
        {'hora', self / 60 / 60 % 24},
        {'minuto', self / 60 % 60},
        {'segundo', self % 60}
    }
    
    local out = {}
    for k, t in ipairs(format) do
        local v = math.floor(t[2])
        if(v > 0) then
            table.insert(out, (k < #format and (#out > 0 and ', ' or '') or ' e ') .. v .. ' ' .. t[1] .. (v ~= 1 and 's' or ''))
        end
    end
    local ret = table.concat(out)
    if ret:len() < 16 and ret:find('segundo') then
        local a, b = ret:find(' e ')
        ret = ret:sub(b+1)
    end
    return ret
end

local config = {
	s = 10546, -- n mexa
	exhau = 2 -- tempo em seegundos 
}

function onSay(cid, words, param)

	local id_mining = 2328
	local msg = string.lower(param)
	local storage_minings = 5435300
	local retirado = 0
	local save_mining = 0
	local s = string.explode(param, " ")
	
	if (getPlayerStorageValue(cid, config.s) <= os.time()) then
		doPlayerSave(cid)
		if isInArray({"balance", "saldo"}, msg) then
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você possui ".. tonumber(getPlayerStorageValue(cid, storage_minings)) .." Mining Coins salvo em Storage!")
			setPlayerStorageValue(cid, config.s, os.time()+config.exhau)
		elseif isInArray({"deposit", "depositar"}, msg) then
			local minings = getPlayerItemCount(cid, id_mining)
			if minings > 0 then
				doPlayerRemoveItem(cid, id_mining, minings)
				setPlayerStorageValue(cid, storage_minings, tonumber(getPlayerStorageValue(cid, storage_minings)+minings))
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você Depositou ".. minings .." Mining Coins! Seu saldo é de: "..tonumber(getPlayerStorageValue(cid, storage_minings)))
			else
				doPlayerSendCancel(cid, "Você não tem mining Coins!")
				return true
			end
			setPlayerStorageValue(cid, config.s, os.time()+config.exhau)
		elseif isInArray({"sacar", "withdraw"}, s[1]) then
			if s[2] and tonumber(s[2]) then
				local m = tonumber(s[2])
				if tonumber(getPlayerStorageValue(cid, storage_minings)) < m then
					doPlayerSendTextMessage(cid, 22, "Você não possui ".. m .." mining coins!")
				else
					for i=1, (m/3500)+1 do
						bp = doCreateItemEx(2002, 1)
						if m >= 3500 then 
							doAddContainerItem(bp, id_mining, 3500)
							retirado = 3500
						else
							doAddContainerItem(bp, id_mining, m)
							retirado = m
						end
						receive = doPlayerAddItemEx(cid, bp)
						if receive ~= RETURNVALUE_NOERROR then
							doPlayerSendTextMessage(cid, 22, "Não foi possivel Entregar Tudo, tenha espaço em sua BP!")	
						else
							setPlayerStorageValue(cid, storage_minings, tonumber(getPlayerStorageValue(cid, storage_minings)-retirado))
							m = m -  retirado
							save_mining = save_mining + retirado
						end
					end
					doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Você sacou ".. save_mining .." Mining Coins! Seu saldo é de: "..tonumber(getPlayerStorageValue(cid, storage_minings)))
				end
			else
				doPlayerSendTextMessage(cid, 22, "Insira uma quantidade valida!")
			end
		end
		setPlayerStorageValue(cid, config.s, os.time()+600)
	else
		doPlayerSendCancel(cid, "Voce tem que esperar " .. getTimeString(getPlayerStorageValue(cid, config.s)-os.time()).."!")
	end
	
   return true
end

 

 

Nao entendi onde eu coloco isso... minha lib no talkactions e talkactions.lua

    if(talkAction)
    {
        for(TalkActionsMap::iterator it = talksMap.begin(); it != talksMap.end(); ++it)
        {
            if(it->first == "illegalWords")
            {
                talkAction = it->second;
                break;
            }
        }
        if(talkAction && talkAction->isScripted())
            return talkAction->executeSay(creature, words, "", channelId);
        return false;
    }
    else if(talkAction->getChannel() != -1 && talkAction->getChannel() != channelId)
        return false;

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo