slot1 = require("samp.events")
slot2 = ""
slot3 = false
slot4 = require("inicfg").load({
AntiAFK = {
immediateClick = false,
commandName = "antiafk",
enableAutomatically = false
},
AdminVerification = {
antiAFK = false,
distance = 10,
path = ""
}
}, "config")
function read_file(slot0)
if not io.open(slot0, "rb") then
return nil
end
slot2 = {}
for slot6 in io.lines(slot0) do
for slot10 in slot6:gmatch(".+") do
table.insert(slot2, slot10)
end
end
slot1:close()
return slot2
end
slot5 = {
jan = 1,
fev = 2,
mar = 3,
abril = 4,
maio = 5,
jun = 6,
jul = 7,
ago = 8,
set = 9,
out = 10,
nov = 11,
dez = 12
}
slot6 = {
bilhar = 2964,
bandeira = 2614,
pneu = 1327,
radar = 18880,
veado = 19315,
ferradura = 954,
hidrante = 1211,
["caixa ele"] = 19324,
guitarra = 19318,
geladeira = 19916,
capacete = 18645,
martelo = 18635,
cama = 11720,
cafeteira = 11743,
mala = 19624,
lixeira = 11706,
dinheiro = 1212,
bebida = 955,
gorro = 19065,
presente = 19054,
["rvore de natal"] = 19076,
stop = 19966,
bateria = 19609,
carne = 19582,
banana = 19578,
verde = 19576,
rvore = 714,
antena = 3763,
energia = 3244,
gua = 5838,
port = 980,
disquete = 1277,
dado = 1852,
dinamite = 1654,
mera = 19623,
chave = 11746,
esteira = 2627,
gasolina = 3465,
["ponto de"] = 1257,
lixo = 910,
bota = 11735,
garfo = 11715,
poste = 3459,
bal = 19335,
vermelho = 19332,
cabine = 1346,
cone = 1238,
skate = 19878,
extintor = 2690,
cadeira = 19999,
cigarro = 19897,
laptop = 19893,
papel = 19873,
sab = 19874,
vermelha = 19575,
vaca = 19833,
vinho = 19818,
cereal = 19562,
cerca = 19868,
telefone = 11705,
["caixa de pizza"] = 19571,
basquete = 2114,
cadeado = 19804,
asqueira = 19831,
laranja = 19574,
leite = 19569,
navio = 8493,
sema = 19964,
caldeir = 19527,
bomba = 1676,
liquidifi = 19830,
bolo = 19525,
dica = 11738
}
slot7 = false
slot8 = {
timeUnlocked = 0,
authorized = true
}
slot9 = slot4.AntiAFK.enableAutomatically
slot10 = slot4.AdminVerification.antiAFK
slot11 = slot4.AntiAFK.immediateClick
slot13 = slot4.AdminVerification.distance
slot14 = slot4.AntiAFK.commandName
slot15 = read_file(slot4.AdminVerification.path)
slot16 = true
slot17 = 1651028400
slot18 = {
"Hesoyam.",
"DoGrau."
}
function main()
repeat
wait(0)
until isSampAvailable()
sendMessageStatus = lua_thread.create_suspended(_sendMessageStatus)
sendClickAFK = lua_thread.create_suspended(_sendClickAFK)
sampRegisterChatCommand(uv0, _changeCommandActivity)
while true do
wait(0)
if not uv1.authorized and uv1.timeUnlocked < os.clock() then
uv1 = {
timeUnlocked = 0,
authorized = true
}
end
if uv2 and uv3 and uv4 then
if not uv5 then
uv4 = false
sendMessageStatus:run("Arquivo para verificar administradores {FF0000}nao{FFFFFF} encontrado. Sistema pausado!")
elseif getClosestPlayerId() >= 0 then
uv2 = false
sendMessageStatus:run("O {FDC400}Administrador(a) " .. sampGetPlayerNickname(slot0) .. "[" .. slot0 .. "]{FFFFFF} esta por perto! Anti-AFK {FF0000}desativado{FFFFFF}.")
end
end
end
end
function getClosestPlayerId()
slot0 = uv0
slot1 = -1
slot2, slot3, slot4 = getCharCoordinates(PLAYER_PED)
for slot8 = 0, 999 do
slot9, slot10 = sampGetCharHandleBySampPlayerId(slot8)
if slot9 then
for slot15, slot16 in pairs(uv1) do
if string.lower(slot16) == string.lower(sampGetPlayerNickname(slot8)) then
slot17, slot18, slot19 = getCharCoordinates(slot10)
if math.sqrt((slot17 - slot2)^2 + (slot18 - slot3)^2 + (slot19 - slot4)^2) < slot0 then
slot0 = slot20
slot1 = slot8
end
end
end
end
end
return slot1
end
function _sendMessageStatus(slot0)
wait(1)
sampAddChatMessage("[LionMODS]{FFFFFF} " .. slot0, 16739328)
end
function _changeCommandActivity()
if not uv0 then
sendMessageStatus:run("O seu plano {FF0000}venceu{FFFFFF}. Contate o desenvolvedor Lion#6221 para renovar!")
return
end
uv1 = not uv1
if uv1 then
sendMessageStatus:run("Sistema anti-AFK {148A0C}ativado{FFFFFF} com sucesso!")
else
sendMessageStatus:run("Sistema anti-AFK {FF0000}desativado{FFFFFF} com sucesso!")
end
end
function _contextualizeTextDraw(slot0, slot1)
if not uv0 or not uv1 then
return
end
slot2, slot3 = sampGetPlayerIdByCharHandle(PLAYER_PED)
if uv0 and uv1 and slot0 == 2113 or slot0 == 2055 then
if not uv2.authorized then
uv1 = false
sendMessageStatus:run("Os administradores provavelmente induziram este AFK na sua tela. Contudo, comando {FF0000}cancelado{FFFFFF}.")
return
end
uv2 = {
authorized = false,
timeUnlocked = os.clock() + 540
}
uv3 = string.lower(slot1.text)
uv4 = true
sendMessageStatus:run("Sistema de ausencia {148A0C}detectado{FFFFFF}!")
elseif uv0 and uv4 and slot1.selectable == 1 then
slot4 = math.random(5, 15)
if uv5 then
slot4 = 0
end
for slot8, slot9 in pairs(uv6) do
if string.find(uv3, slot8, 1, true) and slot1.modelId == slot9 then
sendClickAFK:run(slot0, slot4)
uv4 = false
end
end
end
end
function _sendClickAFK(slot0, slot1)
if slot1 > 0 then
sendMessageStatus:run("Dando um delay aleatorio de {9370DB}" .. slot1 .. " {FFFFFF}segundos.")
wait(slot1 * 1000)
end
sampSendClickTextdraw(slot0)
end
function slot1.onShowTextDraw(slot0, slot1)
if slot0 == 238 and string.find(slot1.text, "de", 1, true) and not uv0 then
slot2 = splitString(slot1.text, " ")
for slot6, slot7 in pairs(uv1) do
if string.find(string.lower(slot2[3]), slot6, 1, true) then
slot2[3] = slot7
end
end
slot3, slot4 = sampGetPlayerIdByCharHandle(PLAYER_PED)
slot6 = false
for slot10, slot11 in ipairs(uv2) do
if string.lower(slot11) == string.lower(sampGetPlayerNickname(slot4)) then
slot6 = true
end
end
if not slot6 then
print("Nickname de uso nao autorizado!")
return
end
if uv3 and uv4 < os.time({
year = slot2[5],
month = slot2[3],
day = slot2[1]
}) then
print("Plano anti-afk vencido!")
return
else
print("Plano anti-afk conferido!")
uv0 = true
end
end
_contextualizeTextDraw(slot0, slot1)
end
function splitString(slot0, slot1)
if slot1 == nil then
slot1 = "%s"
end
slot2 = {}
slot6 = slot1
for slot6 in string.gmatch(slot0, "([^" .. slot6 .. "]+)") do
table.insert(slot2, slot6)
end
return slot2
end
function slot1.onServerMessage(slot0, slot1)
if not uv0 or not uv1 then
return
end
if slot0 == -65366 and string.find(slot1, "resolveu o captcha com sucesso.") then
sendMessageStatus:run("Captcha desbloqueado!")
end
if uv2 and slot0 == 1221708970 and string.find(slot1, "vida recebida de", 1, true) then
uv1 = false
sendMessageStatus:run("Algum {FDC400}administrador(a){FFFFFF} lhe enviou uma mensagem. Anti-AFK {FF0000}desativado{FFFFFF}!")
end
if uv2 and slot0 == 512819114 and string.find(slot1, "veio at", 1, true) then
uv1 = false
sendMessageStatus:run("Algum {FDC400}administrador(a){FFFFFF} teleportou-se ate voce. Anti-AFK {FF0000}desativado{FFFFFF}!")
end
end
script_author("Lion")
script_name("AntiAFK")