• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Action Train room with anti bot/afk by Gesior

Gesior.pl

Mega Noob&LOL 2012
Senator
Joined
Sep 18, 2007
Messages
2,956
Solutions
98
Reaction score
3,354
Location
Poland
GitHub
gesior
My trainer room script. Work with more then one training room place! Tested on TFS 0.2
In data/actions/actions.xml add under <actions>
PHP:
    <action actionid="39000" script="other/trainer.lua"/>
Create file data/actions/scripts/others/trainer.lua and paste:
PHP:
max_afk_time = 300
function onUse(cid, item, fromPosition, itemEx, toPosition)
    setPlayerStorageValue(cid, 39000, os.time()+max_afk_time)
    doPlayerSendCancel(cid, 'Now is ' .. os.date("%H:%M:%S", os.time()) .. '. You will be kicked from train room at ' .. os.date("%H:%M:%S", os.time()+max_afk_time) .. '!')
    if item.itemid == 1945 then
        doTransformItem(item.uid, 1946, 1)    
    elseif item.itemid == 1946 then
        doTransformItem(item.uid, 1945, 1)    
    end
    return TRUE
end
In data/movements/movements.xml add under <movements> (2 training centers):
PHP:
    <movevent event="StepIn" actionid="39001" script="trainer.lua"/>
    <movevent event="StepOut" actionid="39001" script="trainer.lua"/>
    <movevent event="StepIn" actionid="39002" script="trainer.lua"/>
    <movevent event="StepOut" actionid="39002" script="trainer.lua"/>
Create file data/movements/scripts/trainer.lua and paste:
PHP:
kick_position = {}
players_train = {}
check_train = 0
max_afk_time = 300
kick_position[1] = {x=1027,y=1046,z=7}
kick_position[2] = {x=1027,y=1047,z=6}

function onStepIn(cid, item, pos)
    if check_train == 0 then
        check_train = addEvent(checkTrainRooms, 1000, {action=1})
    end
    setPlayerStorageValue(cid, 39000, os.time()+max_afk_time)
    setPlayerStorageValue(cid, 39001, item.actionid-39000)
    table.insert(players_train,cid)
    doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,'You must push lever every 10 minutes or you will be kicked from train room!')
    return TRUE
end

function onStepOut(cid, item, pos)
    setPlayerStorageValue(cid, 39000, 0)
    setPlayerStorageValue(cid, 39001, 0)
    for targetID,creature in ipairs(players_train) do
        if creature == cid then
        table.remove(players_train,targetID)
        end
    end
    return TRUE
end

function checkTrainRooms(param)
    local cid = param.cid
    if param.action == 1 then
        for targetID,creature in ipairs(players_train) do
            if isPlayer(creature) == TRUE then
                local player_storage = getPlayerStorageValue(creature, 39000)
                if player_storage <= os.time() then
                    doTeleportThing(creature, kick_position[getPlayerStorageValue(creature, 39001)], TRUE)
                    setPlayerStorageValue(creature, 39000, 0)
                    setPlayerStorageValue(creature, 39001, 0)
                    table.remove(players_train,targetID)
                    doPlayerSendTextMessage(creature,MESSAGE_STATUS_CONSOLE_ORANGE,'You were kicked from train room! Come back later!')
                elseif player_storage - 10 <= os.time() then
                    doPlayerSendTextMessage(creature,MESSAGE_EVENT_DEFAULT,'You got ' .. player_storage - os.time() .. ' seconds to push lever or you will be kicked from train room!')
                end
            else
                table.remove(players_train,targetID)
            end
        end
        addEvent(checkTrainRooms, 1000, {action=1})
    end
end
Now open data/actions/scripts/other/doors.lua and in place of:
PHP:
    elseif isInArray(horizontalOpenDoors, item.itemid) == TRUE then
        local newPosition = toPosition
        newPosition.y = newPosition.y + 1
        local doorPosition = fromPosition
        doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
        local doorCreature = getThingfromPos(doorPosition)
        if doorCreature.itemid ~= 0 then
            if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid then
                doPlayerSendCancel(cid, "Sorry, not possible.")
            else
                doTeleportThing(doorCreature.uid, newPosition, TRUE)
                if isInArray(openSpecialDoors, item.itemid) ~= TRUE then
                    doTransformItem(item.uid, item.itemid - 1)
                end
            end
            return TRUE
        end
        doTransformItem(item.uid, item.itemid - 1)
        return TRUE
    elseif isInArray(verticalOpenDoors, item.itemid) == TRUE then
        local newPosition = toPosition
        newPosition.x = newPosition.x + 1
        local doorPosition = fromPosition
        doorPosition.stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE
        local doorCreature = getThingfromPos(doorPosition)
        if doorCreature.itemid ~= 0 then
            if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and doorCreature.uid ~= cid then
                doPlayerSendCancel(cid, "Sorry, not possible.")
            else
                doTeleportThing(doorCreature.uid, newPosition, TRUE)
                if isInArray(openSpecialDoors, item.itemid) ~= TRUE then
                    doTransformItem(item.uid, item.itemid - 1)
                end
            end
            return TRUE
        end
        doTransformItem(item.uid, item.itemid - 1)
        return TRUE
paste:
PHP:
    elseif isInArray(horizontalOpenDoors, item.itemid) == TRUE then
        local newPosition = toPosition
        newPosition.y = newPosition.y + 1
        local doorPosition = fromPosition
        doorPosition.stackpos = STACKPOS_TOP_CREATURE
        local doorCreature = getThingfromPos(doorPosition)
        if doorCreature.itemid ~= 0 then
            if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and (isCreature(doorCreature.uid) == TRUE) then
                doPlayerSendCancel(cid, "Someone block doors.")
            else
                doTeleportThing(doorCreature.uid, newPosition, TRUE)
                if isInArray(openSpecialDoors, item.itemid) ~= TRUE then
                    doTransformItem(item.uid, item.itemid - 1)
                end
            end
            return TRUE
        end
        doTransformItem(item.uid, item.itemid - 1)
        return TRUE
    elseif isInArray(verticalOpenDoors, item.itemid) == TRUE then
        local newPosition = toPosition
        newPosition.x = newPosition.x + 1
        local doorPosition = fromPosition
        doorPosition.stackpos = STACKPOS_TOP_CREATURE
        local doorCreature = getThingfromPos(doorPosition)
        if doorCreature.itemid ~= 0 then
            if getTilePzInfo(doorPosition) == TRUE and getTilePzInfo(newPosition) == FALSE and (isCreature(doorCreature.uid) == TRUE) then
                doPlayerSendCancel(cid, "Sorry, not possible.")
            else
                doTeleportThing(doorCreature.uid, newPosition, TRUE)
                if isInArray(openSpecialDoors, item.itemid) ~= TRUE then
                    doTransformItem(item.uid, item.itemid - 1)
                end
            end
            return TRUE
        end
        doTransformItem(item.uid, item.itemid - 1)
        return TRUE
It doesn't let 2 players enter 1 train room.
Scripts are ready! Now map.
Tiles:
train1um7.jpg

Action IDs:
train2sd2.jpg

Remember to set Action ID 1000+level required to enter on trainer room doors.
Players can login/logout in trainer room.
 
Last edited by a moderator:
Very good script! thanks for sharing.

There's one thing though.... if the player constantly clicks the lever it will just add him more time, which means if they've got a tasker they can train forever. It's not a huge problem during the day, when you can easily spot such players, but they could easily cheat during night time.

Nevertheless - I really like it!

There's a problem:

Code:
[24/09/2008  00:59:05] Lua Script Error: [MoveEvents Interface] 
[24/09/2008  00:59:05] in a timer event called from: 
[24/09/2008  00:59:05] data/movements/scripts/trainer.lua:onStepIn

[24/09/2008  00:59:05] attempt to index a nil value
[24/09/2008  00:59:05] stack traceback:
[24/09/2008  00:59:05]     [C]: in function 'doTeleportThing'
[24/09/2008  00:59:05]     data/movements/scripts/trainer.lua:33: in function <data/movements/scripts/trainer.lua:26>

This happens when you leave the training room before the time expires (or when it's already counting from 10 to 1, couldn't really check it), when you come back there it won't count the time for you anymore, so you could stay there forever.
 
Last edited:
Now it works great! Sweeeet! In next version try to make it so that when player tries to push the lever before the final countdown begins he'll get kicked :]
 
No offense, but I could easily make a program to beat this. The best way to catch a cheater is to visit them, while invisible (if it works) or using a level spy from above/below them, then when you see them flip the switch talk to them, and if they don't reply they are cheating. You can't do this without seeing them flip the switch because they can just say they were browsing the internet and they switch back in time to flip the switch, so they didn't see you.

Jo3
 
No offense, but I could easily make a program to beat this. The best way to catch a cheater is to visit them, while invisible (if it works) or using a level spy from above/below them, then when you see them flip the switch talk to them, and if they don't reply they are cheating. You can't do this without seeing them flip the switch because they can just say they were browsing the internet and they switch back in time to flip the switch, so they didn't see you.

Jo3
But you can add this script and delete levers and set training time = 15 minutes, then EVERY player will be kicked from train room. Normal player can go again to room, for boters it will be much harder (add few random 'kick' places to block tasker?).
 
But you can add this script and delete levers and set training time = 15 minutes, then EVERY player will be kicked from train room. Normal player can go again to room, for boters it will be much harder (add few random 'kick' places to block tasker?).

I'm not talking about using a tasker, I'm talking about a real program. The client holds information about everything on your screen, and above/below depending on where you are. I could easily use this information to find the door after I get kicked and go right back in. But most people use NG or BlackD so kick them to a random tile, and that will keep taskers from being used. Because you could set a tasker to use the door and go back if the doors in the same spot. For example:
x=ground, O=player, D=door

xxOxx
xxxxx
xxDxx

If you made it kick you to the same tile any tasker can use the door to go back in but try this:

x=ground, O = random tiles to send player, D = door, U = unique walls

xOOOx
xOOOx
UUDUU

With the unique walls make it that if you use one of these walls you get teleport somewhere away from the training area. Because a tasker could still open the door, the person would just have to set it to use a certain areas until it finds the door, but if they do that they'll more than likely hit a unique wall first and get teleported away...but you can do it however you want, I won't make a program to beat your system. :D

Jo3
 
Well you could, but seriously this is only to prevent bots like tibia auto, no one treats OT servers seriously, especially if it goes about training ;p
Try making some useful apps, instead of apps that try to beat amateur bot busters scripts.
 
Well you could, but seriously this is only to prevent bots like tibia auto, no one treats OT servers seriously, especially if it goes about training ;p
Try making some useful apps, instead of apps that try to beat amateur bot busters scripts.

Its a kool competition =D
 
Well you could, but seriously this is only to prevent bots like tibia auto, no one treats OT servers seriously, especially if it goes about training ;p
Try making some useful apps, instead of apps that try to beat amateur bot busters scripts.

I know, I was just letting him know that even a macro (tasker) could bypass his script, and how to beat a tasker. :p

Jo3
 
Version on my server:
PHP:
kick_position = {}
players_train = {}
check_train = 0
kick_position[1] = {x=228,y=710,z=9}
kick_position[2] = {x=236,y=710,z=9}
kick_position[3] = {x=244,y=711,z=9}
kick_position[4] = {x=233,y=717,z=9}
kick_position[5] = {x=244,y=718,z=9}
kick_position[6] = {x=238,y=720,z=9}
kick_position[7] = {x=227,y=721,z=9}
kick_position[8] = {x=241,y=726,z=9}
kick_position[9] = {x=233,y=728,z=9}

function onStepIn(cid, item, pos)
	if check_train == 0 then
		check_train = addEvent(checkTrainRooms, 1000, {action=1})
	end
	if getPlayerStorageValue(cid, 33300) < os.time() then
		setPlayerStorageValue(cid, 33300, os.time()+math.random(10, 20))
	end
	table.insert(players_train,cid)
	doPlayerSendTextMessage(cid,MESSAGE_EVENT_DEFAULT,'Z sali zostaniesz wyrzucony o '.. os.date("%H:%M:%S", getPlayerStorageValue(cid, 33300)) ..'! (teraz jest: '.. os.date("%H:%M:%S", os.time()) ..')')
	return TRUE
end

function onStepOut(cid, item, pos)
	for targetID,creature in ipairs(players_train) do
		if creature == cid then
			table.remove(players_train,targetID)
		end
	end
	return TRUE
end

function checkTrainRooms(param)
	local cid = param.cid
	if param.action == 1 then
		for targetID,creature in ipairs(players_train) do
			if isPlayer(creature) == TRUE then
				local player_storage = getPlayerStorageValue(creature, 33300)
				if player_storage <= os.time() then
					doTeleportThing(creature, kick_position[math.random(1,9)], TRUE)
					setPlayerStorageValue(creature, 33300, 0)
					table.remove(players_train,targetID)
					doPlayerSendTextMessage(creature,MESSAGE_STATUS_CONSOLE_ORANGE,'Zostales wyrzucony z sali treningowej!')
				end
			else
				table.remove(players_train,targetID)
			end
		end
		addEvent(checkTrainRooms, 1000, {action=1})
	end
end
No lever :)
Auto kick after 5 - 15 minuts (random), then teleport to on of 10 rooms, in this room player must go up/down to teleport, teleport tp to on of 10 random places in trainers building :p
 
Very handy, if someone uses the bot to auto-return it's very easy to spot them.
 
Last edited:
@Gesior,

Can you explain how to use the version thats in ur server,
I dont get how to work it, ActionID on the tile?
 
Damn i have an problem, when im standing at that place where it should make 2 trainers, it teleport me under that place. What could i do ?
 
Back
Top