Postado Novembro 21, 2014 10 anos Estou Com Problemas Em Meu Script, Gostaria Que Apenas Players Sem Pz "Battlen" Usa-se Este Comando..... ----------------- function onSay(cid, words, param) local t = string.explode(param, ",") if (words == "!mp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 5000) == TRUE then local bp = doPlayerAddItem(cid, 7620, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Voce precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!gmp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 12000) == TRUE then local bp = doPlayerAddItem(cid, 7590, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Voce precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!ghp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 19000) == TRUE then local bp = doPlayerAddItem(cid, 7591, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Voce precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!gsp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 19000) == TRUE then local bp = doPlayerAddItem(cid, 8472, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Voce precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!hp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 4500) == TRUE then local bp = doPlayerAddItem(cid, 7618, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Voce precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!shp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 10000) == TRUE then local bp = doPlayerAddItem(cid, 7588, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Voce precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!smp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 8000) == TRUE then local bp = doPlayerAddItem(cid, 7589, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Voce precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!uhp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 31000) == TRUE then local bp = doPlayerAddItem(cid, 8473, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Voce precisa ser premium e ter money para usar esse comando.") return true end end -- adiciona mais aqui em cima end return TRUE end
Postado Novembro 21, 2014 10 anos Você prefere que use esse comando numa área Protection Zone piso, ou quando o player estiver sem a espadinha do Battle?
Postado Novembro 21, 2014 10 anos function onSay(cid, words, param) local t = string.explode(param, ",") if (getPlayerCondition(cid, CONDITION_INFIGHT) == TRUE) then doPlayerSendCancel(cid, "Você só pode usar o comando se não estiver com battle.") return FALSE end if (words == "!mp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 5000) == TRUE then local bp = doPlayerAddItem(cid, 7620, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Você precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!gmp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 12000) == TRUE then local bp = doPlayerAddItem(cid, 7590, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Você precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!ghp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 19000) == TRUE then local bp = doPlayerAddItem(cid, 7591, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Você precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!gsp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 19000) == TRUE then local bp = doPlayerAddItem(cid, 8472, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Você precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!hp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 4500) == TRUE then local bp = doPlayerAddItem(cid, 7618, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Você precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!shp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 10000) == TRUE then local bp = doPlayerAddItem(cid, 7588, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Você precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!smp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 8000) == TRUE then local bp = doPlayerAddItem(cid, 7589, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Você precisa ser premium e ter money para usar esse comando.") return true end end elseif (words == "!uhp") then if isPremium(cid) == TRUE and param == '' then if doPlayerRemoveMoney(cid, 31000) == TRUE then local bp = doPlayerAddItem(cid, 8473, 100) doSendMagicEffect(getPlayerPosition(cid), 30) else doPlayerSendCancel(cid, "Você precisa ser premium e ter money para usar esse comando.") return true end end end return TRUE end The medieval RpG Server [RpG] OLDWORLD OPEN TIBIA
Postado Novembro 21, 2014 10 anos Simplifiquei o seu script, optando pelo uso de parâmetros:Ex: !buy mp Usando o parâmetro "mp" (sendo as siglas de mana potion), o player irá comprar 100 mana potions pelo custo de 5000 gold coins. Basta configurar na tabela do script (já ajustei conforme o seu estava).buypotions.lua (data/talkactions/scripts): local tab = { ["mp"] = {potion = {7620, 100}, cost = 5000}, -- ["siglas da poção"] = {potion = {itemID da poção, quantidade}, cost = custo pelas poções}, ["gmp"] = {potion = {7590, 100}, cost = 12000}, ["ghp"] = {potion = {7591, 100}, cost = 19000}, ["gsp"] = {potion = {8472, 100}, cost = 19000}, ["hp"] = {potion = {7618, 100}, cost = 4500}, ["shp"] = {potion = {7588, 100}, cost = 10000}, ["smp"] = {potion = {7589, 100}, cost = 8000}, ["uhp"] = {potion = {8473, 100}, cost = 31000} } function onSay(cid, words, param, channel) local sparam = string.lower(param) if param == "" then doPlayerSendCancel(cid, "Enter the acronym of the potion you want to buy.") end if not tab[sparam] then doPlayerSendCancel(cid, "Potion not found.") end if not isPlayerPzLocked(cid) then if doPlayerRemoveMoney(cid, tab[sparam].cost) then doPlayerAddItem(cid, tab[sparam].potion[1], tab[sparam].potion[2]) doSendMagicEffect(getThingPos(cid), CONST_ME_FIREWORK_BLUE) doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You bought "..tab[sparam].potion[2].." "..getItemNameById(tab[sparam].potion[1]).."s.") else doPlayerSendCancel(cid, "You need "..tab[sparam].cost.." gold coins to buy these potions.") end else doPlayerSendCancel(cid, "You can only buy potions if you are out of battle.") end return true end A tag ficará então como sendo:talkactions.xml (data/talkactions): <talkaction words="!buy" script="buypotions.lua"/> Editado Novembro 21, 2014 10 anos por Suicide (veja o histórico de edições) The corrupt fear us. The honest support us. The heroic join us.
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.