[RAKSAMP] ошибка в коде.

arc warden

Участник
Автор темы
139
21
Вообще не могу понять где тут ошибка.
chto eto:
local sampev = require 'samp.events'

function sampev.onServerMessage(color,text)
    if text:find('%[(%d+)%]{FFFFFF}: testing') then
        local id = text:match('%[(%d+)%]')
        sampSendChat('/plveh' .. id .. '522 1')
    end
end

сама ошибка - attempt to call global 'sampSendChat' state traceback
 

ChromiusJ

PARΛDIGM ΛSS
Друг
4,920
3,203
Вообще не могу понять где тут ошибка.
chto eto:
local sampev = require 'samp.events'

function sampev.onServerMessage(color,text)
    if text:find('%[(%d+)%]{FFFFFF}: testing') then
        local id = text:match('%[(%d+)%]')
        sampSendChat('/plveh' .. id .. '522 1')
    end
end

сама ошибка - attempt to call global 'sampSendChat' state traceback
В раксампа нет такого понятия как сампсендчат
Используй SendInput
 

arc warden

Участник
Автор темы
139
21
Lua:
require('addon')
local sampev = require 'samp.events'

function sampev.onServerMessage(color,text)
    if text:find('%[(%d+)%]{FFFFFF}: testing') then
        local id = text:match('%[(%d+)%]')
        sendInput('/plveh ' .. id .. ' 522 1')
    end
end
теперь это ошибки нету но не выполняется sendInput

а стоп

конечно я же беру функции с аддона боже

при этом не импортируя его

нет сендинпут не выполняется
 

ChromiusJ

PARΛDIGM ΛSS
Друг
4,920
3,203
теперь это ошибки нету но не выполняется sendInput

а стоп

конечно я же беру функции с аддона боже

при этом не импортируя его

нет сендинпут не выполняется
Скинь полностью строчку с чатлога как говорит игрок,или попробуй этот вариант
Lua:
require('addon')
local sampev = require 'samp.events'

function sampev.onServerMessage(color,text)
    if text:find('[A-z0-9_]+%[(%d+)%]{FFFFFF}: .+') then
        local id = text:match('[A-z0-9_]+%[(%d+)%]')
        sendInput('/plveh ' .. id .. ' 522 1')
    end
end
 

arc warden

Участник
Автор темы
139
21
Скинь полностью строчку с чатлога как говорит игрок,или попробуй этот вариант
Lua:
require('addon')
local sampev = require 'samp.events'

function sampev.onServerMessage(color,text)
    if text:find('[A-z0-9_]+%[(%d+)%]{FFFFFF}: .+') then
        local id = text:match('[A-z0-9_]+%[(%d+)%]')
        sendInput('/plveh ' .. id .. ' 522 1')
    end
end
[00:34:02] [MSG] {FCC645}[ADMIN]{FFFFFF} {8b00ff}Куратор {ffffff}OneLight_Lovec[31]{FFFFFF}: testing - да я все это тестирую на нубо рп
 

ChromiusJ

PARΛDIGM ΛSS
Друг
4,920
3,203
Код:
require('addon')
local sampev = require 'samp.events'

function sampev.onServerMessage(color,text)
    if text:find('{.-}%[ADMIN%]{.-} {.-}.- {.-}[A-z0-9_]+%[(%d+)%]{.-}: .+') then
        local id = text:match('{.-}%[ADMIN%]{.-} {.-}.- {.-}[A-z0-9_]+%[(%d+)%]{.-}: .+')
        sendInput('/plveh ' .. id .. ' 522 1')
    end
end
Попробуй так
 

arc warden

Участник
Автор темы
139
21
ты админ, а кар выдается вроде игроку, попробуй на игроке
кар выдается внезависимости

Код:
require('addon')
local sampev = require 'samp.events'

function sampev.onServerMessage(color,text)
    if text:find('{.-}%[ADMIN%]{.-} {.-}.- {.-}[A-z0-9_]+%[(%d+)%]{.-}: .+') then
        local id = text:match('{.-}%[ADMIN%]{.-} {.-}.- {.-}[A-z0-9_]+%[(%d+)%]{.-}: .+')
        sendInput('/plveh ' .. id .. ' 522 1')
    end
end
Попробуй так
0_0 а что писать то.