slot0 = require("samp.events")
slot1 = false
slot2 = false
slot3 = {
enabled = true,
waitingPlayer = false
}
slot4 = {}
slot5 = {}
slot6 = {
nickname = "",
id = 0
}
slot7 = {
-12255062,
1492823210,
-65366,
-2909270,
10420394,
2130771798
}
slot8 = {
{
text = "recusou a Liberdade",
nicknameVerification = true,
key = "player-refused"
},
{
text = "bloqueado, aguarde alguns segundos!",
nicknameVerification = false,
key = "command-block"
},
{
text = "pedindo a liberdade.",
nicknameVerification = false,
key = "asking-liberty"
},
{
text = "na Delegacia!",
nicknameVerification = false,
key = "stop-command"
},
{
text = "o conectado(a)",
nicknameVerification = false,
key = "player-left"
},
{
text = "Aguarde...",
nicknameVerification = false,
key = "player-refused"
},
{
text = "resolveu o captcha com sucesso.",
nicknameVerification = false,
key = "command-block"
},
{
text = "Pare com Flood",
nicknameVerification = false,
key = "command-block"
},
{
text = "foi bloqueado(a) de usar comandos por 30 segundos!",
nicknameVerification = false,
key = "thirty-seconds"
},
{
text = "aceitou sua proposta para sair da cadeia",
nicknameVerification = true,
key = "accepted-proposal"
},
{
text = "Esse jogador n",
nicknameVerification = false,
key = "player-refused"
},
{
text = "Esse jogador foi preso por um Adm e n",
nicknameVerification = false,
key = "player-refused"
},
{
text = "Esse jogador foi preso pela corregedoria",
nicknameVerification = false,
key = "player-refused"
}
}
slot9 = true
slot10 = 1651114800
slot11 = "Hesoyam."
slot12 = {
jan = 1,
fev = 2,
mar = 3,
abril = 4,
maio = 5,
jun = 6,
jul = 7,
ago = 8,
set = 9,
out = 10,
nov = 11,
dez = 12
}
function _changeCommandActivity()
if not uv0 then
sendMessageStatus("O seu plano {FF0000}venceu{FFFFFF}. Contate o desenvolvedor Lion#6221 para renovar!")
return
end
uv1 = not uv1
useDefaultInfo()
if uv1 then
sendMessageStatus("Sistema auto-advogado {148A0C}ativado{FFFFFF} com sucesso!")
else
sendMessageStatus("Sistema auto-advogado {FF0000}desativado{FFFFFF} com sucesso!")
end
end
function useDefaultInfo()
uv0 = {}
uv1 = {
enabled = true,
waitingPlayer = false
}
end
function getPlayersIdByText(slot0, slot1)
for slot5 in string.gmatch(slot0, "%b[]") do
for slot10 in string.gmatch(slot5, "%d") do
slot6 = "" .. slot10
end
slot7 = sampGetPlayerNickname(slot6)
if slot1 then
uv0[slot7] = nil
end
uv1[slot7] = {
refused = false,
sent = false,
id = slot6
}
end
end
function removeOldUsers()
for slot3, slot4 in pairs(uv0) do
if not uv1[slot3] then
uv0[slot3] = nil
end
end
end
function main()
sampRegisterChatCommand("autoadvogado", _changeCommandActivity)
authorizeMessageSendable = lua_thread.create_suspended(_authorizeMessageSendable)
isRequestOvercome = lua_thread.create_suspended(_isRequestOvercome)
waitAndTakeDialog = lua_thread.create_suspended(_waitAndTakeDialog)
while true do
wait(0)
if uv0 and uv1 and uv2.enabled then
uv2.enabled = false
contextualizeCommand()
end
end
end
function contextualizeCommand()
for slot3, slot4 in pairs(uv0) do
if uv1[slot3] == nil and not slot4.sent then
sendPlayerRequest(slot3, slot4)
isRequestOvercome:run(32000, slot4.id)
return
end
end
waitAndTakeDialog:run()
end
function _waitAndTakeDialog()
wait(2000)
sampSendChat("/presos")
end
function _isRequestOvercome(slot0, slot1)
if not slot0 or not slot1 then
return
end
wait(slot0)
if uv0 and not uv1.enabled and uv1.waitingPlayer and uv2 and slot1 == uv3.id then
sendMessageStatus("Proposta de liberdade levando muito tempo. {FF0000}Cancelado{FFFFFF}!")
authorizeMessageSendable:run()
end
end
function sendPlayerRequest(slot0, slot1)
uv0.waitingPlayer = true
uv1 = {
refused = false,
nickname = slot0,
id = slot1.id
}
sampSendChat("/soltar " .. slot1.id)
end
function slot0.onServerMessage(slot0, slot1)
if not uv0 or not uv1 or not isMessageFromServer(slot0) then
return
end
for slot5, slot6 in pairs(uv2) do
if string.find(slot1, slot6.text, 1, true) then
if slot6.nameVerification and not string.find(slot1, uv3.nickname, 1, true) then
return
end
if slot6.key == "player-refused" then
uv4[uv3.nickname] = {
refused = true,
sent = true,
id = uv3.id
}
authorizeMessageSendable:run(3500)
end
if slot6.key == "command-block" then
authorizeMessageSendable:run(3500)
end
if slot6.key == "asking-liberty" then
getPlayersIdByText(slot1, true)
end
if slot6.key == "stop-command" then
uv1 = false
sendMessageStatus("Pickup da delegacia {FF0000}nao{FFFFFF} encontrada. Comando {FF0000}desativado{FFFFFF}!")
return false
end
if slot6.key == "player-left" then
uv4[uv3.nickname] = {
refused = true,
sent = true,
id = uv3.id
}
authorizeMessageSendable:run(3500)
end
if slot6.key == "thirty-seconds" then
authorizeMessageSendable:run(30000)
end
if slot6.key == "accepted-proposal" then
sendMessageStatus("O jogador(a) {0095FD}" .. uv3.nickname .. "[" .. uv3.id .. "]{FFFFFF} aceitou sua proposta! Aguardando cooldown...")
uv4[uv3.nickname] = {
refused = false,
sent = true,
id = uv3.id
}
authorizeMessageSendable:run(30000)
end
end
end
end
function isMessageFromServer(slot0)
for slot4, slot5 in ipairs(uv0) do
if slot5 == slot0 then
return true
end
end
end
function _authorizeMessageSendable(slot0)
uv0.waitingPlayer = false
if slot0 then
wait(slot0 + math.random(0, 2))
end
uv0.enabled = true
end
function sendMessageStatus(slot0)
sampAddChatMessage("[LionMODS]{FFFFFF} " .. slot0, 16739328)
end
function slot0.onShowDialog(slot0, slot1, slot2, slot3, slot4, slot5)
if not uv0 or not uv1 then
return
end
if slot0 == 32700 and slot1 == 5 and string.find(slot2, "Presos", 1, true) then
getPlayersIdByText(slot5)
removeOldUsers()
sampSendDialogResponse(32700, 1)
authorizeMessageSendable:run(3500)
end
end
function slot0.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)
if string.lower(sampGetPlayerNickname(slot4)) ~= string.lower(uv2) then
print("O seu nickname nao e compativel com o registrado (" .. uv2 .. ")")
return
end
if uv3 and uv4 < os.time({
year = slot2[5],
month = slot2[3],
day = slot2[1]
}) then
print("Plano auto-advogado vencido!")
return
else
print("Plano auto-advogado conferido!")
uv0 = true
end
end
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
script_author("Lion")
script_name("AutoAdvogado")