- 20
- 0
у меня допустим есть ники, мне нужно, что-бы если этот чел находился на сервере, и скрипт из его ника выдавал ид. пытался сделать не робит
[ML] (error) auto_forms: ...mes\Arizona Games Launcher\bin\moonloader\auto_forms.lua:82: attempt to concatenate global 'ruk_id' (a nil value)
stack traceback:
...mes\Arizona Games Launcher\bin\moonloader\auto_forms.lua: in function <...mes\Arizona Games Launcher\bin\moonloader\auto_forms.lua:76>
stack traceback:
[C]: in function 'create'
...mes\Arizona Games Launcher\bin\moonloader\auto_forms.lua:76: in function 'callback'
...a Games Launcher\bin\moonloader\lib\samp\events\core.lua:79: in function <...a Games Launcher\bin\moonloader\lib\samp\events\core.lua:53>
[ML] (error) auto_forms: Script died due to an error. (1805723C)
[ML] (error) auto_forms: ...mes\Arizona Games Launcher\bin\moonloader\auto_forms.lua:82: attempt to concatenate global 'ruk_id' (a nil value)
stack traceback:
...mes\Arizona Games Launcher\bin\moonloader\auto_forms.lua: in function <...mes\Arizona Games Launcher\bin\moonloader\auto_forms.lua:76>
stack traceback:
[C]: in function 'create'
...mes\Arizona Games Launcher\bin\moonloader\auto_forms.lua:76: in function 'callback'
...a Games Launcher\bin\moonloader\lib\samp\events\core.lua:79: in function <...a Games Launcher\bin\moonloader\lib\samp\events\core.lua:53>
[ML] (error) auto_forms: Script died due to an error. (1805723C)
Lua:
no_forms = {'Ricky_Late', 'Farmer', 'Sam_Mason', 'Conor', 'Dorian_Gray', 'Stalker_Team', 'Sebastian_Disney', 'Jackie_Wilson', 'Derick_Stealer', 'Sapphire_Davydov', 'Maxim_Cordero', 'Don_Morrison', 'Nicolas_Source', 'Alfredo Reynolds'}
function sampGetPlayerIdByNickname(nick)
nick = tostring(nick)
local _, myid = sampGetPlayerIdByCharHandle(PLAYER_PED)
if nick == sampGetPlayerNickname(myid) then return myid end
for i = 0, 1003 do
if sampIsPlayerConnected(i) and sampGetPlayerNickname(i) == nick then
return i
end
end
end
ruk_id = sampGetPlayerIdByNickname(no_forms)
function se.onServerMessage(color, text)
if text:match('%[A%] %{......%}(.*)%[(%d+)%]%{......%}: /(.*) '..ruk_id..'%s(.*)') then
-- code
end
end