Versão: 1.1
Versão testada: 8.60 (acho que funciona em versões acima).
Descrição: O script foi criado para caso os membros da staff (CM+) do servidor quiser dar um bônus a todos os players online ele pode digitar o comando e dar o premio a todos.
Tag:
<talkaction words="!ta;/ta" access="4" event="script" value="createitemall.lua"/>
Code:
data/talkactions/createitemall.lua
function onSay(cid, words, param, channel)if(param == '') thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Command param required.")return trueendfor _, pid in ipairs(getPlayersOnline()) dolocal t = string.explode(param, ",")local ret = RETURNVALUE_NOERRORlocal pos = getCreaturePosition(cid)local id = tonumber(t[1])if(not id) thenerrors(false)id = getItemIdByName(t[1])errors(true)if(not id) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Item wich such name does not exists.")return trueendendamount = t[2]if(not t[2]) thenamount = 1endlocal item = doCreateItemEx(id, amount)if(t[3] and getBooleanFromString(t[3])) thenif(t[4] and getBooleanFromString(t[4])) thenpos = getCreatureLookPosition(cid)endret = doTileAddItemEx(pos, item)elsedoPlayerSendTextMessage(pid, MESSAGE_STATUS_CONSOLE_BLUE, "O "..getCreatureName(cid).." deu ("..amount.."x) "..getItemNameById(id).." para todos os players online.")ret = doPlayerAddItemEx(pid, item, true)endif(ret ~= RETURNVALUE_NOERROR) thendoPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Couldn't add item: " .. t[1])return trueenddoDecayItem(item)if(not isPlayerGhost(cid)) thendoSendMagicEffect(pos, CONST_ME_MAGIC_RED)endendreturn trueend
Creditos:
JackXan
Bruno Carvalho