尝试调用一个空值(全局'TriggerClientEvent')FiveM聊天框

所以我买了这个脚本,但是似乎找不到任何支持......所以我需要一些帮助。参考资料,此脚本在其他人输入时在其头上播放“打字”GIF

RegisterCommand("chatbox", function(source, args, rawCommand)
    chatbox = tonumber(args[1])
    if chatbox == 1 then
        TriggerClientEvent('chatbox:ToggleDisplay', -1, source, 1, "chatbox")
    elseif chatbox == 2 then
        TriggerClientEvent('chatbox:ToggleDisplay', -1, source, 3, "chatbox")
    elseif chatbox == 3 then
        TriggerClientEvent('chatbox:ToggleDisplay', -1, source, 2, "chatbox")
    end
end, false)

这就是使我产生ClientEvent错误的代码。

if chatInputActivating then
  if not IsControlPressed(0, 245) then
      ExecuteCommand("chatbox 1") -- chatbox 1-3 which one you wanna use
    SetNuiFocus(true)

    chatInputActivating = false
  end
end

这是在聊天中输入时激活此功能的代码(放在resources/gameplay/chat/中的cl_chat.lua中)

原文链接 https://stackoverflow.com/questions/70699926

点赞