• 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!

TalkAction [Talkaction/CreatureEvent] Antibot-System

Joined
Apr 17, 2008
Messages
1,922
Solutions
1
Reaction score
188
Location
Venezuela
This antibot system will works in the following way:
  • Player is being online 15 minutes.
  • [Antibot]: Please say !antibot 5%8&9^2*3 without symbols. Ex: code: 1*5^8¿6%9 -> !antibot 15869. Remember that you have 2 minutes to do that or you will be kicked.
  • Player: !antibot 58923
  • [Antibot]: Enjoy your time!
  • --Else (Incorrect code)
  • [Antibot]: You have 2 more opportunities to try it again.
  • --If player says 3 times an incorrect code, will be kicked.
  • --If player don't say the correct code in the following 2 minutes (configurable), will be kicked.

First, go to data/creaturescripts/scripts/, create a file called antibot.lua and paste:
Lua:
local symbols = {"*", "^", "¿", "%", "&", "$"}

local timeBetweenQuestion = 15 * 60 --15 minutes
local timeToKick = 2 * 60 --2 minutes
local timeStorage = 65117
local codeStorage = 65118
local kickStorage = 65119
local timesStorage = 65121

function onThink(cid, interval)
	if not isPlayer(cid) or getPlayerGroupId(cid) >= 3 then
		return
	end

	if getCreatureStorage(cid, timeStorage) < 1 then doCreatureSetStorage(cid, timeStorage, os.time() + timeBetweenQuestion) end

	if getCreatureStorage(cid, kickStorage) > 0 and os.time() >= getCreatureStorage(cid, kickStorage) then
		local tmp = {timeStorage, kickStorage, timesStorage, codeStorage}
		for i = 1, #tmp do
			doCreatureSetStorage(cid, tmp[i], 0)
	end
		return doRemoveCreature(cid)
	end

	if os.time() >= getCreatureStorage(cid, timeStorage) then
		local code, set = "", 0
		set = math.random(1, 100000)
		local s, e = 1, 1
		for i = 1, string.len(set) do
			code = (code == "" and string.sub(set, s, e) or code .. symbols[math.random(#symbols)] .. string.sub(set, s, e))
			s, e = s + 1, e + 1
		end
	
		doCreatureSetStorage(cid, codeStorage, set)
		doCreatureSetStorage(cid, kickStorage, os.time() + timeToKick)
		doCreatureSetStorage(cid, timeStorage, os.time() + timeBetweenQuestion)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Antibot]: Please say !antibot " .. code .. " without symbols. Ex: code: 1*5^8¿6%9 -> !antibot 15869. Remember that you have " .. timeToKick / 60 .. " minutes to do that or you will be kicked.")
	end
	return
end

Paste this at data/creaturescripts/creaturescripts.xml:
XML:
	<event type="think" name="Antibot" event="script" value="antibot.lua"/>

Paste this at data/creaturescripts/scripts/login.lua:
Lua:
local timeStorage = 65117
local codeStorage = 65118
local kickStorage = 65119
local timesStorage = 65121
registerCreatureEvent(cid, "Antibot")
doCreatureSetStorage(cid, codeStorage, 0)
doCreatureSetStorage(cid, kickStorage, 0)
doCreatureSetStorage(cid, timesStorage, 0)
doCreatureSetStorage(cid, timeStorage, 0)

Now go to data/talkactions/scripts, create a file called antibot.lua and paste:
Lua:
local codeStorage = 65118
local kickStorage = 65119
local timesStorage = 65121
local times = 3

function onSay(cid, words, param, channel)

	if getCreatureStorage(cid, codeStorage) == 0 then
		return doPlayerSendCancel(cid, "Not yet.")
	elseif tonumber(param) == tonumber(getCreatureStorage(cid, codeStorage)) then
		doCreatureSetStorage(cid, codeStorage, 0)
		doCreatureSetStorage(cid, kickStorage, 0)
		doCreatureSetStorage(cid, timesStorage, 0)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Antibot]: Enjoy your time!")
		return true
	else
		if getCreatureStorage(cid, timesStorage) < 0 then doCreatureSetStorage(cid, timesStorage, 0) end

		doCreatureSetStorage(cid, timesStorage, getCreatureStorage(cid, timesStorage) + 1)
		if getCreatureStorage(cid, timesStorage) == times then
			doCreatureSetStorage(cid, codeStorage, 0)
			doCreatureSetStorage(cid, kickStorage, 0)
			doCreatureSetStorage(cid, timesStorage, 0)
			doRemoveCreature(cid)
			return true
		else
			return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Antibot]: You have " .. times - getCreatureStorage(cid, storageTimes) .. " opportunities to try it again.")
		end
	end
	return true
end

Now paste this at data/talkactions/talkactions.xml:
XML:
	<talkaction words="!antibot" event="script" value="antibot.lua"/>

And that's all :)
 
Player with skull = Bug abuse

// los jugadores con skull pueden aprovecharse del auto kick
 
Last edited:
Good job :D
But in Elfbot NG you can reconnect automatically.
So you have to edit the script to do it either banish 'ban' the players or prevent them to login 'onLogin' for an hour instead of kick...
 
Last edited:
Put this
Code:
return doAddAccountBanishment(getPlayerAccountId(cid),getPlayerGUID(cid), os.time() + 1*60*60, 12, 7, "Away from keyboard botter") and doRemoveCreature(cid)
instead of
Code:
return doRemoveCreature(cid)
 
hey what about a tile that is void of this so that people in trainers dont get message and also is this auto ??
 
You're clearly a talanted programmer.

Code:
local tmp = {timeStorage, kickStorage, timesStorage, codeStorage}
		for i = 1, #tmp do
			doCreatureSetStorage(cid, tmp[i], 0)
	end
Brilliant way to reset all storage values,
also I'm not as familiar with lua as much as I'd like to be.
Is '#' before the array name going to return the array size?
 
Silent, you can just implement a storage value, or just a simple tile under player position check, that can skip running the script.
 
say what im not a advance scripter yet im still starting out in a way i dont know anything about storages :/
 
22:39 [Antibot]: You have 3 opportunities to try it again.
22:39 [Antibot]: You have 3 opportunities to try it again.


why no say
3
2

how to fixed it
 
say what im not a advance scripter yet im still starting out in a way i dont know anything about storages :/
Look through the functions, I'm not sure what distro you're on. But there should be a setPlayerStorage, and a getPlayerStorage somewhere within them.
 
Can you make this system does not activate if you are attacking a Trainer?
 
22:39 [Antibot]: You have 3 opportunities to try it again.
22:39 [Antibot]: You have 3 opportunities to try it again.


why no say
3
2

how to fixed it

change this
Lua:
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Antibot]: You have " .. times - getCreatureStorage(cid, storageTimes) .. " opportunities to try it again.")
to this
Lua:
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[Antibot]: You have " .. times - getCreatureStorage(cid, timesStorage) .. " opportunities to try it again.")
in talkactions
 
hey what about a tile that is void of this so that people in trainers dont get message and also is this auto ??

Add this
Lua:
local mobName = "Trainer"
if getCreatureTarget(cid) == mobName then
 return false
end
on creature scripts
i dont test it
 
Back
Top