Olá pessoal,
Tenho uma duvida em um script, ele faz o seguinte:
Se você tiver um Item (Tokens) você pode trocar por outros itens (Held's).
Porém, nesse Script a seguir, ele está só entregando um tipo de Held (Exemplo: em ITEM2, ITEM4, ITEM6, ITEM8, ITEM10... gostaria de vir chances de outros tipos de Helds).
Gostaria de saber como adicionar os outros Helds (ID's) e adicionar a função math.random para vir de forma aleatória, porfavor.
O Script atual a seguir: (onde estiver o item com a quantidade "1" é o Held)/(onde estiver com o item >=20,são os tokens)
local a = {
ITEM = {14752, 20},
ITEM2 = {14723, 1},
ITEM3 = {14750, 50},
ITEM4 = {14724, 1},
ITEM5 = {14750, 100},
ITEM6 = {14725, 1},
ITEM7 = {14750, 200},
ITEM8 = {14726, 1},
ITEM9 = {14751, 25},
ITEM10 = {14727, 1},
ITEM11 = {14751, 50},
ITEM12 = {14728, 1},
ITEM13 = {14751, 100},
ITEM14 = {14729, 1},
}
function onSay(cid, words, param, channel)
mightyCount = getPlayerItemCount(cid, mightyToken)
honoredCount = getPlayerItemCount(cid, honoredToken)
if words == "#devoted#" then
if getPlayerItemCount(cid, a.ITEM[1]) >= a.ITEM[2] then
doPlayerAddItem(cid, a.ITEM2[1], a.ITEM2[2]) <--cid, items[math.random(1, #items)], 1)-->
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu um item!")
doSendMagicEffect(getCreaturePosition(cid), 28)
doPlayerRemoveItem(cid, a.ITEM[1], a.ITEM[2])
else
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe.")
end
return TRUE
end
if words == "#mighty1#" then
if getPlayerItemCount(cid, a.ITEM3[1]) >= a.ITEM3[2] then
doPlayerAddItem(cid, a.ITEM4[1], a.ITEM4[2])
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu um item!")
doSendMagicEffect(getCreaturePosition(cid), 28)
doPlayerRemoveItem(cid, a.ITEM3[1], a.ITEM3[2])
else
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe.")
end
return TRUE
end
if words == "#mighty2#" then
if getPlayerItemCount(cid, a.ITEM5[1]) >= a.ITEM5[2] then
doPlayerAddItem(cid, a.ITEM6[1], a.ITEM6[2])
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu um item!")
doSendMagicEffect(getCreaturePosition(cid), 28)
doPlayerRemoveItem(cid, a.ITEM5[1], a.ITEM5[2])
else
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe.")
end
return TRUE
end
if words == "#mighty3#" then
if getPlayerItemCount(cid, a.ITEM7[1]) >= a.ITEM7[2] then
doPlayerAddItem(cid, a.ITEM8[1], a.ITEM8[2])
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu um item!")
doSendMagicEffect(getCreaturePosition(cid), 28)
doPlayerRemoveItem(cid, a.ITEM7[1], a.ITEM7[2])
else
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe.")
end
return TRUE
end
if words == "#honored1#" then
if getPlayerItemCount(cid, a.ITEM9[1]) >= a.ITEM9[2] then
doPlayerAddItem(cid, a.ITEM10[1], a.ITEM10[2])
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu um item!")
doSendMagicEffect(getCreaturePosition(cid), 28)
doPlayerRemoveItem(cid, a.ITEM9[1], a.ITEM9[2])
else
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe.")
end
return TRUE
end
if words == "#honored2#" then
if getPlayerItemCount(cid, a.ITEM11[1]) >= a.ITEM11[2] then
doPlayerAddItem(cid, a.ITEM12[1], a.ITEM12[2])
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu um item!")
doSendMagicEffect(getCreaturePosition(cid), 28)
doPlayerRemoveItem(cid, a.ITEM11[1], a.ITEM11[2])
else
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe.")
end
return TRUE
end
if words == "#honored3#" then
if getPlayerItemCount(cid, a.ITEM13[1]) >= a.ITEM13[2] then
doPlayerAddItem(cid, a.ITEM14[1], a.ITEM14[2])
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Voce recebeu um item!")
doSendMagicEffect(getCreaturePosition(cid), 28)
doPlayerRemoveItem(cid, a.ITEM13[1], a.ITEM13[2])
else
doSendMagicEffect(getCreaturePosition(cid), 2)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Desculpe.")
end
return TRUE
end
return true
end