_Aion_
Nothing Else
Hello, someone can help?
i want put to item(actionID) send opcode, with CTRL+D works perfecly.
This is my creaturescripts
and this is my module otclient
how i put on this action?
i have add: doSendPlayerExtendedOpcode(cid, 60, generateList(cid)) on action but dont work and cant show error.
i want put to item(actionID) send opcode, with CTRL+D works perfecly.
This is my creaturescripts
Lua:
elseif opcode == 53 then-- open nova dex
local UID = tonumber(buffer)
if isMonster(UID) then
if getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(UID)) <= 5 then
local name = getCreatureName(UID)
if string.lower(name) == "farfetch'd" then
name = "farfetch_d"
end
if string.lower(name) == "cacturn" then
name = "cacturne"
end
if string.lower(name) == "nidoran male" then
name = "nidoran_m"
end
if string.lower(name) == "nidoran female" then
name = "nidoran_f"
end
if isInArray({"Smeargle", "Smeargle 1", "Smeargle 2", "Smeargle 3", "Smeargle 4", "Smeargle 5", "Smeargle 6", "Smeargle 7", "Smeargle 8"}, string.lower(name)) then
name = "smeargle"
end
if string.lower(name) == "shiny farfetch'd" then
name = "shiny_farfetch_d"
end
if string.find(name, "shiny") then
local name2 = string.explode(name, " ")
name = name2[2]
end
if isInArray({"Aporygon", "Abporygon", "Big Porygon", "Tangrowth", "Magmortar", "Electivire", "Dusknoir"}, name) then
doPlayerSendCancel(cid, "Você não pode dar dex nesse pokémon.")
return false
end
if getPlayerDexInfo(cid, name).dex == 0 and not isShiny(UID) then
local exp = math.random(3000, 15000)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked ".. name.." in your pokedex!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained "..exp.." experience points.")
doPlayerAddExperience(cid, exp)
doRegisterPokemonToDex(cid, name)
end
else
doPlayerSendCancel(cid, "You are too far away to scan this pokemon")
end
end
doSendPlayerExtendedOpcode(cid, 60, generateList(cid))
and this is my module otclient
Code:
g_keyboard.bindKeyPress("Ctrl+d", function() local player = g_game.getLocalPlayer() if modules.game_console.consoleMode == 1 then return end startChoosePos() end)
function startChoosePos()
if g_ui.isMouseGrabbed() then return end
local mouseGrabberWidget = g_ui.createWidget('UIWidget')
mouseGrabberWidget:setVisible(false)
mouseGrabberWidget:setFocusable(false)
mouseGrabberWidget.onMouseRelease = onClickWithMouse
mouseGrabberWidget:grabMouse()
g_mouse.pushCursor('target')
end
function onClickWithMouse(self, mousePosition, mouseButton)
if mouseButton == MouseLeftButton or mouseButton == MouseMidButton then
local clickedWidget = modules.game_interface.getRootPanel():recursiveGetChildByPos(mousePosition, false)
if clickedWidget then
local protocol = g_game.getProtocolGame()
if clickedWidget:getClassName() == 'UIGameMap' then
local tile = clickedWidget:getTile(mousePosition)
local pos = tile:getPosition()
if tile then
local thing = tile:getTopMoveThing()
if thing:isCreature() then
if protocol then
protocol:sendExtendedOpcode(53, thing:getId())
end
if thing:isLocalPlayer() then
modules.game_pokedex.show(0)
elseif thing:isMonster() then
if string.find(getPokemonNameByOutfit(tile:getTopCreature():getOutfit().type), 'Shiny') then
modules.game_pokedex.show(getPokemonIdByName(string.lower(string.explode(getPokemonNameByOutfit(tile:getTopCreature():getOutfit().type), 'Shiny ')[2])), true)
else
modules.game_pokedex.show(getPokemonIdByName(string.lower(getPokemonNameByOutfit(tile:getTopCreature():getOutfit().type))), false)
end
print(tile:getTopCreature():getOutfit().type)
end
end
end
elseif clickedWidget:getClassName() == 'UICreatureButton' then
local creature = clickedWidget:getCreature()
protocol:sendExtendedOpcode(53, creature:getId())
end
end
end
g_mouse.popCursor('target')
self:ungrabMouse()
self:destroy()
return true
end
how i put on this action?
Lua:
local function checkDex(cid)
local unlock = 0
for i = 1, #oldpokedex do
if getPlayerInfoAboutPokemon(cid, oldpokedex[i][1]).dex then
unlock = unlock + 1
end
end
return unlock
end
local rate = 200
local sto = 63999
function onUse(cid, item, fromPos, item2, toPos)
if not isCreature(item2.uid) or isWatchingTv(cid) then
return true
end
local poke = getCreatureName(item2.uid)
if isMonster(item2.uid) then
if isInArray({"Aporygon", "Abporygon", "Hoodeasy", "Hoodeasyf", "Hoodmedium", "Hoodmediumf", "Hoodhard", "Hoodhardf", "Hoodexpert", "Hoodexpertf", "Hoodlendary", "Hoodlendaryf"}, poke) then
return true
end
local name = doCorrectString(getCreatureName(item2.uid))
local this = newpokedex[name]
local myball = 0
if isSummon(item2.uid) then
myball = getPlayerSlotItem(getCreatureMaster(item2.uid), 8)
end
if not getPlayerInfoAboutPokemon(cid, poke).dex then
local exp = this.level * rate
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have unlocked ".. getCreatureName(item2.uid).." in your pokedex!")
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have gained "..exp.." experience points.")
doSendMagicEffect(getThingPos(cid), 210)
doPlayerAddExperience(cid, exp)
doAddPokemonInDexList(cid, poke)
local name = doCorrectString(getCreatureName(item2.uid))
doShowPokedexRegistration(cid, name, myball, item2)
else
local name = doCorrectString(getCreatureName(item2.uid))
doShowPokedexRegistration(cid, name, myball, item2)
end
return true
end
if not isPlayer(item2.uid) then return true end
local kanto = 0
local johto = 0
for i = 1, #oldpokedex do
if getPlayerInfoAboutPokemon(item2.uid, oldpokedex[i][1]).dex then
if i <= 151 then
kanto = kanto+1
elseif i >= 209 then
johto = johto+1
end
end
end
return true
end
i have add: doSendPlayerExtendedOpcode(cid, 60, generateList(cid)) on action but dont work and cant show error.