Postado Janeiro 1, 2017 8 anos Eu tenho um script: <config name="talkactionTask_conf"><![CDATA[ canGetOnlyOneTime = false task = { ['rotworm'] = {storage = 9999, beginStorageValue = 1, finishStorageValue = 2, count = 100, requiedLevelToReward = 99999999, rewards = {} } mainStorage = X function isSummon(cid) if(not isCreature(cid)) then return false end return getCreatureMaster(cid) ~= cid end function checkInfoAboutTask(tableTask) local message = '' for i = 1, #tableTask/2 do local rewardType, rewardCount = tableTask[i*2-1], tableTask[i*2] if rewardType == 'item' and type(rewardCount) == 'table' then for item = 1, #rewardCount/2 do local rewardItemId, rewardItemCount = rewardCount[item*2-1], rewardCount[item*2] message = message .. ('* ' .. rewardItemCount .. 'x ' .. getItemNameById(rewardItemId)) .. '\n' end else message = message .. ((rewardType == 'item' and '* ' .. getItemNameById(rewardCount)) or (rewardType == 'exp' and '* ' .. rewardCount .. ' Experience ') or (rewardType == 'cash' and '* ' .. rewardCount .. ' Money ') or (rewardType == 'smsPoints' and '* ' .. rewardCount .. ' Sms points ')) .. '\n' end end return message end function doAddExp(cid, amount) return doSendAnimatedText(getThingPos(cid), amount, COLOR_WHITE) and doPlayerAddExperience(cid, amount) or false end ]]></config> <talkaction words="!task" event="script"><![CDATA[ domodlib('talkactionTask_conf') function onSay(cid, words, param, channel) local taskMenu, message = task[param:lower()], '' if taskMenu and (taskMenu.potionTask and getCreatureStorage(cid, taskMenu.storage) == -1 or getCreatureStorage(cid, mainStorage) < 1) then if(canGetOnlyOneTime and getCreatureStorage(cid, taskMenu.storage) > 0) or taskMenu.potionTask and getCreatureStorage(cid, taskMenu.storage) > taskMenu.count then return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Already you have made this task!') end if taskMenu.potionTask and getCreatureStorage(cid, taskMenu.storage) > -1 then return true else doCreatureSetStorage(cid, mainStorage, taskMenu.beginStorageValue) end doCreatureSetStorage(cid, taskMenu.storage, 0) return doPlayerPopupFYI(cid, 'The decision taken, your task is to '..(taskMenu.potionTask and 'use' or 'kill')..' - ' .. taskMenu.count.. ' ' ..param:lower().. (taskMenu.count > 1 and 's' or '') .. '\nRewards which you receive for finishing this task:\n' .. checkInfoAboutTask(taskMenu.rewards) .. (taskMenu.potionTask and '' or 'If you want to abort the current job enough that you use the command "!task cancel".\n')..'If you want to know about the current job simply use the command "!task info"\nIf you wish to receive a prize for the job simply use the command !task reward\nHave Fun ^^') elseif isInArray({'cancel', 'delete', 'abort'}, param:lower()) and getCreatureStorage(cid, mainStorage) > 0 then for _, v in pairs(task) do if not v.potionTask and getCreatureStorage(cid, v.storage) >= 0 then doCreatureSetStorage(cid, mainStorage, -1) doCreatureSetStorage(cid, v.storage, -1) return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'You canceled the current task.') end end elseif isInArray({'reward', 'end', 'finish'}, param:lower()) then local rewards, showMessage = 'Items that you got as a reward is: ', false for _, v in pairs(task) do if (v.potionTask and getCreatureStorage(cid, v.storage) == v.count or getCreatureStorage(cid, mainStorage) == v.finishStorageValue) then showMessage = true if not v.potionTask then doCreatureSetStorage(cid, mainStorage, -1) else doCreatureSetStorage(cid, v.storage, v.count + 1) end if not v.requiedLevelToReward or v.requiedLevelToReward >= getPlayerLevel(cid) then for i = 1, #v.rewards/2 do local rewardType, rewardCount = v.rewards[i*2-1], v.rewards[i*2] if rewardType == 'item' and type(rewardCount) == 'table' and #rewardCount > 1 then for item = 1, #rewardCount / 2 do local rewardItemId, rewardItemCount = rewardCount[item*2-1], rewardCount[item*2] rewards = rewards .. rewardItemCount .. 'x ' .. getItemNameById(rewardItemId) .. ', ' doPlayerAddItem(cid, rewardItemId, rewardItemCount, true) end else rewards = rewards .. rewardCount .. 'x ' .. (rewardType == 'item' and getItemNameById(rewardCount) or rewardType == 'exp' and 'experience' or rewardType == 'cash' and 'money' or rewardType == 'smsPoints' and 'sms points') .. ', ' if rewardType == 'item' then doPlayerAddItem(cid, rewardCount, 1, true) elseif rewardType == 'exp' then doAddExp(cid, rewardCount) elseif rewardType == 'cash' then doPlayerAddMoney(cid, rewardCount) elseif rewardType == 'smsPoints' then db.executeQuery("UPDATE `accounts` SET `premium_points` = `premium_points` + " .. rewardCount .. " WHERE `name` = '" .. getAccountByName(getCreatureName(cid)) .. "' LIMIT 1;") end end end else rewards = 'Your experience level is too high to be able to receive the reward.' end end end return showMessage and doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string.sub(rewards, 1, string.len(rewards) - 1)..'.') else for k, v in pairs(task) do if isInArray((v.potionTask and {'potion','potions'} or {'info', 'information', 'details'}), param:lower()) and (v.potionTask and getCreatureStorage(cid, v.storage) >= 0 or getCreatureStorage(cid, mainStorage) > 0) then if (v.potionTask and getCreatureStorage(cid, v.storage) <= v.count or isInArray({v.finishStorageValue, v.beginStorageValue}, getCreatureStorage(cid, mainStorage))) then return doPlayerPopupFYI(cid, 'Your current task is to '..(v.potionTask and 'use' or 'kill')..' - ' .. v.count.. ' ' ..k:lower().. (v.count > 1 and 's' or '') .. '\nYou have killed ' .. getCreatureStorage(cid, v.storage) .. ' of ' .. v.count .. ' ' .. k:lower() .. (v.count == 1 and '' or 's') .. '. You must kill ' .. v.count - getCreatureStorage(cid, v.storage) .. ' ' .. k:lower() .. (v.count == 1 and '' or 's') .. ' yet\nRewards which you receive for finishing this task:\n' .. checkInfoAboutTask(v.rewards)) end end end end return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Wrong command!') end ]]></talkaction> <event type="kill" name="talkactionTask" event="script"><![CDATA[ domodlib('talkactionTask_conf') function onKill(cid, target) if isPlayer(target) or getCreatureMaster(target) or isNpc(target) then return true end for k, v in pairs(task) do if k:lower() == getCreatureName(target):lower() then if getCreatureStorage(cid, mainStorage) == v.beginStorageValue then if getCreatureStorage(cid, v.storage) < v.count then doCreatureSetStorage(cid, v.storage, getCreatureStorage(cid, v.storage) + 1) s = 'You killed ' .. getCreatureStorage(cid, v.storage) .. ' of ' .. v.count .. ' ' .. k:lower() .. (v.count == 1 and '' or 's') .. '.' if getCreatureStorage(cid, v.storage) == v.count then doCreatureSetStorage(cid, mainStorage, v.finishStorageValue) s = 'Congratulations! You have killed enough '.. k:lower() ..'.' end return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, s) end end end end return true end ]]></event> <event type="login" name="taskEventLogin" event="buffer"><![CDATA[ registerCreatureEvent(cid, 'talkactionTask') ]]></event> 1. Agora, quando você digita um !task monster recebe a mensagem 'Wrong command!' Como converter para receber um mensagem 'You have begun this task'? 2. Quando você digita um mensagem !task reward quer receber uma mensagem 'You have not completed the task' quando você não terminar o trabalho. Eu vou ser muito feliz se alguém pode ajudar. Editado Janeiro 1, 2017 8 anos por buchal (veja o histórico de edições)
Postado Janeiro 8, 2017 8 anos @buchal Peço que leia as regras do fórum amigo, compreendo que você precisa de ajuda em seu sistema. Mais é proibido dar up por comentários: 2.7 - Dar "UP" para subir tópicos: É totalmente proibido comentar "UP" para subir tópicos, caso você tenha a intenção você pode utilizar nosso recurso de subir tópicos e ele automaticamente irá te colocar um tempo de espera de 24 horas para realizar a função novamente. Caso o membro realize tal ato isso pode ser interpretado como flood. Bom, na primeira você deseja alterá a mensagem que aparece para o player ? Basta alterá o nome para o que você deseja. doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Wrong command!') ? Basta alterá o texto ' aqui dentro '.
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.