Everyone who has never used our Bots before, can test each one for 2 days without any limitation.
The trial is given automatically when you login on the Bot, but in some cases it wouldn't work (security reasons).
If this happens, send me a private message and i will be checking the failed trials manually and adding it for those who didn't get it.
We are looking for resellers who may accept payment methods different from ours, including classictibia's cash, realesta's cash, mastercores' cash, etc. Interested? Click here at anytime.



Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Spawn and attack Trainer
#11
It works, but bugs out once my trainer dies.
I tested it by taking my spot right next to someone who had a trainer spawned. It started attacking it, noticed it wasn't mine, so it said !train. Attacked the new one, and realized it's mine so it started attacking it.
But then my trainer died, and it refused to say !train again and it also refused to attack it if I manually wrote !train and attacked it, it stopped instantly.
A reload of the entire configuration fixed it.
Reply

#12
Try this code:
local trainerName = 'Trainer'
local intervalCheckAfterAttack = 2000 -- In milliseconds. How long should wait after attacking to find out if the trainer is yours.

if checkTrainer == nil then
    function checkTrainer(trainerId)
        attack(trainerId)

        local startCheck = runningtimems()
        while runningtimems() <= (startCheck + intervalCheckAfterAttack) do
            wait(100, 200)

            local attackedCreature = attacked()
            if attackedCreature.id > 0 and attackedCreature.id == trainerId and attackedCreature.isattackme then
                return true
            end
        end

        stopattack()

        return false
    end
end

if connected() and (LAST_TRAINER_ID == nil or attacked().id ~= LAST_TRAINER_ID) then
    if LAST_TRAINER_ID ~= nil and LAST_TRAINER_ID > 0 then
        local creature = getcreature(LAST_TRAINER_ID)
        if creature ~= nil and creature.hppc > 0 and creature.visible and creature.dist <= 1 then
            attack(LAST_TRAINER_ID)
            return
        end
    end
    
    LAST_TRAINER_ID = nil

    local creatures = getcreatures('mfs')
    for _, creature in ipairs(creatures) do
        if creature.name:lower() == trainerName:lower() and creature.dist <= 1 and checkTrainer(creature.id) then
            LAST_TRAINER_ID = creature.id
            return
        end
    end

    if LAST_TRAINER_ID == nil then
        local NEAR_TRAINERS = { }
        local creatures = getcreatures('mfs')
        for _, creature in ipairs(creatures) do
            if creature.name:lower() == trainerName:lower() and creature.dist <= 1 then
                table.insert(NEAR_TRAINERS, creature.id)
            end
        end

        say('!train')
        wait(1000, 2000)

        local creatures = getcreatures('mfs')
        for _, creature in ipairs(creatures) do
            if creature.name:lower() == trainerName:lower() and creature.dist <= 1 and table.find(NEAR_TRAINERS, creature.id) == nil and checkTrainer(creature.id) then
                LAST_TRAINER_ID = creature.id
                return
            end
        end
    end
end
Reply

#13
Yes! seems to work, nicely done.
Reply



Forum Jump:



Forum software by © MyBB Theme © iAndrew 2016