0% found this document useful (0 votes)
13 views7 pages

Multi Menu Auto Pilot & Walk Script

The document is a Lua script for a multi-menu interface in a game, utilizing the 'mimgui' library for GUI elements. It includes features for auto actions like 'Auto Otot', 'Auto Pilot', and 'Auto Walk', allowing players to automate certain tasks while providing feedback through chat messages. The script manages user inputs, coordinates, and character actions based on the game environment and player status.

Uploaded by

nwfhikaruuuu09
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views7 pages

Multi Menu Auto Pilot & Walk Script

The document is a Lua script for a multi-menu interface in a game, utilizing the 'mimgui' library for GUI elements. It includes features for auto actions like 'Auto Otot', 'Auto Pilot', and 'Auto Walk', allowing players to automate certain tasks while providing feedback through chat messages. The script manages user inputs, coordinates, and character actions based on the game environment and player status.

Uploaded by

nwfhikaruuuu09
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

local ffi = require 'ffi'

local imgui = require 'mimgui'


local sampev = require '[Link]'
local bit = require 'bit'
require '[Link]'
require '[Link]'

local isGuiOpen = [Link](false)

local OtotData = {
ALT = {value = 1024, type = 4},
F = {value = 16, type = 4},
H = {value = 192, type = 36},
N = {value = 128, type = 36},
SPC = {value = 8, type = 36},
Y = {value = 64, type = 36}
}
local isOtotActive = [Link](false)
local currentOtot = nil
local ototDelay = [Link](100)
local selectedOtot = [Link](0)

local autoPilot = [Link](false)


local pilotDestX, pilotDestY, pilotDestZ = 0, 0, 0
local pilotLastDestX, pilotLastDestY, pilotLastDestZ = 0, 0, 0
local pilotSpeed = [Link](30.0)
local pilotCheckpointActive = [Link](false)
local pilotWaiting = [Link](false)
local pilotWaitStartTime = 0
local pilotDriveType = 1
local pilotRideType = 1

local autoWalk = [Link](false)


local walkDestX, walkDestY, walkDestZ = 0, 0, 0
local walkLastDestX, walkLastDestY, walkLastDestZ = 0, 0, 0
local walkCheckpointActive = [Link](false)
local walkMarkerActive = [Link](false)
local walkLastPosX, walkLastPosY, walkLastPosZ = 0, 0, 0
local walkStuckStartTime = 0
local walkPathRecalcTimer = 0
local walkArrivalTime = 0

local function sendOtot()


while isOtotActive[0] do
wait(ototDelay[0])
if isCharOnFoot(PLAYER_PED) then
local success, playerId = sampGetPlayerIdByCharHandle(PLAYER_PED)
if success then
local data = allocateMemory(68)
sampStorePlayerOnfootData(playerId, data)
setStructElement(data, [Link], [Link] == 36 and
1 or 2, [Link], false)
sampSendOnfootData(data)
freeMemory(data)
end
end
end
end
function getTargetBlipCoordinatesFixed()
local found, x, y, z = getTargetBlipCoordinates()
if not found then return false, 0, 0, 0 end
requestCollision(x, y)
loadScene(x, y, z)
return getTargetBlipCoordinates()
end

function isDestinationChanged(x, y, z, lastX, lastY, lastZ)


return [Link](x - lastX) > 0.1 or [Link](y - lastY) > 0.1 or [Link](z -
lastZ) > 0.1
end

[Link](
function() return isGuiOpen[0] end,
function()
[Link](imgui.ImVec2(400, 200), [Link])
[Link](imgui.ImVec2(400, 300), [Link])
[Link]([Link], imgui.ImVec4(0.1, 0.1, 0.1, 1.0))
if [Link]('Multi Menu By Skyz V1', isGuiOpen,
[Link]) then
if [Link]('MainTabBar') then
if [Link]('Auto Otot') then
local ototItems = {'ALT', 'F', 'H', 'N', 'SPC', 'Y'}
local ototItems_c = [Link]('const char*[?]', #ototItems + 1)
for i, item in ipairs(ototItems) do
ototItems_c[i - 1] = [Link]('const char*', item)
end
ototItems_c[#ototItems] = nil
[Link]('Pilih Otot', selectedOtot, ototItems_c,
#ototItems)
[Link]('Delay (ms)', ototDelay, 1, 100)
if ototDelay[0] < 1 then ototDelay[0] = 1 end
if ototDelay[0] > 15000 then ototDelay[0] = 15000 end
if [Link]('Aktifkan Auto Otot', isOtotActive) then
if isOtotActive[0] then
currentOtot = OtotData[ototItems[selectedOtot[0] + 1]]
sampAddChatMessage('{FF0000}[AutoOtot]: {FFFFFF}Aktif
untuk otot: ' .. ototItems[selectedOtot[0] + 1] .. ' dengan delay: ' ..
ototDelay[0] .. ' ms', -1)
lua_thread.create(sendOtot).work_in_pause = true
else
sampAddChatMessage('{FF0000}[AutoOtot]:
{FFFFFF}Dimatikan.', -1)
end
end
[Link]()
end
if [Link]('Auto Pilot') then
[Link]('Kecepatan', pilotSpeed, 1.0, 10.0)
if pilotSpeed[0] < 1.0 then pilotSpeed[0] = 1.0 end
if [Link]('Aktifkan Auto Pilot', autoPilot) then
if autoPilot[0] then
if not isCharInAnyCar(PLAYER_PED) then
autoPilot[0] = false
sampAddChatMessage('{FF0000}[AutoPilot]:
{FFFFFF}Masuk kendaraan terlebih dahulu.', -1)
elseif pilotCheckpointActive[0] then
sampAddChatMessage([Link]('{FF0000}
[AutoPilot]: {FFFFFF}Menuju checkpoint dengan kecepatan %.1f', pilotSpeed[0]), -1)
else
local found, x, y, z =
getTargetBlipCoordinatesFixed()
if found then
pilotDestX, pilotDestY, pilotDestZ = x, y, z
pilotLastDestX, pilotLastDestY, pilotLastDestZ
= x, y, z
sampAddChatMessage([Link]('{FF0000}
[AutoPilot]: {FFFFFF}Menuju marker dengan kecepatan %.1f', pilotSpeed[0]), -1)
else
autoPilot[0] = false
sampAddChatMessage('{FF0000}[AutoPilot]:
{FFFFFF}Tidak ada marker atau checkpoint yang ditemukan.', -1)
end
end
else
pilotWaiting[0] = false
clearCharTasks(PLAYER_PED)
sampAddChatMessage('{FF0000}[AutoPilot]:
{FFFFFF}AutoPilot dimatikan.', -1)
end
end
[Link]()
end
if [Link]('Auto Walk') then
if [Link]('Aktifkan Auto Walk', autoWalk) then
if autoWalk[0] then
if isCharInAnyCar(PLAYER_PED) then
autoWalk[0] = false
sampAddChatMessage('{FF0000}[AutoWalk]:
{FFFFFF}Turun dari kendaraan terlebih dahulu.', -1)
elseif walkCheckpointActive[0] then
sampAddChatMessage('{FF0000}[AutoWalk]:
{FFFFFF}Menuju checkpoint.', -1)
else
local found, x, y, z =
getTargetBlipCoordinatesFixed()
if found then
walkDestX, walkDestY, walkDestZ = x, y, z
walkLastDestX, walkLastDestY, walkLastDestZ =
x, y, z
walkMarkerActive[0] = true
sampAddChatMessage('{FF0000}[AutoWalk]:
{FFFFFF}Menuju marker.', -1)
else
autoWalk[0] = false
sampAddChatMessage('{FF0000}[AutoWalk]:
{FFFFFF}Tidak ada marker atau checkpoint yang ditemukan.', -1)
end
end
else
clearCharTasks(PLAYER_PED)
sampAddChatMessage('{FF0000}[AutoWalk]:
{FFFFFF}AutoWalk dimatikan.', -1)
end
end
[Link]()
end
if [Link]('About') then
[Link]('Credit: Skyz')
[Link]('Script Ini Akan Dilanjutkan Jika Tidak Malas')
[Link]()
end
[Link]()
end
[Link]()
[Link]()
end
end
)

function main()
repeat wait(0) until isSampAvailable()
sampAddChatMessage('{FF0000}[Multi Menu]: {FFFFFF}Loaded. Gunakan /mms untuk
membuka menu.', -1)
sampRegisterChatCommand('mms', function()
isGuiOpen[0] = not isGuiOpen[0]
end)
lua_thread.create(function()
while true do
wait(500)
if not pilotCheckpointActive[0] and autoPilot[0] and not
pilotWaiting[0] then
local found, x, y, z = getTargetBlipCoordinatesFixed()
if found and isDestinationChanged(x, y, z, pilotLastDestX,
pilotLastDestY, pilotLastDestZ) then
pilotDestX, pilotDestY, pilotDestZ = x, y, z
pilotLastDestX, pilotLastDestY, pilotLastDestZ = x, y, z
sampAddChatMessage('{FF0000}[AutoPilot]: {FFFFFF}Marker
diperbarui. Menyesuaikan arah.', -1)
end
end
end
end)
lua_thread.create(function()
while true do
wait(100)
if not walkCheckpointActive[0] and autoWalk[0] and walkMarkerActive[0]
then
local found, x, y, z = getTargetBlipCoordinatesFixed()
if found and isDestinationChanged(x, y, z, walkLastDestX,
walkLastDestY, walkLastDestZ) then
walkDestX, walkDestY, walkDestZ = x, y, z
walkLastDestX, walkLastDestY, walkLastDestZ = x, y, z
sampAddChatMessage('{FF0000}[AutoWalk]: {FFFFFF}Marker
diperbarui. Menyesuaikan arah.', -1)
end
end
end
end)
while true do
wait(0)
if autoPilot[0] then
if not isCharInAnyCar(PLAYER_PED) then
autoPilot[0] = false
pilotWaiting[0] = false
clearCharTasks(PLAYER_PED)
sampAddChatMessage('{FF0000}[AutoPilot]: {FFFFFF}Keluar dari
kendaraan. AutoPilot dimatikan.', -1)
elseif not pilotWaiting[0] then
local car = storeCarCharIsInNoSave(PLAYER_PED)
local px, py, pz = getCharCoordinates(PLAYER_PED)
local distance = getDistanceBetweenCoords3d(px, py, pz, pilotDestX,
pilotDestY, pilotDestZ)
if distance > 3.0 then
taskCarDriveToCoord(PLAYER_PED, car, pilotDestX, pilotDestY,
pilotDestZ, pilotSpeed[0], pilotRideType, 0, pilotDriveType)
else
clearCharTasks(PLAYER_PED)
pilotWaiting[0] = true
pilotWaitStartTime = [Link]()
sampAddChatMessage('{FF0000}[AutoPilot]: {FFFFFF}Tiba di
tujuan. Menunggu marker/checkpoint baru selama 5 detik.', -1)
end
elseif pilotWaiting[0] then
local found, x, y, z = getTargetBlipCoordinatesFixed()
if pilotCheckpointActive[0] and isDestinationChanged(pilotDestX,
pilotDestY, pilotDestZ, pilotLastDestX, pilotLastDestY, pilotLastDestZ) then
pilotWaiting[0] = false
sampAddChatMessage('{FF0000}[AutoPilot]: {FFFFFF}Checkpoint
baru ditemukan. Melanjutkan AutoPilot.', -1)
elseif found and isDestinationChanged(x, y, z, pilotLastDestX,
pilotLastDestY, pilotLastDestZ) then
pilotDestX, pilotDestY, pilotDestZ = x, y, z
pilotLastDestX, pilotLastDestY, pilotLastDestZ = x, y, z
pilotWaiting[0] = false
sampAddChatMessage('{FF0000}[AutoPilot]: {FFFFFF}Marker baru
ditemukan. Melanjutkan AutoPilot.', -1)
elseif [Link]() - pilotWaitStartTime >= 5 then
autoPilot[0] = false
pilotWaiting[0] = false
sampAddChatMessage('{FF0000}[AutoPilot]: {FFFFFF}Tidak ada
marker/checkpoint baru. AutoPilot dimatikan.', -1)
end
end
end
if autoWalk[0] then
if isCharInAnyCar(PLAYER_PED) then
autoWalk[0] = false
clearCharTasks(PLAYER_PED)
sampAddChatMessage('{FF0000}[AutoWalk]: {FFFFFF}Kamu berada di
kendaraan. AutoWalk dimatikan.', -1)
else
local px, py, pz = getCharCoordinates(PLAYER_PED)
local distance = getDistanceBetweenCoords3d(px, py, pz, walkDestX,
walkDestY, walkDestZ)
if distance > 1.5 then
if walkPathRecalcTimer == 0 or [Link]() - walkPathRecalcTimer
> 10 then
taskGoToCoordAnyMeans(PLAYER_PED, walkDestX, walkDestY,
walkDestZ, 7, 0, false, -1, -1)
walkPathRecalcTimer = [Link]()
end
if getDistanceBetweenCoords3d(px, py, pz, walkLastPosX,
walkLastPosY, walkLastPosZ) < 0.2 then
if walkStuckStartTime == 0 then
walkStuckStartTime = [Link]()
elseif [Link]() - walkStuckStartTime > 5 then
clearCharTasks(PLAYER_PED)
taskGoToCoordAnyMeans(PLAYER_PED, walkDestX, walkDestY,
walkDestZ, 7, 0, false, -1, -1)
walkStuckStartTime = 0
walkPathRecalcTimer = [Link]()
end
else
walkStuckStartTime = 0
end
walkLastPosX, walkLastPosY, walkLastPosZ = px, py, pz
walkArrivalTime = 0
else
if walkArrivalTime == 0 then
clearCharTasks(PLAYER_PED)
walkArrivalTime = [Link]()
sampAddChatMessage('{FF0000}[AutoWalk]: {FFFFFF}Tiba di
tujuan. Menunggu 5 detik untuk checkpoint/marker baru.', -1)
elseif [Link]() - walkArrivalTime > 5 then
if not walkCheckpointActive[0] and not walkMarkerActive[0]
then
autoWalk[0] = false
sampAddChatMessage('{FF0000}[AutoWalk]: {FFFFFF}Tidak
ada checkpoint/marker baru. AutoWalk dimatikan.', -1)
end
end
end
end
end
end
end

function [Link](_, pos)


if pos and pos.x and pos.y and pos.z then
pilotCheckpointActive[0] = true
walkCheckpointActive[0] = true
walkMarkerActive[0] = false
if isDestinationChanged(pos.x, pos.y, pos.z, pilotLastDestX,
pilotLastDestY, pilotLastDestZ) then
pilotDestX, pilotDestY, pilotDestZ = pos.x, pos.y, pos.z
pilotLastDestX, pilotLastDestY, pilotLastDestZ = pos.x, pos.y, pos.z
if autoPilot[0] then
pilotWaiting[0] = false
sampAddChatMessage('{FF0000}[AutoPilot]: {FFFFFF}Checkpoint
diperbarui. Menyesuaikan arah.', -1)
end
end
if isDestinationChanged(pos.x, pos.y, pos.z, walkLastDestX, walkLastDestY,
walkLastDestZ) then
walkDestX, walkDestY, walkDestZ = pos.x, pos.y, pos.z
walkLastDestX, walkLastDestY, walkLastDestZ = pos.x, pos.y, pos.z
if autoWalk[0] then
sampAddChatMessage('{FF0000}[AutoWalk]: {FFFFFF}Checkpoint
diperbarui. Menyesuaikan arah.', -1)
end
end
end
end
function [Link](pos)
if pos and pos.x and pos.y and pos.z then
pilotCheckpointActive[0] = true
walkCheckpointActive[0] = true
walkMarkerActive[0] = false
if isDestinationChanged(pos.x, pos.y, pos.z, pilotLastDestX,
pilotLastDestY, pilotLastDestZ) then
pilotDestX, pilotDestY, pilotDestZ = pos.x, pos.y, pos.z
pilotLastDestX, pilotLastDestY, pilotLastDestZ = pos.x, pos.y, pos.z
if autoPilot[0] then
pilotWaiting[0] = false
sampAddChatMessage('{FF0000}[AutoPilot]: {FFFFFF}Checkpoint
diperbarui. Menyesuaikan arah.', -1)
end
end
if isDestinationChanged(pos.x, pos.y, pos.z, walkLastDestX, walkLastDestY,
walkLastDestZ) then
walkDestX, walkDestY, walkDestZ = pos.x, pos.y, pos.z
walkLastDestX, walkLastDestY, walkLastDestZ = pos.x, pos.y, pos.z
if autoWalk[0] then
sampAddChatMessage('{FF0000}[AutoWalk]: {FFFFFF}Checkpoint
diperbarui. Menyesuaikan arah.', -1)
end
end
end
end

function [Link]()
pilotCheckpointActive[0] = false
walkCheckpointActive[0] = false
end

function [Link]()
pilotCheckpointActive[0] = false
walkCheckpointActive[0] = false
end

function onScriptExit()
if autoPilot[0] or autoWalk[0] then
clearCharTasks(PLAYER_PED)
end
end

You might also like