createChar

Vespan

loneliness
Автор темы
Проверенный
2,138
1,811
Версия MoonLoader
.026-beta
Можно ли НПС которого я создал синхронно двигаться как я(прыжок-бег-присядь)
 
Решение
1665216889386.png
1665216959910.png

Lua:
local Clone = nil
function main()
    while not isSampAvailable() do wait(0) end
    SpawnClone()
    while true do
        wait(0)
        if doesCharExist(Clone) then
            local x, y, z = getCharCoordinates(PLAYER_PED)
            setCharCoordinates(Clone, x + 2, y, z - 1)
            setCharHeading(Clone, getCharHeading(PLAYER_PED))
            local animName, animFile = sampGetAnimationNameAndFile(sampGetPlayerAnimationId(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))))
            taskPlayAnim(Clone, animFile, animName, 9, true, true, true, true, -1)
        end
    end
end

addEventHandler('onScriptTerminate', function(s, q)
    if s == thisScript() and doesCharExist(Clone) then...

chapo

tg/inst: @moujeek
Всефорумный модератор
9,133
12,263
1665216889386.png
1665216959910.png

Lua:
local Clone = nil
function main()
    while not isSampAvailable() do wait(0) end
    SpawnClone()
    while true do
        wait(0)
        if doesCharExist(Clone) then
            local x, y, z = getCharCoordinates(PLAYER_PED)
            setCharCoordinates(Clone, x + 2, y, z - 1)
            setCharHeading(Clone, getCharHeading(PLAYER_PED))
            local animName, animFile = sampGetAnimationNameAndFile(sampGetPlayerAnimationId(select(2, sampGetPlayerIdByCharHandle(PLAYER_PED))))
            taskPlayAnim(Clone, animFile, animName, 9, true, true, true, true, -1)
        end
    end
end

addEventHandler('onScriptTerminate', function(s, q)
    if s == thisScript() and doesCharExist(Clone) then
        deleteChar(Clone)
    end
end)

function SpawnClone()
    requestModel(49)
    loadAllModelsNow()
    Clone = createChar(4, 49, getCharCoordinates(PLAYER_PED))
    markModelAsNoLongerNeeded(49)
end