Вопросы по Lua скриптингу

Общая тема для вопросов по разработке скриптов на языке программирования Lua, в частности под MoonLoader.
  • Задавая вопрос, убедитесь, что его нет в списке частых вопросов и что на него ещё не отвечали (воспользуйтесь поиском).
  • Поищите ответ в теме посвященной разработке Lua скриптов в MoonLoader
  • Отвечая, убедитесь, что ваш ответ корректен.
  • Старайтесь как можно точнее выразить мысль, а если проблема связана с кодом, то обязательно прикрепите его к сообщению, используя блок [code=lua]здесь мог бы быть ваш код[/code].
  • Если вопрос связан с MoonLoader-ом первым делом желательно поискать решение на wiki.

Частые вопросы

Как научиться писать скрипты? С чего начать?
Информация - Гайд - Всё о Lua скриптинге для MoonLoader(https://blast.hk/threads/22707/)
Как вывести текст на русском? Вместо русского текста у меня какие-то каракули.
Изменить кодировку файла скрипта на Windows-1251. В Atom: комбинация клавиш Ctrl+Shift+U, в Notepad++: меню Кодировки -> Кодировки -> Кириллица -> Windows-1251.
Как получить транспорт, в котором сидит игрок?
Lua:
local veh = storeCarCharIsInNoSave(PLAYER_PED)
Как получить свой id или id другого игрока?
Lua:
local _, id = sampGetPlayerIdByCharHandle(PLAYER_PED) -- получить свой ид
local _, id = sampGetPlayerIdByCharHandle(ped) -- получить ид другого игрока. ped - это хендл персонажа
Как проверить, что строка содержит какой-то текст?
Lua:
if string.find(str, 'текст', 1, true) then
-- строка str содержит "текст"
end
Как эмулировать нажатие игровой клавиши?
Lua:
local game_keys = require 'game.keys' -- где-нибудь в начале скрипта вне функции main

setGameKeyState(game_keys.player.FIREWEAPON, -1) -- будет сэмулировано нажатие клавиши атаки
Все иды клавиш находятся в файле moonloader/lib/game/keys.lua.
Подробнее о функции setGameKeyState здесь: lua - setgamekeystate | BlastHack — DEV_WIKI(https://www.blast.hk/wiki/lua:setgamekeystate)
Как получить id другого игрока, в которого целюсь я?
Lua:
local valid, ped = getCharPlayerIsTargeting(PLAYER_HANDLE) -- получить хендл персонажа, в которого целится игрок
if valid and doesCharExist(ped) then -- если цель есть и персонаж существует
  local result, id = sampGetPlayerIdByCharHandle(ped) -- получить samp-ид игрока по хендлу персонажа
  if result then -- проверить, прошло ли получение ида успешно
    -- здесь любые действия с полученным идом игрока
  end
end
Как зарегистрировать команду чата SAMP?
Lua:
-- До бесконечного цикла/задержки
sampRegisterChatCommand("mycommand", function (param)
     -- param будет содержать весь текст введенный после команды, чтобы разделить его на аргументы используйте string.match()
    sampAddChatMessage("MyCMD", -1)
end)
Крашит игру при вызове sampSendChat. Как это исправить?
Это происходит из-за бага в SAMPFUNCS, когда производится попытка отправки пакета определенными функциями изнутри события исходящих RPC и пакетов. Исправления для этого бага нет, но есть способ не провоцировать его. Вызов sampSendChat изнутри обработчика исходящих RPC/пакетов нужно обернуть в скриптовый поток с нулевой задержкой:
Lua:
function onSendRpc(id)
  -- крашит:
  -- sampSendChat('Send RPC: ' .. id)

  -- норм:
  lua_thread.create(function()
    wait(0)
    sampSendChat('Send RPC: ' .. id)
  end)
end
 
Последнее редактирование:

eqzzz

Участник
126
19
playerCOLOR = sampGetPlayerColor(playerID)

Почему функция string.format('%x', playerCOLOR) выдает 8 значиный код, вместо 6 значеного?
 

qdIbp

Автор темы
Проверенный
1,386
1,141
2868903935 как использовать такие цвета в sampAddChatMessage и другие? Как установить текст над головой какого-то игрока?
Lua:
do
    local bit = require 'bit'
    local function join_argb(a, r, g, b)
        local argb = b  -- b
        argb = bit.bor(argb, bit.lshift(g, 8))  -- g
        argb = bit.bor(argb, bit.lshift(r, 16)) -- r
        argb = bit.bor(argb, bit.lshift(a, 24)) -- a
        return argb
    end
    local function explode_argb(argb)
        local a = bit.band(bit.rshift(argb, 24), 0xFF)
        local r = bit.band(bit.rshift(argb, 16), 0xFF)
        local g = bit.band(bit.rshift(argb, 8), 0xFF)
        local b = bit.band(argb, 0xFF)
        return a, r, g, b
    end
    local function ARGBtoRGB(color) return bit.band(color, 0xFFFFFF) end
    function ColorAccentsAdapter(color)
        local a, r, g, b = explode_argb(color)
        local ret = {a = a, r = r, g = g, b = b}
        function ret:apply_alpha(alpha)
            self.a = alpha
            return self
        end

        function ret:as_u32() return join_argb(self.a, self.b, self.g, self.r) end
        function ret:as_vec4() return imgui.ImVec4(self.r / 255, self.g / 255, self.b / 255, self.a / 255) end
        function ret:as_argb() return join_argb(self.a, self.r, self.g, self.b) end
        function ret:as_rgba() return join_argb(self.r, self.g, self.b, self.a) end

        function ret:as_chat() return string.format("%06X", ARGBtoRGB(join_argb(self.a, self.r, self.g, self.b))) end
        return ret
    end
end
sampAddChatMessage('text', ColorAccentsAdapter(2868903935--[[ЦВЕТ]]):as_chat())

Lua:
raknet = require("lib.samp.raknet")
local id, text = -1 , ''

function main()
    sampRegisterChatCommand('text',
    function(arg)
        id,text = arg:match('(%d+) (.+)')
        if id ~= -1 and text ~= '' and text ~= nil then         
            local bs = raknetNewBitStream()
            raknetBitStreamWriteInt16(bs,id) --id
            raknetBitStreamWriteInt32(bs,-1)
            raknetBitStreamWriteFloat(bs,15)
            raknetBitStreamWriteInt32(bs,5000) -- 5000 мс
            raknetBitStreamWriteInt8(bs, #text)
            raknetBitStreamWriteString(bs,text)
            raknetEmulRpcReceiveBitStream(raknet.RPC.CHATBUBBLE,bs)
            raknetDeleteBitStream(bs) else sampAddChatMessage('Где то что то не дописано',-1)
        end
    end)
    while true do wait(0)
    end
end
 

eqzzz

Участник
126
19
Lua:
do
    local bit = require 'bit'
    local function join_argb(a, r, g, b)
        local argb = b  -- b
        argb = bit.bor(argb, bit.lshift(g, 8))  -- g
        argb = bit.bor(argb, bit.lshift(r, 16)) -- r
        argb = bit.bor(argb, bit.lshift(a, 24)) -- a
        return argb
    end
    local function explode_argb(argb)
        local a = bit.band(bit.rshift(argb, 24), 0xFF)
        local r = bit.band(bit.rshift(argb, 16), 0xFF)
        local g = bit.band(bit.rshift(argb, 8), 0xFF)
        local b = bit.band(argb, 0xFF)
        return a, r, g, b
    end
    local function ARGBtoRGB(color) return bit.band(color, 0xFFFFFF) end
    function ColorAccentsAdapter(color)
        local a, r, g, b = explode_argb(color)
        local ret = {a = a, r = r, g = g, b = b}
        function ret:apply_alpha(alpha)
            self.a = alpha
            return self
        end

        function ret:as_u32() return join_argb(self.a, self.b, self.g, self.r) end
        function ret:as_vec4() return imgui.ImVec4(self.r / 255, self.g / 255, self.b / 255, self.a / 255) end
        function ret:as_argb() return join_argb(self.a, self.r, self.g, self.b) end
        function ret:as_rgba() return join_argb(self.r, self.g, self.b, self.a) end

        function ret:as_chat() return string.format("%06X", ARGBtoRGB(join_argb(self.a, self.r, self.g, self.b))) end
        return ret
    end
end
sampAddChatMessage('text', ColorAccentsAdapter(2868903935--[[ЦВЕТ]]):as_chat())

Lua:
raknet = require("lib.samp.raknet")
local id, text = -1 , ''

function main()
    sampRegisterChatCommand('text',
    function(arg)
        id,text = arg:match('(%d+) (.+)')
        if id ~= -1 and text ~= '' and text ~= nil then       
            local bs = raknetNewBitStream()
            raknetBitStreamWriteInt16(bs,id) --id
            raknetBitStreamWriteInt32(bs,-1)
            raknetBitStreamWriteFloat(bs,15)
            raknetBitStreamWriteInt32(bs,5000) -- 5000 мс
            raknetBitStreamWriteInt8(bs, #text)
            raknetBitStreamWriteString(bs,text)
            raknetEmulRpcReceiveBitStream(raknet.RPC.CHATBUBBLE,bs)
            raknetDeleteBitStream(bs) else sampAddChatMessage('Где то что то не дописано',-1)
        end
    end)
    while true do wait(0)
    end
end
цвет черным пишет в 1 ответе
 

qdIbp

Автор темы
Проверенный
1,386
1,141
playerCOLOR = sampGetPlayerColor(playerID)

Почему функция string.format('%x', playerCOLOR) выдает 8 значиный код, вместо 6 значеного?
Lua:
do
    local bit = require 'bit'
    local function join_argb(a, r, g, b)
        local argb = b  -- b
        argb = bit.bor(argb, bit.lshift(g, 8))  -- g
        argb = bit.bor(argb, bit.lshift(r, 16)) -- r
        argb = bit.bor(argb, bit.lshift(a, 24)) -- a
        return argb
    end
    local function explode_argb(argb)
        local a = bit.band(bit.rshift(argb, 24), 0xFF)
        local r = bit.band(bit.rshift(argb, 16), 0xFF)
        local g = bit.band(bit.rshift(argb, 8), 0xFF)
        local b = bit.band(argb, 0xFF)
        return a, r, g, b
    end
    local function ARGBtoRGB(color) return bit.band(color, 0xFFFFFF) end
    function ColorAccentsAdapter(color)
        local a, r, g, b = explode_argb(color)
        local ret = {a = a, r = r, g = g, b = b}
        function ret:apply_alpha(alpha)
            self.a = alpha
            return self
        end

        function ret:as_u32() return join_argb(self.a, self.b, self.g, self.r) end
        function ret:as_vec4() return imgui.ImVec4(self.r / 255, self.g / 255, self.b / 255, self.a / 255) end
        function ret:as_argb() return join_argb(self.a, self.r, self.g, self.b) end
        function ret:as_rgba() return join_argb(self.r, self.g, self.b, self.a) end

        function ret:as_chat() return string.format("%06X", ARGBtoRGB(join_argb(self.a, self.r, self.g, self.b))) end
        return ret
    end
end
function main()
    playerCOLOR = sampGetPlayerColor(playerID)
    print('0x'..ColorAccentsAdapter(playerCOLOR):as_chat())
    sampAddChatMessage('text', '0x'..ColorAccentsAdapter(playerCOLOR):as_chat())
    while true do wait(0)
    end
end

цвет черным пишет в 1 ответе
Lua:
do
    local bit = require 'bit'
    local function join_argb(a, r, g, b)
        local argb = b  -- b
        argb = bit.bor(argb, bit.lshift(g, 8))  -- g
        argb = bit.bor(argb, bit.lshift(r, 16)) -- r
        argb = bit.bor(argb, bit.lshift(a, 24)) -- a
        return argb
    end
    local function explode_argb(argb)
        local a = bit.band(bit.rshift(argb, 24), 0xFF)
        local r = bit.band(bit.rshift(argb, 16), 0xFF)
        local g = bit.band(bit.rshift(argb, 8), 0xFF)
        local b = bit.band(argb, 0xFF)
        return a, r, g, b
    end
    local function ARGBtoRGB(color) return bit.band(color, 0xFFFFFF) end
    function ColorAccentsAdapter(color)
        local a, r, g, b = explode_argb(color)
        local ret = {a = a, r = r, g = g, b = b}
        function ret:apply_alpha(alpha)
            self.a = alpha
            return self
        end

        function ret:as_u32() return join_argb(self.a, self.b, self.g, self.r) end
        function ret:as_vec4() return imgui.ImVec4(self.r / 255, self.g / 255, self.b / 255, self.a / 255) end
        function ret:as_argb() return join_argb(self.a, self.r, self.g, self.b) end
        function ret:as_rgba() return join_argb(self.r, self.g, self.b, self.a) end

        function ret:as_chat() return string.format("%06X", ARGBtoRGB(join_argb(self.a, self.r, self.g, self.b))) end
        return ret
    end
end
sampAddChatMessage('text', '0x'..ColorAccentsAdapter(2868903935--[[ЦВЕТ]]):as_chat())
 

Enlizmee

Активный
471
100
Lua:
etStructFloatElement(data, 18, 'NaN', false)
setStructFloatElement(data, 22, 'NaN', false)
setStructFloatElement(data, 26, 'NaN', false)
что значит параметр NaN?
 

Lolikas

Участник
32
0

chapo

🫡 В армии с 17.10.2023. В ЛС НЕ ОТВЕЧАЮ
Друг
8,778
11,223
Почему не удается получить прочитанный текст?
1640014936906.png

Длину текста получает верную
1640015007056.png

Lua:
function readBitStream(id, bs)
    local t = {}
    if rpcList[id] ~= nil then
        local bit = rpcList[id]
        for i = 1, #bit do
            local name = rpcList[id][i].name:lower()
            local type = rpcList[id][i].type:lower()
            local len = 128
            local data = 'placeholder'
            if type:find('int8') then
                data = raknetBitStreamReadInt8(bs)
            elseif type:find('int16') then
                data = raknetBitStreamReadInt16(bs)
            elseif type:find('int32') then
                data = raknetBitStreamReadInt32(bs)
            elseif type:find('float') then
                data = raknetBitStreamReadFloat(bs)
            elseif type:find('string') then
                if len ~= nil then
                    data = '"STRING"'--..raknetBitStreamReadString(bs, len)..'"'\
                else
                    data = 'ERR:UNK_LEN'
                end
            elseif type:find('char') then
                data = raknetBitStreamReadString(bs, len)
                sampAddChatMessage('CHAR READ RESULT: '..data, -1)
            else
                data = 'ERR:UNK_TYPE_'..type
            end
            if name:find('len') then
                len = tonumber(data)
                sampAddChatMessage('Sett new char[] or str len: '..len, -1)
            end
            table.insert(t, data)
        end
        return t
    end
end
rpclist:
local rpcList = {
    [171] = {
        {name = 'wActorID', type = 'UINT16'},
        {name = 'SkinID', type = 'UINT32'},
        {name = 'X', type = 'float'},
        {name = 'Y', type = 'float'},
        {name = 'Z', type = 'float'},
        {name = 'Angle', type = 'float'},
        {name = 'Health', type = 'float'},
        {name = 'Invulnerable', type = 'bool'},
    },
    [172] = {
        {name = 'wActorID', type = 'UINT16'},
    },
    [173] = {
        {name = 'wActorID', type = 'UINT16'},
        {name = 'AnimLibLength', type = 'UINT8'},
        {name = 'AnimLib[]', type = 'char'},
        {name = 'AnimNameLength', type = 'UINT8'},
        {name = 'AnimName[]', type = 'char'},
        {name = 'fDelta', type = 'float'},
        {name = 'loop', type = 'bool'},
        {name = 'lockx', type = 'bool'},
        {name = 'locky', type = 'bool'},
        {name = 'freeze', type = 'bool'},
        {name = 'time', type = 'UINT32'},
    },
    [174] = {
        {name = 'wActorID', type = 'UINT16'},
    },
    [175] = {
        {name = 'wActorID', type = 'UINT16'},
        {name = 'angle', type = 'float'},
    },
    [176] = {
        {name = 'wActorID', type = 'UINT16'},
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
    },
    [178] = {
        {name = 'wActorID', type = 'UINT16'},
        {name = 'health', type = 'float'},
    },
    [113] = {
        {name = 'playerid', type = 'UINT16'},
        {name = 'Index', type = 'UINT32'},
        {name = 'create', type = 'bool'},
        {name = 'Model', type = 'UINT32'},
        {name = 'bone', type = 'UINT32'},
        {name = 'fOffsetX', type = 'float'},
        {name = 'fOffsetY', type = 'float'},
        {name = 'fOffsetZ', type = 'float'},
        {name = 'fRotX', type = 'float'},
        {name = 'fRotY', type = 'float'},
        {name = 'fRotZ', type = 'float'},
        {name = 'fScaleX', type = 'float'},
        {name = 'fScaleY', type = 'float'},
        {name = 'fScaleZ', type = 'float'},
        {name = 'materialcolor1', type = 'INT32'},
        {name = 'materialcolor2', type = 'INT32'},
    },
    [59] = {
        {name = 'playerid', type = 'UINT16'},
        {name = 'color', type = 'UINT32'},
        {name = 'drawDistance', type = 'float'},
        {name = 'expiretime', type = 'UINT32'},
        {name = 'textLength', type = 'UINT8'},
        {name = 'text[]', type = 'char'},
    },
    [37] = {
        {name = 'playerid', type = 'UINT16'},
        {name = 'color', type = 'UINT32'},
        {name = 'drawDistance', type = 'float'},
        {name = 'expiretime', type = 'UINT32'},
        {name = 'textLength', type = 'UINT8'},
        {name = 'text[]', type = 'char'}, {},
    },
    [38] = {
        {name = 'type', type = 'UINT8'},
        {name = 'X', type = 'float'},
        {name = 'Y', type = 'float'},
        {name = 'Z', type = 'float'},
        {name = 'nextposX', type = 'float'},
        {name = 'nextposY', type = 'float'},
        {name = 'nextposZ', type = 'float'},
        {name = 'radius', type = 'float'},
    },
    [39] = {
        {name = 'type', type = 'UINT8'},
        {name = 'X', type = 'float'},
        {name = 'Y', type = 'float'},
        {name = 'Z', type = 'float'},
        {name = 'nextposX', type = 'float'},
        {name = 'nextposY', type = 'float'},
        {name = 'nextposZ', type = 'float'},
        {name = 'radius', type = 'float'}, {},
    },

    --[[
        SendCommand - 50
        Parameters: UINT32 length, char[] commandtext
    ]]
    [50] = {
        {name = 'length', type = 'UINT32'},
        {name = 'commandtext', type = 'char[]'},
    },

    [101] = {
        {name = 'length', type = 'UINT8'},
        {name = 'ChatMessage', type = 'char[]'},
    },
    --[[
        SendChatMessage - 101
        Parameters: UINT8 length, char[] ChatMessage
    ]]
    [107] = {
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
        {name = 'radius', type = 'float'},
    },
    [61] = {
        {name = 'wDialogID', type = 'UINT16'},
        {name = 'bDialogStyle', type = 'UINT8'},
        {name = 'bTitleLength', type = 'UINT8'},
        {name = 'szTitle', type = 'char[]'},
        {name = 'bButton1Len', type = 'UINT8'},
        {name = 'szButton1', type = 'char[]'},
        {name = 'bButton2Len', type = 'UINT8'},
        {name = 'szButton2', type = 'char[]'},
        {name = 'szInfo', type = 'CSTRING'},
    },
    [108] = {
        {name = 'wGangZoneID', type = 'UINT16'},
        {name = 'min_x', type = 'float'},
        {name = 'min_y', type = 'float'},
        {name = 'max_x', type = 'float'},
        {name = 'max_y', type = 'float'},
        {name = 'color', type = 'UINT32'},
    },
    [120] = {
        {name = 'wGangZoneID', type = 'UINT16'},
    },
    [121] = {
        {name = 'wGangZoneID', type = 'UINT16'},
        {name = 'color', type = 'UINT32'},
    },
    [85] = {
        {name = 'wGangZoneID', type = 'UINT16'},
    },
    [73] = {
        {name = 'dStyle', type = 'UINT32'},
        {name = 'dTime', type = 'UINT32'},
        {name = 'dMessageLength', type = 'UINT32'},
        {name = 'Message[]', type = 'char'},
    },
    [56] = {
        {name = 'bIconID', type = 'UINT8'},
        {name = 'posX', type = 'float'},
        {name = 'posY', type = 'float'},
        {name = 'posZ', type = 'float'},
        {name = 'type', type = 'UINT8'},
        {name = 'color', type = 'UINT32'},
        {name = 'style', type = 'UINT8'},
    },
    [144] = {
        {name = 'bIconID', type = 'UINT8'},
    },
    [26] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'bIsPassenger', type = 'UINT8'},
    },
    [154] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'wVehicleID', type = 'UINT16'},
    },
    [57] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'wComponentID', type = 'UINT16'},
    },
    [65] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'bInteriorID', type = 'UINT8'},
    },
    [70] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'bSeatID', type = 'UINT8'},
    },
    [71] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'bSeatID', type = 'UINT8'}, {},
    },
    [106] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'panels', type = 'UINT32'},
        {name = 'doors', type = 'UINT32'},
        {name = 'lights', type = 'UINT8'},
        {name = 'tires', type = 'UINT8'},
    },
    [123] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'PlateLength', type = 'UINT8'},
        {name = 'PlateText', type = 'char[]'},
    },
    [147] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'Health', type = 'float'},
    },
    [159] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
    },
    [160] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'Angle', type = 'float'},
    },
    [161] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'bObjective', type = 'UINT8'},
        {name = 'bDoorsLocked', type = 'UINT8'},
    },
    [164] = {
        {name = 'wVehicleID', type = 'INT16'},
        {name = 'ModelID', type = 'INT32'},
        {name = 'X', type = 'float'},
        {name = 'Y', type = 'float'},
        {name = 'Z', type = 'float'},
        {name = 'Angle', type = 'float'},
        {name = 'InteriorColor1', type = 'INT8'},
        {name = 'InteriorColor2', type = 'INT8'},
        {name = 'Health', type = 'float'},
        {name = 'interior', type = 'INT8'},
        {name = 'DoorDamageStatus', type = 'INT32'},
        {name = 'PanelDamageStatus', type = 'INT32'},
        {name = 'LightDamageStatus', type = 'INT8'},
        {name = 'tireDamageStatus', type = 'INT8'},
        {name = 'addsiren', type = 'INT8'},
        {name = 'modslot0', type = 'INT8'},
        {name = 'modslot1', type = 'INT8'},
        {name = 'modslot2', type = 'INT8'},
        {name = 'modslot3', type = 'INT8'},
        {name = 'modslot4', type = 'INT8'},
        {name = 'modslot5', type = 'INT8'},
        {name = 'modslot6', type = 'INT8'},
        {name = 'modslot7', type = 'INT8'},
        {name = 'modslot8', type = 'INT8'},
        {name = 'modslot9', type = 'INT8'},
        {name = 'modslot10', type = 'INT8'},
        {name = 'modslot11', type = 'INT8'},
        {name = 'modslot12', type = 'INT8'},
        {name = 'modslot13', type = 'INT8'},
        {name = 'PaintJob', type = 'INT8'},
        {name = 'BodyColor1', type = 'INT32'},
        {name = 'BodyColor2', type = 'INT32'},
    },
    [165] = {
        {name = 'wVehicleID', type = 'UINT16'},
    },
    [58] = {
        {name = 'wLabelID', type = 'UINT16'},
    },
    [94] = {
        {name = 'bHour', type = 'UINT8'},
    },
    [170] = {
        {name = 'bEnabled', type = 'bool'},
    },
    [134] = {
        {name = 'wTextDrawID', type = 'UINT16'},
        {name = 'Flags', type = 'UINT8'},
        {name = 'fLetterWidth', type = 'float'},
        {name = 'fLetterHeight', type = 'float'},
        {name = 'dwLetterColor', type = 'UINT32'},
        {name = 'fLineWidth', type = 'float'},
        {name = 'fLineHeight', type = 'float'},
        {name = 'dwBoxColor', type = 'UINT32'},
        {name = 'Shadow', type = 'UINT8'},
        {name = 'Outline', type = 'UINT8'},
        {name = 'dwBackgroundColor', type = 'UINT32'},
        {name = 'Style', type = 'UINT8'},
        {name = 'Selectable', type = 'UINT8'},
        {name = 'fX', type = 'float'},
        {name = 'fY', type = 'float'},
        {name = 'wModelID', type = 'UINT16'},
        {name = 'fRotX', type = 'float'},
        {name = 'fRotY', type = 'float'},
        {name = 'fRotZ', type = 'float'},
        {name = 'fZoom', type = 'float'},
        {name = 'wColor1', type = 'UINT16'},
        {name = 'wColor2', type = 'UINT16'},
        {name = 'szTextLen', type = 'UINT16'},
        {name = 'szText', type = 'char[]'},
    },
    [83] = {
        {name = 'color', type = 'UINT32'},
        {name = 'enable', type = 'UINT8'},
    },
    [105] = {
        {name = 'wTextDrawID', type = 'UINT16'},
        {name = 'TextLength', type = 'UINT16'},
        {name = 'Text', type = 'char[]'},
    },
    [104] = {
        {name = 'enable', type = 'UINT8'},
    },
    [126] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'bSpecCamType', type = 'UINT8'},
    },
    [127] = {
        {name = 'wVehicleID', type = 'UINT16'},
        {name = 'bSpecCamType', type = 'UINT8'},
    },
    [68] = {
        {name = 'byteTeam', type = 'UINT8'},
        {name = 'iSkin', type = 'INT32'},
        {name = 'unk', type = 'UINT8'},
        {name = 'X', type = 'float'},
        {name = 'Y', type = 'float'},
        {name = 'Z', type = 'float'},
        {name = 'fRotation', type = 'FLOAT'},
        {name = 'iSpawnWeapons1', type = 'INT32'},
        {name = 'iSpawnWeapons2', type = 'INT32'},
        {name = 'iSpawnWeapons3', type = 'INT32'},
        {name = 'iSpawnWeaponsAmmo1', type = 'INT32'},
        {name = 'iSpawnWeaponsAmmo2', type = 'INT32'},
        {name = 'iSpawnWeaponsAmmo3', type = 'INT32'},
    },
    [128] = {
        {name = 'bRequestOutcome', type = 'UINT8'},
        {name = 'byteTeam', type = 'UINT8'},
        {name = 'iSkin', type = 'INT32'},
        {name = 'unk', type = 'UINT8'},
        {name = 'X', type = 'float'},
        {name = 'Y', type = 'float'},
        {name = 'Z', type = 'float'},
        {name = 'fRotation', type = 'FLOAT'},
        {name = 'iSpawnWeapons1', type = 'INT32'},
        {name = 'iSpawnWeapons2', type = 'INT32'},
        {name = 'iSpawnWeapons3', type = 'INT32'},
        {name = 'iSpawnWeaponsAmmo1', type = 'INT32'},
        {name = 'iSpawnWeaponsAmmo2', type = 'INT32'},
        {name = 'iSpawnWeaponsAmmo3', type = 'INT32'},
    },
    [19] = {
        {name = 'angle', type = 'float'},
    },
    [137] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'unknown', type = 'INT32'},
        {name = 'isNPC', type = 'UINT8'},
        {name = 'PlayerNameLength', type = 'UINT8'},
        {name = 'PlayerName', type = 'char[]'},
    },
    [138] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'reason', type = 'UINT8'},
    },
    [155] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'score', type = 'INT32'},
        {name = 'ping', type = 'UINT32'},
    },
    [86] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'AnimLibLength', type = 'UINT8'},
        {name = 'AnimLib[]', type = 'char'},
        {name = 'AnimNameLength', type = 'UINT8'},
        {name = 'AnimName[]', type = 'char'},
        {name = 'fDelta', type = 'float'},
        {name = 'loop', type = 'bool'},
        {name = 'lockx', type = 'bool'},
        {name = 'locky', type = 'bool'},
        {name = 'freeze', type = 'bool'},
        {name = 'dTime', type = 'UINT32'},
    },
    [87] = {
        {name = 'wPlayerID', type = 'UINT16'},
    },
    [166] = {
        {name = 'wPlayerID', type = 'UINT16'},
    },
    [11] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'NameLength', type = 'UINT8'},
        {name = 'Name', type = 'char[]'},
        {name = 'unknown', type = 'UINT8'},
    },
    [12] = {
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
    },
    [13] = {
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
    },
    [34] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'dSkillID', type = 'UINT32'},
        {name = 'wLevel', type = 'UINT16'},
    },
    [153] = {
        {name = 'wPlayerID', type = 'UINT32'},
        {name = 'dSkinID', type = 'UINT32'},
    },
    [29] = {
        {name = 'bHour', type = 'UINT8'},
        {name = 'bSecond', type = 'UINT8'},
    },
    [88] = {
        {name = 'bActionID', type = 'UINT8'},
    },
    [152] = {
        {name = 'bWeatherID', type = 'UINT8'},
    },
    [17] = {
        {name = 'max_x', type = 'float'},
        {name = 'min_x', type = 'float'},
        {name = 'max_y', type = 'float'},
        {name = 'min_y', type = 'float'},
    },
    [90] = {
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
    },
    [15] = {
        {name = 'moveable', type = 'UINT8'},
    },
    [124] = {
        {name = 'spectating', type = 'UINT32'},
    },
    [30] = {
        {name = 'toggle', type = 'UINT8'},
    },
    [69] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'bTeamID', type = 'UINT8'},
    },
    [16] = {
        {name = 'soundid', type = 'UINT32'},
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
    },
    [18] = {
        {name = 'dMoney', type = 'UINT32'},
    },
    [20] = {
        {name = 'dMoney', type = 'UINT32'}, {},
    },
    [21] = {
        {name = 'dMoney', type = 'UINT32'}, {}, {},
    },
    [22] = {
        {name = 'dWeaponID', type = 'UINT32'},
        {name = 'dBullets', type = 'UINT32'},
    },
    [41] = {
        {name = 'UrlLength', type = 'UINT8'},
        {name = 'Url', type = 'char[]'},
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
        {name = 'radius', type = 'float'},
        {name = 'UsePos', type = 'UINT8'},
    },
    [42] = {
        {name = 'UrlLength', type = 'UINT8'},
        {name = 'Url', type = 'char[]'},
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
        {name = 'radius', type = 'float'},
        {name = 'UsePos', type = 'UINT8'}, {},
    },
    [43] = {
        {name = 'dObjectModel', type = 'UINT32'},
        {name = 'x', type = 'float'},
        {name = 'y', type = 'float'},
        {name = 'z', type = 'float'},
        {name = 'radius', type = 'float'},
    },
    [14] = {
        {name = 'health', type = 'float'},
    },
    [66] = {
        {name = 'armour', type = 'float'},
    },
    [145] = {
        {name = 'bWeaponID', type = 'UINT8'},
        {name = 'wAmmo', type = 'UINT16'},
    },
    [162] = {
        {name = 'bWeaponID', type = 'UINT8'},
        {name = 'wAmmo', type = 'UINT16'}, {},
    },
    [67] = {
        {name = 'dWeaponID', type = 'UINT32'},
    },
    [32] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'team', type = 'uint8'},
        {name = 'dSkinId', type = 'UINT32'},
        {name = 'PosX', type = 'float'},
        {name = 'PosY', type = 'float'},
        {name = 'PosZ', type = 'float'},
        {name = 'facing_angle', type = 'float'},
        {name = 'player_color', type = 'UINT32'},
        {name = 'fighting_style', type = 'uint8'},
    },
    [163] = {
        {name = 'wPlayerID', type = 'UINT16'},
    },
    [79] = {
        {name = 'X', type = 'float'},
        {name = 'Y', type = 'float'},
        {name = 'Z', type = 'float'},
        {name = 'wType', type = 'UINT16'},
        {name = 'radius', type = 'float'},
    },
    [55] = {
        {name = 'wKillerID', type = 'UINT16'},
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'reason', type = 'UINT8'},
    },
    [93] = {
        {name = 'dColor', type = 'UINT32'},
        {name = 'dMessageLength', type = 'UINT32'},
        {name = 'Message', type = 'char[]'},
    },
    [35] = {
        {name = 'dDrunkLevel', type = 'UINT32'},
    },
    [89] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'fightstyle', type = 'UINT8'},
    },
    [156] = {
        {name = 'bInteriorID', type = 'UINT8'},
    },
    [72] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'dColor', type = 'UINT32'},
    },
    [74] = {
        {name = 'wPlayerID', type = 'UINT16'},
        {name = 'dColor', type = 'UINT32'}, {},
    },
    [111] = {
        {name = 'enable', type = 'bool'},
    },
    [133] = {
        {name = 'bWantedLevel', type = 'UINT8'},
    },
    [157] = {
        {name = 'lookposX', type = 'float'},
        {name = 'lookposY', type = 'float'},
        {name = 'lookposZ', type = 'float'},
    },
    [158] = {
        {name = 'lookposX', type = 'float'},
        {name = 'lookposY', type = 'float'},
        {name = 'lookposZ', type = 'float'},
        {name = 'cutType', type = 'UINT8'},
    },
    
}
 

Стэнфорд

Потрачен
1,058
540
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Пытаюсь через sampCreate3dText создать 3д текст, но создается только если делать это в цикле main. А если нужно, что бы по вводу команды текст создавался? Как можно сделать это?
 
  • Грустно
Реакции: Nicolas

artemka20046

Известный
94
13
Почему весь текст выводит(должен только ник)В моем примере : Aiden_Stone
1640022554341.png
1640022588683.png


Пытаюсь через sampCreate3dText создать 3д текст, но создается только если делать это в цикле main. А если нужно, что бы по вводу команды текст создавался? Как можно сделать это?
создавать в цикле мейн??не понял