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

GlobalEvent Automatic Botcheck System

gigastar

Member
Joined
Jan 25, 2009
Messages
252
Reaction score
15
1. checks for players
2. botchecks and tells them to type !botcheck
3. Sends them a message every 2 seconds for 2 minutes that they need to type !botcheck
4. Bans the botter



GlobalEvent:
Lua:
local BOTCHECKED_PLAYER_STORAGE = 25514 

local time_to_ban = 2 
local ban_days = 30 

local time_to_botcheck = 30 
local use_random_timeafter = true -- this is true it uses random_time_after, if false it uses set_time_after for each botcheck time...
local random_time_after = math.random(20, 45)
local set_time_after = 15 

function onThink(cid, interval)
for i, pid in ipairs(getPlayersOnline()) do
if getPlayerAccess(cid) <= 1 then
if getPlayerStorageValue(pid, BOTCHECKED_PLAYER_STORAGE) == 0 or getPlayerStorageValue(pid, BOTCHECKED_PLAYER_STORAGE) == nil then
	if use_random_time_after == true then 
		if random_time_after then 
addEvent(botCheck, random_time_after * 60 * 1000, pid)
end
else
addEvent(botCheck, time_to_botcheck * 60 * 1000, pid)
end
end
end
end
end

function onThink(cid, interval)
for i, pid in ipairs(getPlayersOnline()) do
if getPlayerStorageValue(pid, BOTCHECKED_PLAYER_STORAGE) == 1 then
addEvent(showBotText, 2000, pid)
end
end
end

local function showBotText()
	doPlayerSendCancel(pid, "You have been bot checked! Type !botcheck")
end


local function botCheck()
			doPlayerPopupFYI(pid, "You have been botchecked...\nPlease type !botchecked so you are not banned.")
			setPlayerStorageValue(pid, BOTCHECKED_PLAYER_STORAGE, 1)
			addEvent(banPlayer, time_to_ban * 60 * 1000, pid)
end

local function banPlayer()
if getPlayerStorageValue(pid, BOTCHECKED_PLAYER_STORAGE) == 1 then
	doAddBanishment(getAccountByAccountId(pid), ban_days, "botting", 2, "Caught by auto botcheck", "Server")
end
end


Talkaction:
Lua:
local BOTCHECKED_PLAYER_STORAGE = 25514

function onSay(cid, words, param, channel)
if getPlayerAccess(cid) ~= 0 then
return false
end

if getPlayerStorageValue(cid, BOTCHECKED_PLAYER_STROAGE) == 1 then
	setPlayerStorageValue(cid, BOTCHECKED_PLAYER_STORAGE, 0)
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT_GREEN, "You have successfully unbotcheked yourself. You will not be banned.")
else
	doPlayerSendCancel(cid, "You have not been botchecked yet.")
return false
end
end
 
I got an error in console

2h5jkuf.png


Btw im using Othire 7.72
 
And the person must be hunting for this to be activated right? xD Dumb question but want to make sure.
 
Back
Top