
Tudo que Vodkart postou
-
Remover Battle ao entrar em PZ
@joaovitorbk9 creaturescript removepzplayer.lua function onLogin(cid) registerCreatureEvent(cid, "removePZ") return true end function onThink(cid, interval) if getTilePzInfo(getCreaturePosition(cid)) == true then doRemoveCondition(cid, CONDITION_INFIGHT) end return true end -- tag <event type="think" name="removePZ" script="removepzplayer.lua"/> <event type="login" name="loginPZ" script="removepzplayer.lua"/>
-
Ajuda com sistema de VIP ingame
function onSay(cid, words, param) local days = 2 local price = 20000000 if not doPlayerRemoveMoney(cid, price) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "voce nao tem "..price.." gps.") return true end vip.addVipByAccount(getPlayerAccount(cid) ,vip.getDays(tonumber(days))) doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você recebeu "..days.." dias de VIP, bom jogo!") return true end @Naze vai retornar erro no seu c´pdigo por causa dessa função que adiciona o vip days: getPlayerAccount(getPlayerByName(name)) -- a variavel name não existe, então n vai adicionar pra nenhum jogador
-
(Resolvido)Problemas com o sistema de reset
local config = { level_remain= 130, exp_remain= 34963300, levels_reset= {1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000} } function getPlayerResets(cid) local consulta = db.getResult("SELECT `reset` FROM `players` WHERE `id` = "..getPlayerGUID(cid)) return consulta:getDataInt('reset') <= 0 and 0 or consulta:getDataInt('reset') end function setPlayerReset(cid) local ret = (getPlayerResets(cid) + 1) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doRemoveCreature(cid) db.query("UPDATE `players` SET `level` = "..config.level_remain..", `experience` = "..config.exp_remain..", `reset` = "..ret.." WHERE `id` = "..getPlayerGUID(cid)) return true end function onSay(cid, words, param, channel) if (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then doPlayerSendTextMessage(cid,22,"Voce Precisa estar sem Battle para Resetar.") return TRUE end local resets = getPlayerResets(cid) if (getPlayerLevel(cid) >= config.levels_reset[resets+1]) then setPlayerReset(cid) else doPlayerSendTextMessage(cid,22,"Voce nao tem level minimo para o reset.") end return true end
-
[Raid Automatica] MOD Raid Automatica Edit: Brunds
@BangxD no meu último post eu coloquei para não summonar monstro na agua e nem em houses! coloquei efeito quando for removido e quando eles nascer tbm... @Brunds removi esses erros no ultimo post ali que dei um upgrade no código
-
[Raid Automatica] MOD Raid Automatica Edit: Brunds
<?xml version="1.0" encoding="UTF-8"?> <mod name="Automatic Raids" version="1.0" author="Vodkart And xotservx" contact="tibiaking.com" enabled="yes"> <config name="raids_func"> -- Mini-tutorial de configuração -- Não esqueça de configurar os horários que o evento vai iniciar (OBS: O script sempre pega o horário da maquina caso a sua maquina ou vps -- usar horário de outros lugares vai ter atraso dependendo do fuso-horário -- nome = Nome do evento que vai mostrar em mensagem vermelha para o servidor todo -- pos = fromPosition = Canto Superior Direito -- pos = toPosition = Canto Inferior Esquerdo -- Configurando a pos corretamente pode formar um quadrado ou retangulo para os monstro não nascerem um em cima do outro -- m = Quantidade e tipos de monstro a serem criados, pode seguir a lógica do nome do evento podendo colocar Orc porém na invasão vai ter orc, orc shaman, orc spear etc... -- Time = Tempo que a invasão vai durar caso colocar time = 10 a invasão vai durar 10 minutos depois de 10 minutos os monstros restantes serão removidos <![CDATA[ days = { -- Segunda ["Monday"] = { ["17:00"] = {nome = "Renegados", pos = {fromPosition = {x=1019, y=916, z=7},toPosition = {x=1033, y=922, z=7}},m = {"6 Renegade", "5 Bandit", "2 Shinobi Archer"}, Time = 1}, ["22:00"] = {nome = "Dragon", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}},m = {"100 Dragon"}, Time = 20} }, -- Terça ["Tuesday"] = { ["17:00"] = {nome = "Demon", pos = {fromPosition = {x=202, y=11, z=7},toPosition = {x=204, y=12, z=7}}, m = {"1 Demon"}, Time = 15}, ["22:00"] = {nome = "Hydra", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}}, m = {"7 Hydra", "4 Cyclops"}, Time = 20} }, -- Quarta ["Wednesday"] = { ["17:00"] = {nome = "Demon", pos = {fromPosition = {x=202, y=11, z=7},toPosition = {x=204, y=12, z=7}}, m = {"1 Demon"}, Time = 15}, ["22:00"] = {nome = "Hydra", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}}, m = {"7 Hydra", "4 Cyclops"}, Time = 20} }, -- Quinta ["Tursday"] = { ["17:00"] = {nome = "Demon", pos = {fromPosition = {x=202, y=11, z=7},toPosition = {x=204, y=12, z=7}}, m = {"1 Demon"}, Time = 15}, ["22:00"] = {nome = "Hydra", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}}, m = {"7 Hydra", "4 Cyclops"}, Time = 20} }, -- Sexta ["Friday"] = { ["17:00"] = {nome = "Demon", pos = {fromPosition = {x=202, y=11, z=7},toPosition = {x=204, y=12, z=7}}, m = {"1 Demon"}, Time = 15}, ["22:00"] = {nome = "Hydra", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}}, m = {"7 Hydra", "4 Cyclops"}, Time = 20} }, -- Sábado ["Saturday"] = { ["17:00"] = {nome = "Demon", pos = {fromPosition = {x=202, y=11, z=7},toPosition = {x=204, y=12, z=7}}, m = {"1 Demon"}, Time = 15}, ["22:00"] = {nome = "Hydra", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}}, m = {"7 Hydra", "4 Cyclops"}, Time = 20} }, -- Domingo ["Sunday"] = { ["20:33"] = {nome = "renegados", pos = {fromPosition = {x=1019, y=916, z=7},toPosition = {x=1033, y=922, z=7}}, m = {"1 Renegade", "1 Bandit", "1 Shinobi Archer"}, Time = 1}, ["22:00"] = {nome = "Hydra", pos = {fromPosition = {x=197, y=57, z=7},toPosition = {x=203, y=60, z=7}}, m = {"7 Hydra", "4 Cyclops"}, Time = 20} } } ]]></config> <globalevent name="AutomaticRaids" interval="60" event="script"><![CDATA[ domodlib('raids_func') function onThink(interval, lastExecution) function isWalkable(pos) -- by Nord / editado por Omega if getTileThingByPos({x = pos.x, y = pos.y, z = pos.z, stackpos = 0}).itemid == 0 then return false elseif isCreature(getTopCreature(pos).uid) then return false elseif getTileInfo(pos).protection then return false elseif hasProperty(getThingFromPos(pos).uid, 3) or hasProperty(getThingFromPos(pos).uid, 7) then return false end return true end if days[os.date("%A")] then hours = tostring(os.date("%X")):sub(1, 5) tb = days[os.date("%A")][hours] if tb then function removeCreature(tb) for x = ((tb.pos.fromPosition.x)-20), ((tb.pos.toPosition.x)+20) do for y = ((tb.pos.fromPosition.y)-20), ((tb.pos.toPosition.y)+20) do local m = getTopCreature({x=x, y=y, z= tb.pos.fromPosition.z}).uid if m ~= 0 and isMonster(m) then doSendMagicEffect(getCreaturePosition(m), CONST_ME_MORTAREA) doRemoveCreature(m) end end end end doBroadcastMessage("Uma orda de " .. tb.nome .. " esta invadindo a cidade ajude a defende-la") -- Mensagem que vai aparecer para todos do servidor quando a invasão iniciar for _ , x in pairs(tb.m) do local c = tonumber(x:match("%d+")) if c > 0 then repeat local pos = {x = math.random(tb.pos.fromPosition.x, tb.pos.toPosition.x), y = math.random(tb.pos.fromPosition.y, tb.pos.toPosition.y), z = tb.pos.fromPosition.z} if isWalkable(pos) then doCreateMonster(x:match("%s(.+)"), pos) doSendDistanceShoot({x = pos.x - math.random(4, 6), y = pos.y - 5, z = pos.z}, pos, CONST_ANI_FIRE) addEvent(doSendMagicEffect, 150, pos, CONST_ME_HITBYFIRE) addEvent(doSendMagicEffect, 150, pos, CONST_ME_FIREAREA) doSendMagicEffect(pos, CONST_ME_MORTAREA) c = c-1 end until c == 0 end end addEvent(removeCreature, tb.Time*60*1000, tb) addEvent(doBroadcastMessage, tb.Time*60*1000, "A invasão de " .. tb.nome .. " acabou, os sobreviventes fugiram") -- Mensagem que vai aparecer para todos do servidor quando a invasão iniciar end end return true end ]]></globalevent> </mod>
-
(Resolvido)[PEDIDO] effect no monstro ao player aparecer na tela
@Brunds Da para fazer todos os monstro que estejam na tela sair um efeito, mas não teria como colocar uma storage neles por exemplo, para saber se ja saiu efeito nele ou não...
-
(Resolvido)[PEDIDO] effect no monstro ao player aparecer na tela
function onThink(cid, interval, lastExecution) local monster_name = "Boss Iziris" -- nome do monstro local storage, exhausted = 986542, 60 local effect = 45 local t = getSpectators(getPlayerPosition(cid), 7, 5, false) -- tela do player 7x5 sqm (pode alterar) if t then for _, ret in ipairs(t) do if isMonster(ret) and getCreatureName(ret) == monster_name and getGlobalStorageValue(storage) <= os.time() then setGlobalStorageValue(storage, os.time()+exhausted) doSendMagicEffect(getCreaturePosition(ret), effect) end end end return true end @Brunds acho que não dá certo, porque o cid dos monstros é único, digamos que para todos os demons seja 38374767
-
(Resolvido)Colocar Look Para mostrar...
@mullino entao deixa eu ver o script que adiciona dodge e critical, usei pela storage ali dos códigos: local dodge, critic = 48902,48903
-
Spell Rune
então para evitar que induza o jogador ao erro, vou colocar para funcionar só em uma bp, sendo que por exemplos os IDS configurados sejam: potion : 9999 parcel: 9998 BP: 9997 ao dar use na Bp que tem 20 slots, se tiver uma BP dentro de outra BP - vai retornar um erro ou dentro desses 20 slots tenha um ID que não esteja naquela lista, por exemplo de uma golden legs, vai retornar erro dizendo que dentro da BP tem item que não pode ser desintegrado.
-
Necessito de ajuda com Função de Backpack para NPC
posta o npc inteiro
-
(Resolvido)[PEDIDO] effect no monstro ao player aparecer na tela
Não tem dificuldade nesse código, só fazer pelo creaturescript no onTarget, para que se estiver na tela do monstro (7x7 sqm que é a visão do montro e não me engano), vai soltar uns efeitos de area ou no player, no monstro, etc... ---------------------------------- registra no onLogin e cria a tag function onThink(cid, interval, lastExecution) local monster_name = "Boss Iziris" -- nome do monstro local storage = 986542 local effect = 45 local var = {} local t = getSpectators(getPlayerPosition(cid), 7, 5, false) -- tela do player 7x5 sqm (pode alterar) if t then for _, ret in ipairs(t) do if isMonster(ret) and getCreatureName(ret) == monster_name then var[#var+1] = ret end end if #var > 0 then setPlayerStorageValue(cid, storage, 1) doSendMagicEffect(getCreaturePosition(var[1]), effect) else setPlayerStorageValue(cid, storage, 0) end end return true end
-
Spell Rune
então qualquer BP vai dar para desintegrar, mas ela tem que estar vazia? Se tiver uma potion dentro, ele não vai contar tipo: Dinheiro da BP + Dinheiro da Potion
-
(Resolvido)Colocar Look Para mostrar...
@mullino function getPlayerFrags(cid) local time = os.time() local times = {today = (time - 86400), week = (time - (7 * 86400))} local contents, result = {day = {}, week = {}, month = {}}, db.getResult("SELECT `pd`.`date`, `pd`.`level`, `p`.`name` FROM `player_killers` pk LEFT JOIN `killers` k ON `pk`.`kill_id` = `k`.`id` LEFT JOIN `player_deaths` pd ON `k`.`death_id` = `pd`.`id` LEFT JOIN `players` p ON `pd`.`player_id` = `p`.`id` WHERE `pk`.`player_id` = " .. getPlayerGUID(cid) .. " AND `k`.`unjustified` = 1 AND `pd`.`date` >= " .. (time - (30 * 86400)) .. " ORDER BY `pd`.`date` DESC") if(result:getID() ~= -1) then repeat local content = {date = result:getDataInt("date")} if(content.date > times.today) then table.insert(contents.day, content) elseif(content.date > times.week) then table.insert(contents.week, content) else table.insert(contents.month, content) end until not result:next() result:free() end local size = { day = table.maxn(contents.day), week = table.maxn(contents.week), month = table.maxn(contents.month) } return size.day + size.week + size.month end function getDeathsAndKills(cid, type) -- by vodka local query,d = db.getResult("SELECT `player_id` FROM "..(tostring(type) == "kill" and "`player_killers`" or "`player_deaths`").." WHERE `player_id` = "..getPlayerGUID(cid)),0 if (query:getID() ~= -1) then repeat d = d+1 until not query:next() query:free() end return d end function GetPatenteLook(cid) local ranks, kills = { [{0, 9}] = "Iniciante", [{10, 49}] = "Ganguests", [{50, 99}] = "Assassino", [{100, 149}] = "Dead", [{150, 199}] = "Sanguinario", [{200, math.huge}] = "Killer" },getDeathsAndKills(cid, "kill") for v , r in pairs(ranks) do if kills >= v[1] and kills <= v[2] then return r end end end function getResets(cid) local query = db.getResult("SELECT `resets` FROM `players` WHERE `id`= "..getPlayerGUID(cid)) return query:getDataInt("resets") <= 0 and 0 or query:getDataInt("resets") end local dodge, critic = 48902,48903 function onLogin(cid) registerCreatureEvent(cid, "newlook") return true end function onLook(cid, thing, position, lookDistance) if isPlayer(thing.uid) and thing.uid ~= cid then doPlayerSetSpecialDescription(thing.uid,"\n[Reset: "..getResets(thing.uid).."] [Critical: "..getPlayerStorageValue(thing.uid, critic).."] [Dodge: "..getPlayerStorageValue(thing.uid, dodge).."]\n"..(getPlayerSex(thing.uid) == 0 and "Ela" or "Ele").." Matou ["..getDeathsAndKills(thing.uid, "kill").."]Players.\n"..(getPlayerSex(thing.uid) == 0 and "Ela" or "Ele").." Morreu ["..getDeathsAndKills(thing.uid, "death").."] Vezes...\nSua Patente é "..GetPatenteLook(thing.uid)..".") return true elseif thing.uid == cid then doPlayerSetSpecialDescription(cid,"\n[Reset: "..getResets(cid).."] [Critical: "..getPlayerStorageValue(cid, critic).."] [Dodge: "..getPlayerStorageValue(cid, dodge).."]\nVoce Matou ["..getDeathsAndKills(cid, "kill").."]Players.\nVoce Morreu ["..getDeathsAndKills(cid, "death").."] Vezes...\nSua Patente é "..GetPatenteLook(cid)..".") local string = 'You see yourself.' if getPlayerFlagValue(cid, PLAYERFLAG_SHOWGROUPINSTEADOFVOCATION) then string = string..' You are '.. getPlayerGroupName(cid) ..'.' elseif getPlayerVocation(cid) ~= 0 then string = string..' You are '.. getPlayerVocationName(cid) ..'.' else string = string..' You have no vocation.' end string = string..getPlayerSpecialDescription(cid)..'\n' if getPlayerGuildId(cid) > 0 then string = string..' You are ' .. (getPlayerGuildRank(cid) == '' and 'a member' or getPlayerGuildRank(cid)) ..' of the '.. getPlayerGuildName(cid) string = getPlayerGuildNick(cid) ~= '' and string..' ('.. getPlayerGuildNick(cid) ..').' or string..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEECREATUREDETAILS) then string = string..'\nHealth: ['.. getCreatureHealth(cid) ..' / '.. getCreatureMaxHealth(cid) ..'], Mana: ['.. getCreatureMana(cid) ..' / '.. getCreatureMaxMana(cid) ..'].' string = string..'\nIP: '.. doConvertIntegerToIp(getPlayerIp(cid)) ..'.' end if getPlayerFlagValue(cid, PLAYERCUSTOMFLAG_CANSEEPOSITION) then string = string..'\nPosition: [X:'.. position.x..'] [Y:'.. position.y..'] [Z:'.. position.z..'].' end doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, string) return false end return true end
-
[CREATURESCRIPT] Como eu tiro esse error?
O erro é bem simples, tem uma linha que seria essa: local lvl = getPlayerLevel(target) deveria estar depois de checar se realmente o target é player, porque no caso se atacar um monstro vai retornar esses erros tudo, então deveria estar depois dessa linha: if isPlayer(cid) and isPlayer(target) then ficando: function onKill(cid, target, lastHit) local exp1 = 1 local exp11 = 2 local exp2 = 3 local exp22 = 6 local exp3 = 9 local exp33 = 18 local exp4 = 27 local exp44 = 54 local exp5 = 81 local exp55 = 162 local exp6 = 243 if isPlayer(cid) and isPlayer(target) then local lvl = getPlayerLevel(target) if getPlayerIp(cid) == getPlayerIp(target) then doCreatureSay(cid, "Voce nao recebe EXP por matar MC", TALKTYPE_ORANGE_1) return true end if getPlayerLevel(target) > 1 and getPlayerLevel(target) < 5000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "10000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp1 * lvl) elseif getPlayerLevel(target) > 5000 and getPlayerLevel(target) < 10000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "20000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp11 * lvl) elseif getPlayerLevel(target) > 10000 and getPlayerLevel(target) < 15000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "30000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp2 * lvl) elseif getPlayerLevel(target) > 15000 and getPlayerLevel(target) < 20000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "40000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp22 * lvl) elseif getPlayerLevel(target) > 20000 and getPlayerLevel(target) < 25000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "50000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp3 * lvl) elseif getPlayerLevel(target) > 25000 and getPlayerLevel(target) < 30000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "60000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp33 * lvl) elseif getPlayerLevel(target) > 30000 and getPlayerLevel(target) < 35000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "70000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp4 * lvl) elseif getPlayerLevel(target) > 35000 and getPlayerLevel(target) < 40000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "80000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp44 * lvl) elseif getPlayerLevel(target) > 40000 and getPlayerLevel(target) < 45000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "90000000", 215) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp5 * lvl) elseif getPlayerLevel(target) > 45000 and getPlayerLevel(target) < 50000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "100000000", 210) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp55 * lvl) elseif getPlayerLevel(target) > 50000 and getPlayerLevel(target) < 90000 and getPlayerLevel(cid) > 1 then doSendAnimatedText(getPlayerPosition(cid), "110000000", 210) doPlayerAddExperience(cid, getPlayerLevel(cid) * exp6 * lvl) end end return true end fica ai de aprendizagem.
-
Ajuda com sistema de Reset
@Weeeh16 tem sim, qual o sistema e os códigos que vc utiliza?
-
(Resolvido)Colocar Look Para mostrar...
qual teu sistema de critical e dodge? o reset vai aparecer como no look? [Resets: 50][Critical: 10][Dodge: 100] ??? olha que estranho que ficaria kkk
-
Ajuda com sistema de Reset
local config = { level_remain= 130, exp_remain= 34963300, levels_reset= {1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000} } function getPlayerResets(cid) local consulta = db.getResult("SELECT `reset` FROM `players` WHERE `id` = "..getPlayerGUID(cid)) return consulta:getDataInt('reset') <= 0 and 0 or consulta:getDataInt('reset') end function setPlayerReset(cid) doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid))) doRemoveCreature(cid) db.query("UPDATE `players` SET `level` = "..config.level_remain..", `experience` = "..config.exp_remain..", `reset` = `reset`+1 WHERE `id` = "..getPlayerGUID(cid)) return true end function onSay(cid, words, param, channel) if (getCreatureCondition(cid, CONDITION_INFIGHT) == TRUE) then doPlayerSendTextMessage(cid,22,"Você Precisa estar sem Battle para Resetar.") return TRUE end local resets = getPlayerResets(cid) if (getPlayerLevel(cid) >= config.levels_reset[resets+1]) then setPlayerReset(cid) else doPlayerSendTextMessage(cid,22,"Voce nao tem level minimo para o reset.") end return true end
-
(Resolvido)[Erro] Script deixa você com Pontos negativo
function onTradeAccept(cid, target, item, targetItem) if isPlayer(cid) and isPlayer(target) then if item.itemid == Points_Trade.Document_ItemID then local var = DocumentPoints(item) if getPlayerPoints(cid) >= var then doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "Você recebeu ".. var .." premium points.") doPlayerAddPoints(target, var) doPlayerRemovePoints(cid, var) addEvent(doPlayerRemoveItem, 1, target, Points_Trade.Document_ItemID, 1) end end if targetItem.itemid == Points_Trade.Document_ItemID then local var = DocumentPoints(targetItem) if getPlayerPoints(target) >= var then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você recebeu ".. var .." premium points.") doPlayerAddPoints(cid, var) doPlayerRemovePoints(target, var) addEvent(doPlayerRemoveItem, 1, cid, Points_Trade.Document_ItemID, 1) end end end return true end function onTradeRequest(cid, target, item) if item.itemid == Points_Trade.Document_ItemID then if getPlayerPoints(cid) < DocumentPoints(item) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você não tem ".. DocumentPoints(item) .." para realizar uma troca.") return false end end return true end
-
(Resolvido)[Erro] Script deixa você com Pontos negativo
@Phineasz testa assim: function onTradeAccept(cid, target, item, targetItem) if isPlayer(cid) and isPlayer(target) then if getGlobalStorageValue(895413) <= os.time() then if item.itemid == Points_Trade.Document_ItemID then doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "Você recebeu ".. DocumentPoints(item) .." premium points.") doPlayerAddPoints(target, DocumentPoints(item)) doPlayerRemovePoints(cid, DocumentPoints(item)) addEvent(doPlayerRemoveItem, 1, target, Points_Trade.Document_ItemID, 1) end if targetItem.itemid == Points_Trade.Document_ItemID then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você recebeu ".. DocumentPoints(targetItem) .." premium points.") doPlayerAddPoints(cid, DocumentPoints(targetItem)) doPlayerRemovePoints(target, DocumentPoints(targetItem)) addEvent(doPlayerRemoveItem, 1, cid, Points_Trade.Document_ItemID, 1) end setGlobalStorageValue(895413, os.time()+2) end end return true end function onTradeRequest(cid, target, item) if item.itemid == Points_Trade.Document_ItemID then if getPlayerPoints(cid) < DocumentPoints(item) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você não tem ".. DocumentPoints(item) .." para realizar uma troca.") return false end end return true end
-
(Resolvido)[Erro] Script deixa você com Pontos negativo
@Phineasz Mano, só editei aquela parte ali, mas era pra copiar tudo ne function onTradeAccept(cid, target, item, targetItem) if isPlayer(cid) and isPlayer(target) then if item.itemid == Points_Trade.Document_ItemID then local var = DocumentPoints(item) if doPlayerRemovePoints(cid, var) then doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "Você recebeu ".. var .." premium points.") doPlayerAddPoints(target, var) addEvent(doPlayerRemoveItem, 1, target, Points_Trade.Document_ItemID, 1) end return true end if targetItem.itemid == Points_Trade.Document_ItemID then local ret = DocumentPoints(targetItem) if doPlayerRemovePoints(target, ret) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você recebeu ".. DocumentPoints(targetItem) .." premium points.") doPlayerAddPoints(cid, ret) addEvent(doPlayerRemoveItem, 1, cid, Points_Trade.Document_ItemID, 1) end return true end end return true end function onTradeRequest(cid, target, item) if item.itemid == Points_Trade.Document_ItemID then if getPlayerPoints(cid) < DocumentPoints(item) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você não tem ".. DocumentPoints(item) .." para realizar uma troca.") return false end end return true end
-
(Resolvido)[Erro] Script deixa você com Pontos negativo
@Phineasz parece que esta repetindo 2x o código. function onTradeAccept(cid, target, item, targetItem) if isPlayer(cid) and isPlayer(target) then if item.itemid == Points_Trade.Document_ItemID then local var = DocumentPoints(item) if doPlayerRemovePoints(cid, var) then doPlayerSendTextMessage(target, MESSAGE_STATUS_WARNING, "Você recebeu ".. var .." premium points.") doPlayerAddPoints(target, var) addEvent(doPlayerRemoveItem, 1, target, Points_Trade.Document_ItemID, 1) end return true end if targetItem.itemid == Points_Trade.Document_ItemID then local ret = DocumentPoints(targetItem) if doPlayerRemovePoints(target, ret) then doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Você recebeu ".. DocumentPoints(targetItem) .." premium points.") doPlayerAddPoints(cid, ret) addEvent(doPlayerRemoveItem, 1, cid, Points_Trade.Document_ItemID, 1) end return true end end return true end testa assim, se continuar duplicando eu coloco outra coisa.
-
(Resolvido)[Erro] Script deixa você com Pontos negativo
troca essa função: function getPlayerPoints(cid) local AccountID = getPlayerAccountId(cid) local Points = 0 local Result = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = ".. AccountID .."") if Result:getID() ~= -1 then Points = Result:getDataInt("premium_points") end return tonumber(Points) end por essa: function getPlayerPoints(cid) local AccountID = getPlayerAccountId(cid) local Result = db.getResult("SELECT `premium_points` FROM `accounts` WHERE `id` = ".. AccountID) return Result:getDataInt("premium_points") <= 0 and 0 or Result:getDataInt("premium_points") -- DataInt é number. end e o script do npc deixa assim: local keywordHandler = KeywordHandler:new() local npcHandler = NpcHandler:new(keywordHandler) NpcSystem.parseParameters(npcHandler) local talkState = {} function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end function onThink() npcHandler:onThink() end function greetCallback(cid) talkState[cid] = 0 return true end function creatureSayCallback(cid, type, msg) if (not npcHandler:isFocused(cid)) then return false end if talkState[cid] == nil or talkState[cid] == 0 then Count_Points = tonumber(msg) if isInArray(Points_Trade.Points, Count_Points) then npcHandler:say("Do you want to buy a premium points transfer document that will transfer ".. Count_Points .." premium points, right?", cid) talkState[cid] = 1 else npcHandler:say("Escolha um numero entre ".. table.concat(Points_Trade.Points, ', ') ..".", cid) talkState[cid] = 0 end elseif talkState[cid] == 1 then if msgcontains(msg, 'yes') then if getPlayerPoints(cid) >= Count_Points then local Document = doCreateItemEx(Points_Trade.Document_ItemID) doItemSetAttribute(Document, "name", "".. Count_Points .." premium points transfer document") doItemSetAttribute(Document, "points", Count_Points) doPlayerAddItemEx(cid, Document) doPlayerRemovePoints(cid, Count_Points) npcHandler:say("Você obteve um documento que vale ".. Count_Points .." premium points, use ele no trade com alguem.", cid) talkState[cid] = 0 else npcHandler:say("Desculpe, mas voce nao tem ".. Count_Points .." Points.", cid) talkState[cid] = 0 end else npcHandler:say("Ok, volte mais tarde.", cid) talkState[cid] = 0 end end return true end npcHandler:setMessage(MESSAGE_GREET, "Ola |PLAYERNAME|. Eu vendo alguns utensílios e Premium Points transfers para você transferir pontos para outros jogadores, lembre-se para comprar use '10,ppt' para 10 pontos.") npcHandler:setCallback(CALLBACK_GREET, greetCallback) npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback) npcHandler:addModule(FocusModule:new())
-
(Resolvido)[ERRO] Effect ao item dropar de um monstro!
@Yamborghini local stone_effects = { --[itemid] = effect, --Ex.: [11447] = 297, [11442] = 298, } local function sendEffStone(cid, pos, stones) if not isCreature(cid) then return true end for i = 1, 255 do pos.stackpos = i local item = getTileThingByPos(pos) if item.uid ~= 0 then if isContainer(item.uid) then if isContainer(item.uid) and getContainerSize(item.uid) > 0 then for slot=0, (getContainerSize(item.uid)-1) do local stone = getContainerItem(item.uid, slot) if isInArray(stones, stone.itemid) and stone_effects[stone.itemid] then doSendMagicEffect({x= pos.x+1, y= pos.y, z= pos.z}, stone_effects[stone.itemid]) end end end end end end end function onKill(cid, target) local stones = {11453, 11441, 11442, 11443, 11444, 11445, 11446, 11447, 11448, 11449, 11450, 11451, 11452, 11454, 12244, 12232, 12242, 12417, 12419, 12245, 12401, 12402, 12403, 12404, 12405, 12406, 12407, 12408, 12409, 12410, 12411, 12412, 12413, 12414} --id de todas as stones if ehMonstro(target) and isPlayer(cid) then local pos = getThingPos(target) local pid = getCreatureSummons(cid)[1] addEvent(sendEffStone, 150, pid, pos, stones) end return true end
-
(Resolvido)Coal Basin acendendo e apagando
ta mas essa strong potion funciona no seu ot? porque como seria uma "action" teria que editar o script do potion que heala para atribur nova função...
-
(Resolvido)[ERRO] Effect ao item dropar de um monstro!
local stone_effects = { --[itemid] = effect, --Ex.: [11447] = 297, [11442] = 298, } local function sendEffStone(cid, pos, stones) if not isCreature(cid) then return true end for i = 1, 255 do pos.stackpos = i local item = getTileThingByPos(pos) if item.uid ~= 0 then if isContainer(item.uid) then if isContainer(item.uid) and getContainerSize(item.uid) > 0 then for slot=0, (getContainerSize(item.uid)-1) do local stone = getContainerItem(item.uid, slot) if isInArray(stones, stone.itemid) and stone_effects[stone.itemid] then doSendMagicEffect(pos, stone_effects[stone.itemid]) end end end end end end end function onKill(cid, target) local stones = {11453, 11441, 11442, 11443, 11444, 11445, 11446, 11447, 11448, 11449, 11450, 11451, 11452, 11454, 12244, 12232, 12242, 12417, 12419, 12245, 12401, 12402, 12403, 12404, 12405, 12406, 12407, 12408, 12409, 12410, 12411, 12412, 12413, 12414} --id de todas as stones if ehMonstro(target) and isPlayer(cid) then local pos = getThingPos(target) local pid = getCreatureSummons(cid)[1] addEvent(sendEffStone, 150, pid, pos, stones) end return true end