Неактуально Lua [ARZ] TwinTurbo+

vegas

Известный
Автор темы
Проверенный
562
542
Ну да, проще же каждый раз удалять файл, а потом восстанавливать, нежели нажать 1 кнопку чтобы включить\выключить.
Но это дело каждого.
ля зачем его удалять по 20 раз за день, максимум удалить для игры на другом сервере
 

killyuty

Участник
111
9
ля зачем его удалять по 20 раз за день, максимум удалить для игры на другом сервере
Увы, не понимаю тебя. Ты говоришь про удаления, чтобы поиграть на других серверах. В нейм ОПЕ [ARZ]. Тебе предлагают идеи как сделать проще и функциональнее скрипт. Ну это ладно, можно и самим до шаманить. Ты ведь не против?
 

loonsige

Известный
14
1
Увы, не понимаю тебя. Ты говоришь про удаления, чтобы поиграть на других серверах. В нейм ОПЕ [ARZ]. Тебе предлагают идеи как сделать проще и функциональнее скрипт. Ну это ладно, можно и самим до шаманить. Ты ведь не против?
Скинь код уже дополненный, пожалуйста
 

F0RQU1N and

Известный
1,291
501
Скинь код уже дополненный, пожалуйста
проверяй,у_меня_самп_не_запускается,cmd:tt.active


Lua:
script_name('TwinTurbo+')
script_author('Vadyao')

local ev = require('lib.samp.events')
local go = false
local tt = true
local speed = 1.15
local active = false

function main()
    while not isSampAvailable() do wait(0) end
    while not sampIsLocalPlayerSpawned() do wait(0) end
    sampRegisterChatCommand('tt', function()
        tt = not tt
        if tt then
            printStringNow('~y~TwinTurbo+ ~g~~h~Activated', 2000)
        else
            printStringNow('~y~TwinTurbo+ ~r~Deactivated', 2000)
        end
    end)
    sampRegisterChatCommand("tt.active", function()
        active = not active
        if active then printStringNow("tt+ activated", 1350)
        else printStringNow("tt+ deactivated", 1350)
        end
    end)
    sampRegisterChatCommand('setspeed', function(var)
        if tonumber(var) then
            speed = tonumber(var)
            printStringNow('~y~New speed: ~b~~h~'..var, 2000)
        else
            printStringNow('~y~Set speed: ~b~~h~'..speed, 2000)
        end
    end)
    while true do wait(0)
        if tt then
            if isKeyDown(83) and active and isCharInAnyCar(PLAYER_PED) and getCarSpeed(storeCarCharIsInNoSave(PLAYER_PED)) > 5 then
                local data = samp_create_sync_data('vehicle')
                data.keysData = data.keysData+160
                data.send()
            end
            if isKeyDown(88) and active and isCharInAnyCar(PLAYER_PED) and getCarSpeed(storeCarCharIsInNoSave(PLAYER_PED)) <= 4 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsCursorActive() then
                go = true
                local data = samp_create_sync_data('vehicle')
                data.moveSpeed = {0,0,0}
                data.keysData = 40
                data.send()
            else
                go = false
            end
        end
    end
end

function ev.onSendVehicleSync(data)
    if active then
        if go then
            data.moveSpeed = {0,0,0}
            data.keysData = 40
            return data
        end
    end
end

function ev.onSetVehicleVelocity(turn, velocity)
    if active then
        if tt and isKeyDown(87) and isCharInAnyCar(PLAYER_PED) then
            local handle = storeCarCharIsInNoSave(PLAYER_PED)
            if getCharInCarPassengerSeat(handle, -1) == 1 and getCarSpeed(handle) < 70 then
                velocity.x = velocity.x*speed
                velocity.y = velocity.y*speed
                return {turn, velocity}
            end
        end
    end
end

function samp_create_sync_data(sync_type, copy_from_player)
    local ffi = require 'ffi'
    local sampfuncs = require 'sampfuncs'
    -- from SAMP.Lua
    local raknet = require 'samp.raknet'
    require 'samp.synchronization'

    copy_from_player = copy_from_player or true
    local sync_traits = {
        player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
        vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
        passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
        aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
        trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
        unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
        bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
        spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
    }
    local sync_info = sync_traits[sync_type]
    local data_type = 'struct ' .. sync_info[1]
    local data = ffi.new(data_type, {})
    local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
    -- copy player's sync data to the allocated memory
    if copy_from_player then
        local copy_func = sync_info[3]
        if copy_func then
            local _, player_id
            if copy_from_player == true then
                _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
            else
                player_id = tonumber(copy_from_player)
            end
            copy_func(player_id, raw_data_ptr)
        end
    end
    -- function to send packet
    local func_send = function()
        local bs = raknetNewBitStream()
        raknetBitStreamWriteInt8(bs, sync_info[2])
        raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
        raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
        raknetDeleteBitStream(bs)
    end
    -- metatable to access sync data and 'send' function
    local mt = {
        __index = function(t, index)
            return data[index]
        end,
        __newindex = function(t, index, value)
            data[index] = value
        end
    }
    return setmetatable({send = func_send}, mt)
end
 

jawn

Участник
82
9
проверяй,у_меня_самп_не_запускается,cmd:tt.active


Lua:
script_name('TwinTurbo+')
script_author('Vadyao')

local ev = require('lib.samp.events')
local go = false
local tt = true
local speed = 1.15
local active = false

function main()
    while not isSampAvailable() do wait(0) end
    while not sampIsLocalPlayerSpawned() do wait(0) end
    sampRegisterChatCommand('tt', function()
        tt = not tt
        if tt then
            printStringNow('~y~TwinTurbo+ ~g~~h~Activated', 2000)
        else
            printStringNow('~y~TwinTurbo+ ~r~Deactivated', 2000)
        end
    end)
    sampRegisterChatCommand("tt.active", function()
        active = not active
        if active then printStringNow("tt+ activated", 1350)
        else printStringNow("tt+ deactivated", 1350)
        end
    end)
    sampRegisterChatCommand('setspeed', function(var)
        if tonumber(var) then
            speed = tonumber(var)
            printStringNow('~y~New speed: ~b~~h~'..var, 2000)
        else
            printStringNow('~y~Set speed: ~b~~h~'..speed, 2000)
        end
    end)
    while true do wait(0)
        if tt then
            if isKeyDown(83) and active and isCharInAnyCar(PLAYER_PED) and getCarSpeed(storeCarCharIsInNoSave(PLAYER_PED)) > 5 then
                local data = samp_create_sync_data('vehicle')
                data.keysData = data.keysData+160
                data.send()
            end
            if isKeyDown(88) and active and isCharInAnyCar(PLAYER_PED) and getCarSpeed(storeCarCharIsInNoSave(PLAYER_PED)) <= 4 and not sampIsChatInputActive() and not sampIsDialogActive() and not sampIsCursorActive() then
                go = true
                local data = samp_create_sync_data('vehicle')
                data.moveSpeed = {0,0,0}
                data.keysData = 40
                data.send()
            else
                go = false
            end
        end
    end
end

function ev.onSendVehicleSync(data)
    if active then
        if go then
            data.moveSpeed = {0,0,0}
            data.keysData = 40
            return data
        end
    end
end

function ev.onSetVehicleVelocity(turn, velocity)
    if active then
        if tt and isKeyDown(87) and isCharInAnyCar(PLAYER_PED) then
            local handle = storeCarCharIsInNoSave(PLAYER_PED)
            if getCharInCarPassengerSeat(handle, -1) == 1 and getCarSpeed(handle) < 70 then
                velocity.x = velocity.x*speed
                velocity.y = velocity.y*speed
                return {turn, velocity}
            end
        end
    end
end

function samp_create_sync_data(sync_type, copy_from_player)
    local ffi = require 'ffi'
    local sampfuncs = require 'sampfuncs'
    -- from SAMP.Lua
    local raknet = require 'samp.raknet'
    require 'samp.synchronization'

    copy_from_player = copy_from_player or true
    local sync_traits = {
        player = {'PlayerSyncData', raknet.PACKET.PLAYER_SYNC, sampStorePlayerOnfootData},
        vehicle = {'VehicleSyncData', raknet.PACKET.VEHICLE_SYNC, sampStorePlayerIncarData},
        passenger = {'PassengerSyncData', raknet.PACKET.PASSENGER_SYNC, sampStorePlayerPassengerData},
        aim = {'AimSyncData', raknet.PACKET.AIM_SYNC, sampStorePlayerAimData},
        trailer = {'TrailerSyncData', raknet.PACKET.TRAILER_SYNC, sampStorePlayerTrailerData},
        unoccupied = {'UnoccupiedSyncData', raknet.PACKET.UNOCCUPIED_SYNC, nil},
        bullet = {'BulletSyncData', raknet.PACKET.BULLET_SYNC, nil},
        spectator = {'SpectatorSyncData', raknet.PACKET.SPECTATOR_SYNC, nil}
    }
    local sync_info = sync_traits[sync_type]
    local data_type = 'struct ' .. sync_info[1]
    local data = ffi.new(data_type, {})
    local raw_data_ptr = tonumber(ffi.cast('uintptr_t', ffi.new(data_type .. '*', data)))
    -- copy player's sync data to the allocated memory
    if copy_from_player then
        local copy_func = sync_info[3]
        if copy_func then
            local _, player_id
            if copy_from_player == true then
                _, player_id = sampGetPlayerIdByCharHandle(PLAYER_PED)
            else
                player_id = tonumber(copy_from_player)
            end
            copy_func(player_id, raw_data_ptr)
        end
    end
    -- function to send packet
    local func_send = function()
        local bs = raknetNewBitStream()
        raknetBitStreamWriteInt8(bs, sync_info[2])
        raknetBitStreamWriteBuffer(bs, raw_data_ptr, ffi.sizeof(data))
        raknetSendBitStreamEx(bs, sampfuncs.HIGH_PRIORITY, sampfuncs.UNRELIABLE_SEQUENCED, 1)
        raknetDeleteBitStream(bs)
    end
    -- metatable to access sync data and 'send' function
    local mt = {
        __index = function(t, index)
            return data[index]
        end,
        __newindex = function(t, index, value)
            data[index] = value
        end
    }
    return setmetatable({send = func_send}, mt)
end
что нового?
 

XLIPP3R

Участник
30
3
Захожу в игру пишу /tt все работает, сажусь в тачку и жму X и скрипт полностью перестает работать. С чем может быть связано ?