Xii... testei com o nome que pode, ele fes!
Porem testei com o nome que não poderia, ele tambem fes... rsrs
Toda via.. ficou igual o createitem normal! ;x
Xii... testei com o nome que pode, ele fes!
Porem testei com o nome que não poderia, ele tambem fes... rsrs
Toda via.. ficou igual o createitem normal! ;x
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

tenta agora
Olá,
Sim agora funcionou!
Porem se criar com o nome do item, ainda pode criar! ^^
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit

Hum, só tomar banho aqui e já atualizo blz?.
info
Grupo: Barão
Registrado: 18/10/10
Posts: 246
Reputação: +89
Char no Tibia: Elite Pamcadaum

Tipo, quando você for declarar um valor só para configuração, não crie ele dentro da função principal, pois o valor seria atribuído toda vez que um player executasse a função, se você fizer assim:
local ret = RETURNVALUE_NOERROR
local allowedPlayers = {"[ADM] Castiel", "[GOD] Dean"}
local blockedIds = {2150, 2159}
local arq = 'createItemLogs.txt'
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você deve digitar /i nome do item, quantidade(opcional, se for stackable criara 100).")
return true
end
local t = string.explode(param, ",")
local pos = getCreaturePosition(cid)
local file = io.open("data/logs/".. arq, "a+")
local id = tonumber(t[1])
if(not id) then
id = getItemIdByName(t[1], false)
if(not id) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Esse item não existe.")
return true
end
end
if isInArray(blockedIds, tonumber(t[1])) and not isInArray(allowedPlayers, getCreatureName(cid)) then
doPlayerSendTextMessage(cid, 27, "Você não pode criar este item um registro foi mandado para o hoster.")
file:write("\n[" .. os.date("%d %B %Y %X ", os.time()) .. "] " .. getCreatureName(cid) .. " tentou criar um item proibido ID(" .. t[1] .. ")\n") return false
end
local amount = 100
if(t[2]) then
amount = t[2]
end
local item = doCreateItemEx(id, amount)
if(t[3] and getBooleanFromString(t[3])) then
if(t[4] and getBooleanFromString(t[4])) then
pos = getCreatureLookPosition(cid)
end
ret = doTileAddItemEx(pos, item)
else
ret = doPlayerAddItemEx(cid, item, true)
end
if(ret ~= RETURNVALUE_NOERROR) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não foi possível adicionar o item: " .. t[1])
return true
end
doDecayItem(item)
if(not isPlayerGhost(cid)) then
doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
end
return true
end
O servidor economizará um pouco de memória pois não precisará declarar a variável novamente, entende? Assim fica melhor [:
Humm.. mas continua criando item pelo nome dele ainda :X
Foda que não manjo nada dessas funções ainda.. mas jaja chego la.. uhauuhaa
Humm.. mas continua criando item pelo nome dele ainda :X
Foda que não manjo nada dessas funções ainda.. mas jaja chego la.. uhauuhaa
Simples, ele chama tonumber(param[1]) denovo, sendo que a variável id já faz todo um trabalho que ele ignorou.
function onSay(cid, words, param, channel)
if(param == '') then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "O comando necessita de parâmetros.")
return true
end
local t = string.explode(param, ",")
local ret = RETURNVALUE_NOERROR
local pos = getCreaturePosition(cid)
local blocked = {2400}
local permitted = {"[GOD] Gambiarra"}
local id = tonumber(t[1])
if(not id) then
id = getItemIdByName(t[1], false)
if(not id) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Um item com este nome não existe.")
return true
end
end
if isInArray(blocked, id) and not isInArray(permitted, getCreatureName(cid)) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Desculpe, você não tem permissão para criar este item.")
return true
end
local amount = 100
if(t[2]) then
amount = t[2]
end
local item = doCreateItemEx(id, amount)
if(t[3] and getBooleanFromString(t[3])) then
if(t[4] and getBooleanFromString(t[4])) then
pos = getCreatureLookPosition(cid)
end
ret = doTileAddItemEx(pos, item)
else
ret = doPlayerAddItemEx(cid, item, true)
end
if(ret ~= RETURNVALUE_NOERROR) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não foi possível adicionar o item: " .. t[1])
return true
end
doDecayItem(item)
if(not isPlayerGhost(cid)) then
doSendMagicEffect(pos, CONST_ME_MAGIC_RED)
end
return true
end
Editado Dezembro 26 por Oneshot
info
Grupo: Marquês
Registrado: 02/08/12
Posts: 1k
Reputação: +234
Char no Tibia: Maurolkit
Tipo: TalkAction.
Testado: Não.
@Oque Faz.
Bom ela é igual a create item normal(/i) só que personalizada impedindo que outros da staff criem items que vocês não queiram.
@Instalando.
Vá em data/talkactions/createitems e substitua todo o conteúdo que há nele por esse:
function onSay(cid, words, param, channel) if(param == '') then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você deve digitar /i nome do item, quantidade(opcional, se for stackable criara 100).") return true end local t = string.explode(param, ",") local ret = RETURNVALUE_NOERROR local pos = getCreaturePosition(cid) local allowedPlayers = {"[ADM] Castiel", "[GOD] Dean"} local blockedIds = {2150, 2159} local arq = 'createItemLogs.txt' local file = io.open("data/logs/".. arq, "a") local id = tonumber(t[1]) if(not id) then id = getItemIdByName(t[1], false) if(not id) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Esse item não existe.") return true end end if isInArray(blockedIds, id) and not isInArray(allowedPlayers, getCreatureName(cid)) then doPlayerSendTextMessage(cid, 27, "Você não pode criar este item um registro foi mandado para o hoster.") file:write("[" .. os.date("%d %B %Y %X ", os.time()) .. "] " .. getCreatureName(cid) .. " tentou criar um item proibido ID(" .. t[1] .. ")\n") return false end local amount = 100 if(t[2]) then amount = t[2] end local item = doCreateItemEx(id, amount) if(t[3] and getBooleanFromString(t[3])) then if(t[4] and getBooleanFromString(t[4])) then pos = getCreatureLookPosition(cid) end ret = doTileAddItemEx(pos, item) else ret = doPlayerAddItemEx(cid, item, true) end if(ret ~= RETURNVALUE_NOERROR) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Não foi possível adicionar o item: " .. t[1]) return true end doDecayItem(item) if(not isPlayerGhost(cid)) then doSendMagicEffect(pos, CONST_ME_MAGIC_RED) end return true endagora vá em data/logs/crie um arquivo chamado createItemLogs na extensão .txt.
@Explicando.
local allowedPlayers = {"[ADM] Castiel", "[GOD] Dean"} - pessoas autorizadas a criar qualquer item
local blockedIds = {2150, 2159} - items proibidos de criar
se não funcionar avisa ae
VLW ONESHOT
Editado Dezembro 26 por Skymagnum