Help, my TM system, has a problem, I add the TM a a pokemon, however I have a player adds 1 TM no one else can add a TM just like the script if it deactivates alone, if / reload.
Here my script.
Also no message appears if the pokemon can not receive TM.
This pokemon does not learn "..TM.tm .."!
And if you have the TM, if for TM repeated also no message appears.
This Pokémon has learned this TM!
Finally, if you use the item even if you do not add the TM, the item stops working and only works if you reload.
TM.lua [Actions]
Here my script.
Also no message appears if the pokemon can not receive TM.
This pokemon does not learn "..TM.tm .."!
And if you have the TM, if for TM repeated also no message appears.
This Pokémon has learned this TM!
Finally, if you use the item even if you do not add the TM, the item stops working and only works if you reload.
TM.lua [Actions]
Code:
local TM = {
[14665] = {tm = "Waterball"},
[14670] = {tm = "Dragon Claw"},
[14666] = {tm = "Water Pulse"},
[14660] = {tm = "Hypnosis"},
[14630] = {tm = "Scary Face"},
[14650] = {tm = "Poison Gas"},
[14671] = {tm = "Draco Meteor"},
[14675] = {tm = "Inferno"},
[14640] = {tm = "Bullet Seed"},
[14635] = {tm = "Rock Blast"},
[14652] = {tm = "Red Fury"},
[14651] = {tm = "Pin Missile"},
[14645] = {tm = "Ice Beam"},
[14646] = {tm = "Blizzard"},
[14655] = {tm = "Hyper Beam"},
[14636] = {tm = "Ancient Power"},
[14638] = {tm = "Power Gem"},
[14641] = {tm = "Aromateraphy"},
[14642] = {tm = "Giga Drain"},
[14682] = {tm = "Tornado"},
[14683] = {tm = "Air Slash"},
[14643] = {tm = "Leaf Blade"},
[14659] = {tm = "Meteor Smash"},
[14620] = {tm = "Thunder Bolt"},
[14621] = {tm = "Thunder"},
[14687] = {tm = "Earthquake"},
[14631] = {tm = "Dark Pulse"},
[14657] = {tm = "X-Scissor"},
[14661] = {tm = "Psychic"},
[14632] = {tm = "Shadow Ball"},
[14615] = {tm = "Rest"},
[14656] = {tm = "Tri-Attack"},
[14616] = {tm = "Reflect"},
[14617] = {tm = "Healarea"},
[14676] = {tm = "Magma Storm"},
[14677] = {tm = "Fire Blast"},
[14637] = {tm = "Rock Throw"},
[14693] = {tm = "War Dog"},
[14647] = {tm = "Icy Wind"},
[14648] = {tm = "Hydropump"},
[14662] = {tm = "Confusion"},
[14688] = {tm = "Stomp"},
[14618] = {tm = "Selfheal"},
[14619] = {tm = "Restore"},
[14692] = {tm = "Absorb"},
[14658] = {tm = "Metronome"},
[14644] = {tm = "Leaf Blade"},
[14633] = {tm = "Confuse Ray"},
[14678] = {tm = "Eruption"},
[14681] = {tm = "Razor Leaf"},
[14721] = {tm = "Aquarium"},
}
function onUse(cid, item, frompos, item2, topos)
if not TM[item.itemid] then return false end
if not isPokeball(item2.itemid) then return false end
TM = TM[item.itemid]
List = tmList[TM.tm]
if not isInArray(List.pokes, getItemAttribute(item2.uid, "poke")) then
doPlayerSendCancel(cid, "This pokemon don\'t learn "..TM.tm.."!")
return false
end
ID = 1
Have = "not"
Slot = ""
if haveFirstTM(item2) then
if getFirstTMName(item2) == TM.tm then
Have = "yes"
end
ID = ID + 1
end
if haveSecondTM(item2) then
if getSecondTMName(item2) == TM.tm then
Have = "yes"
end
ID = ID + 1
end
if haveThirdTM(item2) then
if getThirdTMName(item2) == TM.tm then
Have = "yes"
end
ID = ID + 1
end
if Have == "yes" then
doPlayerSendCancel(cid, "This pokemon have learned this TM!")
return false
end
if ID == 1 then
Slot = "First"
elseif ID == 2 then
Slot = "Second"
elseif ID == 3 then
Slot = "Third"
end
if haveAllTMs(item2) or ID == 4 or Slot == "" then
doPlayerSendCancel(cid, "This pokemon have number max of TMs!")
return false
end
addTM(item2, TM.tm, ID)
doRemoveItem(item.uid, 1)
doPlayerSendTextMessage(cid, 22, ""..getItemAttribute(item2.uid, "poke").." learn "..TM.tm.." on "..Slot.." Slot!")
return true
end