larissaots 163 Postado Maio 30, 2015 Share Postado Maio 30, 2015 Créditos à Nogard. Objetivo Através de um único comando, você dará de presente, item ou dinheiro. O player será avisado. Com o comando também é possível mandar uma mensagém. Como funciona /giveto Player, gold coin (ou item id), 41 15:25 You give 41 gold coin to Player. 15:25 You received 41 gold coin from Azhaurn. /giveto Azhaurn, gold coin, 89, Presente! (: 20:31 You received 90 gold coin from Player. 20:31 Message: Presente! (: Tutorial Em talkactions/scripts crie um arquivo chamado presente.lua e então coloque esse conteúdo dentro: --Give a present!-- function onSay (cid, words, param) local s = string.explode(param, ",") if (param == "") then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Param required.") return true end if not isPlayer(getPlayerByNameWildcard(s[1])) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Player not found.") return true end if s[1] == getCreatureName(cid) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot give yourself.") return true end if s[3] == nil or s[3] == "" or s[2] == nil then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Write the item and value.") return true end -- local arr = { items = {2148, -- Items possible to give 2160, 2463}, } local g = "Items that you can give:\n\n"..getItemNameById(arr.items[1]).."\nDescription: A coin made of gold, nice present.\n\n".. getItemNameById(arr.items[2]).."\nDescription: ~~~~~~~~~\n\n" --[[-- For add more descriptions, copy this: ..getItemNameById(arr.items[Position of value in array]).."\n Description: ~~~~~~~~~\n\n" ]]-- if not isNumber(s[2]) then if isInArray(arr.items, getItemIdByName(s[2])) then if (doPlayerRemoveItem(cid, getItemIdByName(s[2]), s[3]) == true) then local bag = doPlayerAddItem(getPlayerByName(s[1]), 1990, 1) doAddContainerItem(bag, getItemIdByName(s[2]), s[3]) doSendAnimatedText(getCreaturePosition(cid), "Sucess!", COLOR_GREEN) doPlayerSendTextMessage(getPlayerByNameWildcard(s[1]), MESSAGE_STATUS_CONSOLE_ORANGE, "You received "..s[3].." "..s[2].." from "..getCreatureName(cid)..".") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You gave "..s[3].." "..s[2].." to "..s[1]..".") doSendMagicEffect(getCreaturePosition(getPlayerByName(s[1])), 28) if s[4] ~= nil then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Message: "..s[4].."\n Respectfully, "..getCreatureName(cid)..".") else return true end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You dont have this ammount.") return true end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot give this item. Please, check list.") doShowTextDialog(cid, 2105, g) return true end return true end --- if isInArray(arr.items, s[2]) then if (doPlayerRemoveItem(cid, s[2], s[3])== true) then local bag = doPlayerAddItem(getPlayerByName(s[1]), 1990, 1) doAddContainerItem(bag, s[2], s[3]) doSendAnimatedText(getCreaturePosition(cid), "Sucess!", COLOR_GREEN) doPlayerSendTextMessage(getPlayerByNameWildcard(s[1]), MESSAGE_STATUS_CONSOLE_ORANGE, "You received "..s[3].." "..getItemNameById(s[2]).." from "..getCreatureName(cid)..".") doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_RED, "You gave "..s[3].." "..getItemNameById(s[2]).." to "..s[1]..".") doSendMagicEffect(getCreaturePosition(getPlayerByName(s[1])), 28) if s[4] ~= nil then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Message: "..s[4].."\n Respectfully, "..getCreatureName(cid)..".") else return true end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You dont have this ammount.") return true end else doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You cannot give this item. Please, check list.") doShowTextDialog(cid, 2105, g) return true end return true end No talkactions.xml coloque: <talkaction words="/giveto" event="script" value="presente.lua"/> Link para o comentário Compartilhar em outros sites More sharing options...
pedrobarbalho 2 Postado Agosto 5, 2015 Share Postado Agosto 5, 2015 Não tem um comando que é possível dar qualquer item ? Link para o comentário Compartilhar em outros sites More sharing options...
Lumus 254 Postado Agosto 5, 2015 Share Postado Agosto 5, 2015 Não tem um comando que é possível dar qualquer item ? Como funciona /giveto Player, gold coin (ou item id), 41 Link para o comentário Compartilhar em outros sites More sharing options...
Posts Recomendados