LUA | Скрипт крашит игру.

Статус
В этой теме нельзя размещать новые ответы.

AlexanderMcArov

Новичок
Автор темы
13
1
Всем привет. Скажу сразу я полный нуб в программировании и то, что вы увидите просто вас убьёт, (от смеха) , но я все же обращусь за помощью. У меня крашит игру когда работает скрипт.
Пытаюсь я написать бота, который будет работать не по КоордМастеру, а по нажатию клавиш... имитация ИИ.. Но я тупой , и нихера не рубаю.. Может кто скажет с чего лучше начать, что почитать.. я вообще хз.. это первый ЯП за который я взялся, т.к. он показался для меня очень удобным. Хотелось бы разобраться в проблеме.

Ниже будет код.. то что не нужно сейчас я закоментил..

Lua:
-- Global
sek=1000
--********

function MainBot(posX,posY,posZ)

    positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
    Distance = math.sqrt((positionX-posX)^2+(positionY-posY)^2+(positionZ-posZ)^2)

    Object_front = createObject(0,0,0,0) -- front PED
    Object_left = createObject(0,0,0,0) -- left PED
    Object_right= createObject(0,0,0,0) -- right PED
 
    attachObjectToChar(Object_front, PLAYER_PED, 0, 10, 0, 0, 0, 0)
    attachObjectToChar(Object_left, PLAYER_PED, -10, 0, 0, 0, 0, 0)
    attachObjectToChar(Object_right, PLAYER_PED, 10, 0, 0, 0, 0, 0)
 
    ObjectPos={
    frontX,frontY,frontZ,
    leftX,leftY,leftZ,
    rightX,rightY,rightZ
    }
 
    _, ObjectPos[1], ObjectPos[2], ObjectPos[3] = getObjectCoordinates(Object_front)
    _, ObjectPos[4], ObjectPos[5], ObjectPos[6] = getObjectCoordinates(Object_left)
    _, ObjectPos[7], ObjectPos[8], ObjectPos[9] = getObjectCoordinates(Object_right)
 
    DistanceLeft = math.sqrt((ObjectPos[4]-posX)^2+(ObjectPos[5]-posY)^2+(ObjectPos[6]-posZ)^2)
    DistanceRight = math.sqrt((ObjectPos[7]-posX)^2+(ObjectPos[8]-posY)^2+(ObjectPos[9]-posZ)^2)
    Targeting(DistanceLeft,DistanceRight)
 
    --[[vectorPedToPoint={posX-positionX,posY-positionY,posZ-positionZ}
    vectorPedToFront={ObjectPos[1]-positionX,ObjectPos[2]-positionY,ObjectPos[3]-positionZ}
    vectorScalar:(vectorPedToFront[1]*vectorPedToPoint[1]+vectorPedToFront[2]*vectorPedToPoint[2]+vectorPedToFront[3]*vectorPedToPoint[3])
    --  vectorScalar == Это чтобы узнать, впереди ли точка на которую надо ехать или сзади,
 
    vectorSummA=vectorPedToPoint[1]*vectorPedToFront[1]+vectorPedToPoint[2]*vectorPedToFront[2]+vectorPedToPoint[3]*vectorPedToFront[3]
    vectorSummB=math.sqrt(vectorPedToPoint[1]^2+vectorPedToPoint[2]^2+vectorPedToPoint[3]^2)
    vectorSummC=math.sqrt(vectorPedToFront[1]^2+vectorPedToFront[2]^2+vectorPedToFront[3]^2)]]--
    vectorVelocity=0--vectorSummA/(vectorSummB*vectorSummC)
    vectorScalar=0
 
    pos = string.format("Distance=%f SCALAR=%f ANGLE=%f Left=%f,Right=%f",Distance,vectorScalar,vectorVelocity,DistanceLeft,DistanceRight)
    sampTextdrawCreate(1, pos, 150, 400)
end

--  Targeting(left2,right2)  Эта функция как ра отвечает за поворот колес..
--первая проверка стоит чтобы колеса не дергались туда сюда постоянно. if left2-right2>=1 or right2-left2>=1 then
function Targeting(left2,right2)
    if left2-right2>=1 or right2-left2>=1 then
        if left2 >= right2 then
        right(true)
        left(false)
        elseif left2 <= right2 then
        left(true)
        right(false)
        else
        right(false)
        left(false)
        end
    else
    right(false)
    left(false)
    end
    left2,right2=0
end

function forward(bool) -- Button W
    setVirtualKeyDown(87,bool)
end

function back(bool) -- Button S
    setVirtualKeyDown(83,bool)
end

function left(bool) -- Button A
    setVirtualKeyDown(65,bool)
end

function right(bool) -- Button D
    setVirtualKeyDown(68,bool)
end


function main()

    while true do
    wait(100)
    --MainBot(0,3,3)    --Откоментировать чтобы включить "бота"
    end
end

Samp.log
HTML:
[16:02:26] {FFFFFF}SA-MP {B9C9BF}0.3.7 {FFFFFF}Started

[16:02:26] Warning(s007): Exception 0xC0000005 at 0x630FA67B

[16:02:45] Connecting to 127.0.0.1:7777...

[16:02:46] Connected. Joining the game...

[16:02:46] 0

[16:02:46] {ffaa00}[MySQL]:{FFFFFF}Ваш ник не найден!

[16:02:47] Connected to {B9C9BF}Ride From Hell

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x536DF4

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x536DF4

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x536DF4

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x536DF4

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:04:25] Warning(s007): Exception 0xC0000005 at 0x536DF4
 

Вложения

  • Bot.lua
    3.1 KB · Просмотры: 32
  • chatlog.txt
    939 байт · Просмотры: 11
Последнее редактирование:
  • Нравится
Реакции: ™ ChipFamily

AlexanderMcArov

Новичок
Автор темы
13
1
Как я понимаю молчат :) Вроде все грузят.
[16:02:09.920696] (system) Session started.
[16:02:09.922699] (debug) Module handle: 63900000

MoonLoader v.026.2-beta loaded.
Developers: FYP, hnnssy, EvgeN 1137

Copyright (c) 2016, BlastHack Team
Избранное - Lua - ASI - MoonLoader(https://www.blast.hk/moonloader/)

[16:02:09.922699] (info) Working directory: D:\Games\GTA(SAMP)\moonloader
[16:02:09.922699] (debug) FP Control: 0009001F
[16:02:09.922699] (debug) Game: GTA SA 1.0.0.0 US
[16:02:09.922699] (system) Installing pre-game hooks...
[16:02:09.922699] (system) Hooks installed.
[16:02:11.665212] (debug) Initializing opcode handler table
[16:02:11.665212] (debug) package.path = D:\Games\GTA(SAMP)\moonloader\lib\?.lua;D:\Games\GTA(SAMP)\moonloader\lib\?\init.lua;D:\Games\GTA(SAMP)\moonloader\?.lua;D:\Games\GTA(SAMP)\moonloader\?\init.lua;.\?.lua;D:\Games\GTA(SAMP)\moonloader\lib\?.luac;D:\Games\GTA(SAMP)\moonloader\lib\?\init.luac;D:\Games\GTA(SAMP)\moonloader\?.luac;D:\Games\GTA(SAMP)\moonloader\?\init.luac;.\?.luac
[16:02:11.665212] (debug) package.cpath = D:\Games\GTA(SAMP)\moonloader\lib\?.dll;
[16:02:11.666212] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\AutoReboot.lua'...
[16:02:11.666212] (debug) New script: 07D5F63C
[16:02:11.668215] (system) ML-AutoReboot: Loaded successfully.
[16:02:11.668215] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\Bot.lua'...
[16:02:11.668215] (debug) New script: 07D5FC5C
[16:02:11.669215] (system) Bot.lua: Loaded successfully.
[16:02:11.669215] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\check-moonloader-updates.lua'...
[16:02:11.669215] (debug) New script: 07D5FF6C
[16:02:11.672216] (system) Check MoonLoader Updates: Loaded successfully.
[16:02:11.672216] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\imgui_simple_scoreboard.lua'...
[16:02:11.672216] (debug) New script: 07D5F7C4
[16:02:11.681218] (system) imgui_simple_scoreboard.lua: Loaded successfully.
[16:02:11.682219] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\reload_all.lua'...
[16:02:11.682219] (debug) New script: 07D5F1A4
[16:02:11.683219] (system) ML-ReloadAll: Loaded successfully.
[16:02:11.683219] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\SF Integration.lua'...
[16:02:11.683219] (debug) New script: 07D5FDE4
[16:02:11.685220] (system) SF Integration: Loaded successfully.
[16:02:11.685220] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\spur_imgui.lua'...
[16:02:11.686220] (debug) New script: 07D5F4B4
[16:02:11.692222] (system) spur_imgui: Loaded successfully.
[16:02:11.692222] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\Test.lua'...
[16:02:11.692222] (debug) New script: 07D5F32C
[16:02:11.705227] (system) Test.lua: Loaded successfully.
[16:02:23.961181] (system) Installing post-load hooks...
[16:02:23.961181] (system) Hooks installed.
[16:02:25.206585] (error) Bot.lua: opcode '0C48' call caused an unhandled exception
stack traceback:
[C]: in function 'sampTextdrawCreate'
D:\Games\GTA(SAMP)\moonloader\Bot.lua:42: in function 'MainBot'
D:\Games\GTA(SAMP)\moonloader\Bot.lua:87: in function <D:\Games\GTA(SAMP)\moonloader\Bot.lua:83>
[16:02:25.206585] (error) Bot.lua: Script died due to an error. (07D5FC5C)
[16:02:25.207583] (error) Test.lua: opcode '0B2B' call caused an unhandled exception
stack traceback:
[C]: in function 'sampGetPlayerIdByCharHandle'
D:\Games\GTA(SAMP)\moonloader\Test.lua:203: in function 'cheats'
D:\Games\GTA(SAMP)\moonloader\Test.lua:216: in function <D:\Games\GTA(SAMP)\moonloader\Test.lua:211>
[16:02:25.207583] (error) Test.lua: Script died due to an error. (07D5F32C)
[16:02:26.299939] (error) spur_imgui: cannot resume non-suspended coroutine
stack traceback:
[C]: in function 'SetMouseCursor'
D:\Games\GTA(SAMP)\moonloader\spur_imgui.lua:304: in function <D:\Games\GTA(SAMP)\moonloader\spur_imgui.lua:277>
[16:02:26.299939] (error) spur_imgui: Script died due to an error. (07D5F4B4)
[16:02:45.356086] (script) ML-AutoReboot: Loading "D:\Games\GTA(SAMP)\moonloader\Bot.lua"...
[16:02:45.356086] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\Bot.lua'...
[16:02:45.356086] (debug) New script: 101EF27C
[16:02:45.357087] (system) Bot.lua: Loaded successfully.
[16:03:34.262873] (script) ML-AutoReboot: Reloading "Bot.lua"...
[16:03:34.273876] (system) Bot.lua: Script terminated. (101EF27C)
[16:03:34.273876] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\Bot.lua'...
[16:03:34.273876] (debug) New script: 101EF404
[16:03:34.274878] (system) Bot.lua: Loaded successfully.
[16:04:25.095282] (error) Bot.lua: opcode '0107' call caused an unhandled exception
stack traceback:
[C]: in function 'createObject'
D:\Games\GTA(SAMP)\moonloader\Bot.lua:9: in function 'MainBot'
D:\Games\GTA(SAMP)\moonloader\Bot.lua:87: in function <D:\Games\GTA(SAMP)\moonloader\Bot.lua:83>
[16:04:25.095282] (error) Bot.lua: Script died due to an error. (101EF404)

08/04/2018 16:02:09.910 Log started.
08/04/2018 16:02:09.910 Unprotecting memory region '.text': 0x00001000 (size: 0x00456000)
08/04/2018 16:02:09.910 Unprotecting memory region '.rdata': 0x00458000 (size: 0x0004C000)
08/04/2018 16:02:09.910 Unprotecting memory region '.text': 0x008B1000 (size: 0x0064A000)
08/04/2018 16:02:09.910 Loading plugin cleo/FileSystemOperations.cleo
08/04/2018 16:02:09.911 Loading plugin cleo/IniFiles.cleo
08/04/2018 16:02:09.911 Loading plugin cleo/IntOperations.cleo
08/04/2018 16:02:09.912 Started on game of version: SA 1.0 us
08/04/2018 16:02:09.912 Injecting MenuStatusNotifier...
08/04/2018 16:02:09.912 Replacing call: 0x0057B9FD
08/04/2018 16:02:09.912 Injecting DmaFix...
08/04/2018 16:02:09.912 Replacing call: 0x0053E981
08/04/2018 16:02:09.912 Injecting TextManager...
08/04/2018 16:02:09.912 Injecting function at: 0x006A0050
08/04/2018 16:02:09.912 Injecting SoundSystem...
08/04/2018 16:02:09.912 Replacing call: 0x007487A8
08/04/2018 16:02:09.912 Injecting CustomOpcodeSystem...
08/04/2018 16:02:09.912 Injecting ScriptEngine...
08/04/2018 16:02:09.912 Replacing call: 0x0046A21B
08/04/2018 16:02:09.912 Replacing call: 0x0058D552
08/04/2018 16:02:09.912 Replacing call: 0x0058FCE4
08/04/2018 16:02:09.912 Replacing call: 0x0053BDD7
08/04/2018 16:02:09.912 Replacing call: 0x005BA340
08/04/2018 16:02:09.912 Replacing call: 0x005D4FD7
08/04/2018 16:02:09.912 Replacing call: 0x005D18F0
08/04/2018 16:02:09.912 Replacing call: 0x005D14D5
08/04/2018 16:02:09.912 Injecting function at: 0x004667DB
08/04/2018 16:02:10.099 Creating main window...
08/04/2018 16:02:10.102 Found sound device 0: No sound
08/04/2018 16:02:10.102 Found sound device 1 (default): Динамики (C-Media USB Headphone Set )
08/04/2018 16:02:10.102 Found sound device 2: SyncMaster-4 (NVIDIA High Definition Audio)
08/04/2018 16:02:10.102 Found sound device 3: Realtek Digital Output (Realtek High Definition Audio)
08/04/2018 16:02:10.102 Found sound device 4: Динамики (Realtek High Definition Audio)
08/04/2018 16:02:10.102 On system found 5 devices, 5 enabled devices, assuming device to use: 1 (Динамики (C-Media USB Headphone Set ))
08/04/2018 16:02:10.110 SoundSystem initialized
08/04/2018 16:02:10.111 Floating-point audio supported!
08/04/2018 16:02:10.111 Audio hardware acceleration disabled (no EAX)
08/04/2018 16:02:22.354 Initializing SCM #2
08/04/2018 16:02:22.354 Deleting dynamic fxts...
08/04/2018 16:02:22.354 Finalizing script objects... 0 files unclosed, 0 libs unloaded, 0 file searches unclosed...
08/04/2018 16:02:22.359 Searching for cleo scripts
08/04/2018 16:02:22.359 Loading custom script 51_PoolRender.cs...
08/04/2018 16:02:22.359 Registering custom script named 51_Pool
08/04/2018 16:02:22.359 Loading custom script FPSUnlock.cs...
08/04/2018 16:02:22.360 Registering custom script named FPSUnlo
08/04/2018 16:02:22.360 Loading custom script nocuff.cs...
08/04/2018 16:02:22.362 Registering custom script named nocuff.
08/04/2018 16:02:22.362 Loading custom script SensitivityFix.cs...
08/04/2018 16:02:22.363 Registering custom script named Sensiti
08/04/2018 16:02:22.363 Loading custom script traktor.cs...
08/04/2018 16:02:22.363 Registering custom script named traktor
08/04/2018 16:02:23.962 Unregistering custom script named FPSUnlo
 

Вложения

  • moonloader.log
    4.8 KB · Просмотры: 18
  • cleo.log
    3.3 KB · Просмотры: 12

AnWu

Guardian of Order
Всефорумный модератор
4,690
5,190
Как я понимаю молчат :) Вроде все грузят.
[16:02:09.920696] (system) Session started.
[16:02:09.922699] (debug) Module handle: 63900000

MoonLoader v.026.2-beta loaded.
Developers: FYP, hnnssy, EvgeN 1137

Copyright (c) 2016, BlastHack Team
Избранное - Lua - ASI - MoonLoader(https://www.blast.hk/moonloader/)

[16:02:09.922699] (info) Working directory: D:\Games\GTA(SAMP)\moonloader
[16:02:09.922699] (debug) FP Control: 0009001F
[16:02:09.922699] (debug) Game: GTA SA 1.0.0.0 US
[16:02:09.922699] (system) Installing pre-game hooks...
[16:02:09.922699] (system) Hooks installed.
[16:02:11.665212] (debug) Initializing opcode handler table
[16:02:11.665212] (debug) package.path = D:\Games\GTA(SAMP)\moonloader\lib\?.lua;D:\Games\GTA(SAMP)\moonloader\lib\?\init.lua;D:\Games\GTA(SAMP)\moonloader\?.lua;D:\Games\GTA(SAMP)\moonloader\?\init.lua;.\?.lua;D:\Games\GTA(SAMP)\moonloader\lib\?.luac;D:\Games\GTA(SAMP)\moonloader\lib\?\init.luac;D:\Games\GTA(SAMP)\moonloader\?.luac;D:\Games\GTA(SAMP)\moonloader\?\init.luac;.\?.luac
[16:02:11.665212] (debug) package.cpath = D:\Games\GTA(SAMP)\moonloader\lib\?.dll;
[16:02:11.666212] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\AutoReboot.lua'...
[16:02:11.666212] (debug) New script: 07D5F63C
[16:02:11.668215] (system) ML-AutoReboot: Loaded successfully.
[16:02:11.668215] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\Bot.lua'...
[16:02:11.668215] (debug) New script: 07D5FC5C
[16:02:11.669215] (system) Bot.lua: Loaded successfully.
[16:02:11.669215] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\check-moonloader-updates.lua'...
[16:02:11.669215] (debug) New script: 07D5FF6C
[16:02:11.672216] (system) Check MoonLoader Updates: Loaded successfully.
[16:02:11.672216] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\imgui_simple_scoreboard.lua'...
[16:02:11.672216] (debug) New script: 07D5F7C4
[16:02:11.681218] (system) imgui_simple_scoreboard.lua: Loaded successfully.
[16:02:11.682219] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\reload_all.lua'...
[16:02:11.682219] (debug) New script: 07D5F1A4
[16:02:11.683219] (system) ML-ReloadAll: Loaded successfully.
[16:02:11.683219] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\SF Integration.lua'...
[16:02:11.683219] (debug) New script: 07D5FDE4
[16:02:11.685220] (system) SF Integration: Loaded successfully.
[16:02:11.685220] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\spur_imgui.lua'...
[16:02:11.686220] (debug) New script: 07D5F4B4
[16:02:11.692222] (system) spur_imgui: Loaded successfully.
[16:02:11.692222] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\Test.lua'...
[16:02:11.692222] (debug) New script: 07D5F32C
[16:02:11.705227] (system) Test.lua: Loaded successfully.
[16:02:23.961181] (system) Installing post-load hooks...
[16:02:23.961181] (system) Hooks installed.
[16:02:25.206585] (error) Bot.lua: opcode '0C48' call caused an unhandled exception
stack traceback:
[C]: in function 'sampTextdrawCreate'
D:\Games\GTA(SAMP)\moonloader\Bot.lua:42: in function 'MainBot'
D:\Games\GTA(SAMP)\moonloader\Bot.lua:87: in function <D:\Games\GTA(SAMP)\moonloader\Bot.lua:83>
[16:02:25.206585] (error) Bot.lua: Script died due to an error. (07D5FC5C)
[16:02:25.207583] (error) Test.lua: opcode '0B2B' call caused an unhandled exception
stack traceback:
[C]: in function 'sampGetPlayerIdByCharHandle'
D:\Games\GTA(SAMP)\moonloader\Test.lua:203: in function 'cheats'
D:\Games\GTA(SAMP)\moonloader\Test.lua:216: in function <D:\Games\GTA(SAMP)\moonloader\Test.lua:211>
[16:02:25.207583] (error) Test.lua: Script died due to an error. (07D5F32C)
[16:02:26.299939] (error) spur_imgui: cannot resume non-suspended coroutine
stack traceback:
[C]: in function 'SetMouseCursor'
D:\Games\GTA(SAMP)\moonloader\spur_imgui.lua:304: in function <D:\Games\GTA(SAMP)\moonloader\spur_imgui.lua:277>
[16:02:26.299939] (error) spur_imgui: Script died due to an error. (07D5F4B4)
[16:02:45.356086] (script) ML-AutoReboot: Loading "D:\Games\GTA(SAMP)\moonloader\Bot.lua"...
[16:02:45.356086] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\Bot.lua'...
[16:02:45.356086] (debug) New script: 101EF27C
[16:02:45.357087] (system) Bot.lua: Loaded successfully.
[16:03:34.262873] (script) ML-AutoReboot: Reloading "Bot.lua"...
[16:03:34.273876] (system) Bot.lua: Script terminated. (101EF27C)
[16:03:34.273876] (system) Loading script 'D:\Games\GTA(SAMP)\moonloader\Bot.lua'...
[16:03:34.273876] (debug) New script: 101EF404
[16:03:34.274878] (system) Bot.lua: Loaded successfully.
[16:04:25.095282] (error) Bot.lua: opcode '0107' call caused an unhandled exception
stack traceback:
[C]: in function 'createObject'
D:\Games\GTA(SAMP)\moonloader\Bot.lua:9: in function 'MainBot'
D:\Games\GTA(SAMP)\moonloader\Bot.lua:87: in function <D:\Games\GTA(SAMP)\moonloader\Bot.lua:83>
[16:04:25.095282] (error) Bot.lua: Script died due to an error. (101EF404)

08/04/2018 16:02:09.910 Log started.
08/04/2018 16:02:09.910 Unprotecting memory region '.text': 0x00001000 (size: 0x00456000)
08/04/2018 16:02:09.910 Unprotecting memory region '.rdata': 0x00458000 (size: 0x0004C000)
08/04/2018 16:02:09.910 Unprotecting memory region '.text': 0x008B1000 (size: 0x0064A000)
08/04/2018 16:02:09.910 Loading plugin cleo/FileSystemOperations.cleo
08/04/2018 16:02:09.911 Loading plugin cleo/IniFiles.cleo
08/04/2018 16:02:09.911 Loading plugin cleo/IntOperations.cleo
08/04/2018 16:02:09.912 Started on game of version: SA 1.0 us
08/04/2018 16:02:09.912 Injecting MenuStatusNotifier...
08/04/2018 16:02:09.912 Replacing call: 0x0057B9FD
08/04/2018 16:02:09.912 Injecting DmaFix...
08/04/2018 16:02:09.912 Replacing call: 0x0053E981
08/04/2018 16:02:09.912 Injecting TextManager...
08/04/2018 16:02:09.912 Injecting function at: 0x006A0050
08/04/2018 16:02:09.912 Injecting SoundSystem...
08/04/2018 16:02:09.912 Replacing call: 0x007487A8
08/04/2018 16:02:09.912 Injecting CustomOpcodeSystem...
08/04/2018 16:02:09.912 Injecting ScriptEngine...
08/04/2018 16:02:09.912 Replacing call: 0x0046A21B
08/04/2018 16:02:09.912 Replacing call: 0x0058D552
08/04/2018 16:02:09.912 Replacing call: 0x0058FCE4
08/04/2018 16:02:09.912 Replacing call: 0x0053BDD7
08/04/2018 16:02:09.912 Replacing call: 0x005BA340
08/04/2018 16:02:09.912 Replacing call: 0x005D4FD7
08/04/2018 16:02:09.912 Replacing call: 0x005D18F0
08/04/2018 16:02:09.912 Replacing call: 0x005D14D5
08/04/2018 16:02:09.912 Injecting function at: 0x004667DB
08/04/2018 16:02:10.099 Creating main window...
08/04/2018 16:02:10.102 Found sound device 0: No sound
08/04/2018 16:02:10.102 Found sound device 1 (default): Динамики (C-Media USB Headphone Set )
08/04/2018 16:02:10.102 Found sound device 2: SyncMaster-4 (NVIDIA High Definition Audio)
08/04/2018 16:02:10.102 Found sound device 3: Realtek Digital Output (Realtek High Definition Audio)
08/04/2018 16:02:10.102 Found sound device 4: Динамики (Realtek High Definition Audio)
08/04/2018 16:02:10.102 On system found 5 devices, 5 enabled devices, assuming device to use: 1 (Динамики (C-Media USB Headphone Set ))
08/04/2018 16:02:10.110 SoundSystem initialized
08/04/2018 16:02:10.111 Floating-point audio supported!
08/04/2018 16:02:10.111 Audio hardware acceleration disabled (no EAX)
08/04/2018 16:02:22.354 Initializing SCM #2
08/04/2018 16:02:22.354 Deleting dynamic fxts...
08/04/2018 16:02:22.354 Finalizing script objects... 0 files unclosed, 0 libs unloaded, 0 file searches unclosed...
08/04/2018 16:02:22.359 Searching for cleo scripts
08/04/2018 16:02:22.359 Loading custom script 51_PoolRender.cs...
08/04/2018 16:02:22.359 Registering custom script named 51_Pool
08/04/2018 16:02:22.359 Loading custom script FPSUnlock.cs...
08/04/2018 16:02:22.360 Registering custom script named FPSUnlo
08/04/2018 16:02:22.360 Loading custom script nocuff.cs...
08/04/2018 16:02:22.362 Registering custom script named nocuff.
08/04/2018 16:02:22.362 Loading custom script SensitivityFix.cs...
08/04/2018 16:02:22.363 Registering custom script named Sensiti
08/04/2018 16:02:22.363 Loading custom script traktor.cs...
08/04/2018 16:02:22.363 Registering custom script named traktor
08/04/2018 16:02:23.962 Unregistering custom script named FPSUnlo
Вот ругается же :) Где проверка на готовность сампа?)
Lua:
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(0) end
 

AlexanderMcArov

Новичок
Автор темы
13
1
Вот ругается же :) Где проверка на готовность сампа?)
Lua:
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(0) end

Смори.. когда все это вставляю в код вообще не пашет..

А сделал вот так
Lua:
function main()
    while isSampAvailable() do
    wait(100)
    MainBot(0,3,3)    --Откоментировать чтобы включить "бота"
    end   
end
Заработало. И когда вылетел Еррор не крашнуло.. но Варнинги есть..
HTML:
[16:50:21] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x536DF4

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x536DF4

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x536DF4

И ещё вопросик: А по какой строке ты понял что ругается именно на эту проверку ?
 

AnWu

Guardian of Order
Всефорумный модератор
4,690
5,190
Смори.. когда все это вставляю в код вообще не пашет..

А сделал вот так
Lua:
function main()
    while isSampAvailable() do
    wait(100)
    MainBot(0,3,3)    --Откоментировать чтобы включить "бота"
    end  
end
Заработало. И когда вылетел Еррор не крашнуло.. но Варнинги есть..
HTML:
[16:50:21] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x536DF4

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x536DF4

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x544BC8

[16:50:21] Warning(s007): Exception 0xC0000005 at 0x536DF4

И ещё вопросик: А по какой строке ты понял что ругается именно на эту проверку ?
Сделал ты не правильно это раз.
два:
Lua:
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        MainBot(0, 3, 3)
    end
end
В третьих, по опыту понял что ты работаешь с САМП когда он еще не готов.
Ругалось на опкоды, а у тебя нет этой проверки
 

AlexanderMcArov

Новичок
Автор темы
13
1
Сделал ты не правильно это раз.
два:
Lua:
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        MainBot(0, 3, 3)
    end
end
В третьих, по опыту понял что ты работаешь с САМП когда он еще не готов.
Ругалось на опкоды, а у тебя нет этой проверки

Понял в чем тема была.. Сотри..
Я каждый раз при вызове MainBot создавал обьект.. но не удалял его :-)
Сейчас добавил
Lua:
    deleteObject(Object_front)
    deleteObject(Object_left)
    deleteObject(Object_right)
И все работает )
 

AnWu

Guardian of Order
Всефорумный модератор
4,690
5,190
Понял в чем тема была.. Сотри..
Я каждый раз при вызове MainBot создавал обьект.. но не удалял его :)
Сейчас добавил
Lua:
    deleteObject(Object_front)
    deleteObject(Object_left)
    deleteObject(Object_right)
И все работает )
А зачем его вообще удалять? Если создал - используй потом. Удаляй при смерти скрипта
 
  • Нравится
Реакции: AlexanderMcArov

AlexanderMcArov

Новичок
Автор темы
13
1
Да там вроде всё статичное, достаточно раз использовать.
Lua:
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        --MainBot(0, 3, 3)
            ** То что здесь, работает по в течении всего скрипта, то есть цикла..
    end
а то что здесь работает при запуске скрипта, и записывается только 1 раз ?
end
Я правильно понял ?
Смотри просто как я сделал..
Lua:
[code]-- Global
sek=1000
--******
-- Обьекты вообще вынес из всех функций.. тупо в начале скрипта поставил..
    Object_front = createObject(0,0,0,0) -- front PED
    Object_left = createObject(0,0,0,0) -- left PED
    Object_right = createObject(0,0,0,0) -- right PED
 
function MainBot(posX,posY,posZ)

    positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
    Distance = math.sqrt((positionX-posX)^2+(positionY-posY)^2+(positionZ-posZ)^2)

    --Object_front = createObject(-1,0,0,0) -- front PED
    --Object_left = createObject(-1,0,0,0) -- left PED
    --Object_right = createObject(-1,0,0,0) -- right PED
 
    attachObjectToChar(Object_front, PLAYER_PED, 0, 10, 0, 0, 0, 0)
    attachObjectToChar(Object_left, PLAYER_PED, -10, 0, 0, 0, 0, 0)
    attachObjectToChar(Object_right, PLAYER_PED, 10, 0, 0, 0, 0, 0) 
 
    ObjectPos={
    frontX,frontY,frontZ,
    leftX,leftY,leftZ,
    rightX,rightY,rightZ 
    }
 
    _, ObjectPos[1], ObjectPos[2], ObjectPos[3] = getObjectCoordinates(Object_front)
    _, ObjectPos[4], ObjectPos[5], ObjectPos[6] = getObjectCoordinates(Object_left)
    _, ObjectPos[7], ObjectPos[8], ObjectPos[9] = getObjectCoordinates(Object_right)
 
    DistanceLeft = math.sqrt((ObjectPos[4]-posX)^2+(ObjectPos[5]-posY)^2+(ObjectPos[6]-posZ)^2)
    DistanceRight = math.sqrt((ObjectPos[7]-posX)^2+(ObjectPos[8]-posY)^2+(ObjectPos[9]-posZ)^2)
    Targeting(DistanceLeft,DistanceRight)
 
    --[[vectorPedToPoint={posX-positionX,posY-positionY,posZ-positionZ}
    vectorPedToFront={ObjectPos[1]-positionX,ObjectPos[2]-positionY,ObjectPos[3]-positionZ}
    vectorScalar=(vectorPedToFront[1]*vectorPedToPoint[1]+vectorPedToFront[2]*vectorPedToPoint[2]+vectorPedToFront[3]*vectorPedToPoint[3])
    --  vectorScalar == Это чтобы узнать, впереди ли точка на которую надо ехать или сзади,
 
    vectorSummA=vectorPedToPoint[1]*vectorPedToFront[1]+vectorPedToPoint[2]*vectorPedToFront[2]+vectorPedToPoint[3]*vectorPedToFront[3]
    vectorSummB=math.sqrt(vectorPedToPoint[1]^2+vectorPedToPoint[2]^2+vectorPedToPoint[3]^2)
    vectorSummC=math.sqrt(vectorPedToFront[1]^2+vectorPedToFront[2]^2+vectorPedToFront[3]^2)]]-- 
    vectorVelocity=0--vectorSummA/(vectorSummB*vectorSummC)
    vectorScalar=0
 
    pos = string.format("Distance=%f SCALAR=%f ANGLE=%f Left=%f,Right=%f",Distance,vectorScalar,vectorVelocity,DistanceLeft,DistanceRight)
    sampTextdrawCreate(1, pos, 150, 400)
    --deleteObject(Object_front)
    --deleteObject(Object_left)
    --deleteObject(Object_right)
end

--  Targeting(left2,right2)  Эта функция как ра отвечает за поворот колес..
--первая проверка стоит чтобы колеса не дергались туда сюда постоянно. if left2-right2>=1 or right2-left2>=1 then
function Targeting(left2,right2)
    if left2-right2>=1 or right2-left2>=1 then
        if left2 >= right2 then
        right(true)
        left(false)
        elseif left2 <= right2 then
        left(true)
        right(false)
        else
        right(false)
        left(false)
        end
    else
    right(false)
    left(false)
    end
    left2,right2=0
end

function forward(bool) -- Button W
    setVirtualKeyDown(87,bool)
end

function back(bool) -- Button S
    setVirtualKeyDown(83,bool)
end

function left(bool) -- Button A
    setVirtualKeyDown(65,bool)
end

function right(bool) -- Button D
    setVirtualKeyDown(68,bool)
end


function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        --MainBot(0, 3, 3)
    end
end
[/code]
 

AnWu

Guardian of Order
Всефорумный модератор
4,690
5,190
Lua:
function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        --MainBot(0, 3, 3)
            ** То что здесь, работает по в течении всего скрипта, то есть цикла..
    end
а то что здесь работает при запуске скрипта, и записывается только 1 раз ?
end
Я правильно понял ?
Смотри просто как я сделал..
Lua:
[code]-- Global
sek=1000
--******
-- Обьекты вообще вынес из всех функций.. тупо в начале скрипта поставил..
    Object_front = createObject(0,0,0,0) -- front PED
    Object_left = createObject(0,0,0,0) -- left PED
    Object_right = createObject(0,0,0,0) -- right PED
 
function MainBot(posX,posY,posZ)

    positionX, positionY, positionZ = getCharCoordinates(PLAYER_PED)
    Distance = math.sqrt((positionX-posX)^2+(positionY-posY)^2+(positionZ-posZ)^2)

    --Object_front = createObject(-1,0,0,0) -- front PED
    --Object_left = createObject(-1,0,0,0) -- left PED
    --Object_right = createObject(-1,0,0,0) -- right PED
 
    attachObjectToChar(Object_front, PLAYER_PED, 0, 10, 0, 0, 0, 0)
    attachObjectToChar(Object_left, PLAYER_PED, -10, 0, 0, 0, 0, 0)
    attachObjectToChar(Object_right, PLAYER_PED, 10, 0, 0, 0, 0, 0)
 
    ObjectPos={
    frontX,frontY,frontZ,
    leftX,leftY,leftZ,
    rightX,rightY,rightZ
    }
 
    _, ObjectPos[1], ObjectPos[2], ObjectPos[3] = getObjectCoordinates(Object_front)
    _, ObjectPos[4], ObjectPos[5], ObjectPos[6] = getObjectCoordinates(Object_left)
    _, ObjectPos[7], ObjectPos[8], ObjectPos[9] = getObjectCoordinates(Object_right)
 
    DistanceLeft = math.sqrt((ObjectPos[4]-posX)^2+(ObjectPos[5]-posY)^2+(ObjectPos[6]-posZ)^2)
    DistanceRight = math.sqrt((ObjectPos[7]-posX)^2+(ObjectPos[8]-posY)^2+(ObjectPos[9]-posZ)^2)
    Targeting(DistanceLeft,DistanceRight)
 
    --[[vectorPedToPoint={posX-positionX,posY-positionY,posZ-positionZ}
    vectorPedToFront={ObjectPos[1]-positionX,ObjectPos[2]-positionY,ObjectPos[3]-positionZ}
    vectorScalar=(vectorPedToFront[1]*vectorPedToPoint[1]+vectorPedToFront[2]*vectorPedToPoint[2]+vectorPedToFront[3]*vectorPedToPoint[3])
    --  vectorScalar == Это чтобы узнать, впереди ли точка на которую надо ехать или сзади,
 
    vectorSummA=vectorPedToPoint[1]*vectorPedToFront[1]+vectorPedToPoint[2]*vectorPedToFront[2]+vectorPedToPoint[3]*vectorPedToFront[3]
    vectorSummB=math.sqrt(vectorPedToPoint[1]^2+vectorPedToPoint[2]^2+vectorPedToPoint[3]^2)
    vectorSummC=math.sqrt(vectorPedToFront[1]^2+vectorPedToFront[2]^2+vectorPedToFront[3]^2)]]--
    vectorVelocity=0--vectorSummA/(vectorSummB*vectorSummC)
    vectorScalar=0
 
    pos = string.format("Distance=%f SCALAR=%f ANGLE=%f Left=%f,Right=%f",Distance,vectorScalar,vectorVelocity,DistanceLeft,DistanceRight)
    sampTextdrawCreate(1, pos, 150, 400)
    --deleteObject(Object_front)
    --deleteObject(Object_left)
    --deleteObject(Object_right)
end

--  Targeting(left2,right2)  Эта функция как ра отвечает за поворот колес..
--первая проверка стоит чтобы колеса не дергались туда сюда постоянно. if left2-right2>=1 or right2-left2>=1 then
function Targeting(left2,right2)
    if left2-right2>=1 or right2-left2>=1 then
        if left2 >= right2 then
        right(true)
        left(false)
        elseif left2 <= right2 then
        left(true)
        right(false)
        else
        right(false)
        left(false)
        end
    else
    right(false)
    left(false)
    end
    left2,right2=0
end

function forward(bool) -- Button W
    setVirtualKeyDown(87,bool)
end

function back(bool) -- Button S
    setVirtualKeyDown(83,bool)
end

function left(bool) -- Button A
    setVirtualKeyDown(65,bool)
end

function right(bool) -- Button D
    setVirtualKeyDown(68,bool)
end


function main()
    if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(0) end
    while true do
        wait(0)
        --MainBot(0, 3, 3)
    end
end
[/code]
Нет. Всё что до while true do - работает один раз в игре. Дальше цикл работает постоянно а код за циклом может быть выполнен только после смерти цикла, тоесть break
 

AlexanderMcArov

Новичок
Автор темы
13
1
Нет. Всё что до while true do - работает один раз в игре. Дальше цикл работает постоянно а код за циклом может быть выполнен только после смерти цикла, тоесть break
А понял... Можешь ещё помочь чуть чуть ? Как лучше записать координаты для последующей их передачи в Mainbot(x,y,z) ?
Я сейчас хочу сделать функцию которая будет передавать новые координаты, после того как персонаж достиг заданных ранее.
Получается к примеру список координат.. который надо будет по порядку передавать..
CLEO:
116.2420,-214.7897,1.0390); // 1
133.2892,-208.9046,1.0400); // 2
134.3575,-75.8995,1.0393); // 3
134.3575,-75.8994,1.0392); // 4
228.3942,-72.5378,1.0377); // 5
232.2672,-202.7005,1.0399); // 6
 

AnWu

Guardian of Order
Всефорумный модератор
4,690
5,190
А понял... Можешь ещё помочь чуть чуть ? Как лучше записать координаты для последующей их передачи в Mainbot(x,y,z) ?
Я сейчас хочу сделать функцию которая будет передавать новые координаты, после того как персонаж достиг заданных ранее.
Получается к примеру список координат.. который надо будет по порядку передавать..
CLEO:
116.2420,-214.7897,1.0390); // 1
133.2892,-208.9046,1.0400); // 2
134.3575,-75.8995,1.0393); // 3
134.3575,-75.8994,1.0392); // 4
228.3942,-72.5378,1.0377); // 5
232.2672,-202.7005,1.0399); // 6
local coors = {{133, -208, 1}, {134, -75, 1}}
for _, v in ipairs(coors) do
-- v[1] - x, v[2] - y, v[3] - z
end
 
Статус
В этой теме нельзя размещать новые ответы.