CS
pedido

/i limitado

Por cs007, 12 de dez. de 2012 em Scripts

5
721
cs007C
12 de dezembro de 2012 às 00:09

Galera tem como fazer um talkactions do /i só que limitado só com os items que eu quero que ele possa fazer? valeu

SkymagnumS
12 de dezembro de 2012 às 00:35

Tem esse daqui que eu fiz só falta eu atualizar mais é rapidinho

 

http://www.xtibia.com/forum/topic/200470-create-item/page__p__1408266#entry1408266

cs007C
12 de dezembro de 2012 às 08:25

é quase isso mesmo lek, só que eu queria um que ao invés dele bloquear determinados IDs, eu queria que só pudesse fazer os items que estivessem no scripts.

caoticC
12 de dezembro de 2012 às 09:17

E só pegar o script do skymagmun e modificar:

 

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 not 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("[" .. 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

MaXwEllDeNM
12 de dezembro de 2012 às 10:07

E só pegar o script do skymagmun e modificar:

 

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 not 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("[" .. 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

Cara, variáveis que na inicialização não dependem do escopo principal não precisam ser declaradas nele, coloca elas antes da declaração do escopo principal, para economizar memória durante a execução.

 

Flw.