Vennox Posted March 24, 2020 Posted March 24, 2020 so have a custom chat made using CEF and is being loaded using this: mp.gui.chat.show(false); let chatbox = mp.browsers.new('package://sampchat_assets/index.html'); chatbox.markAsChat(); aaand i updated to 1.1dev (directly from 0.3.7) and now it s ducked up (the T key opens that thing where u write, but i can t get any message get shown on the chat. i also see that the font is the one used in my custom chat, so i guess its something with marking it as a chat. i'm aware of this ( from Make sure to implement new chat API initerface (look for default chat implementation for example) Quote Make sure to implement new chat API initerface (look for default chat implementation for example) but i couldn't find any documentation about the new API, neither the default chat impletentation to take as example (where that should be?) sorry for being a dumbass
Xabi Posted March 25, 2020 Posted March 25, 2020 Check the 'ui' folder in the root path where you installed RAGE. 1
Vennox Posted March 25, 2020 Author Posted March 25, 2020 10 hours ago, Xabi said: Check the 'ui' folder in the root path where you installed RAGE. and where do i put it in the server so the players will download it like client resources
Xabi Posted March 25, 2020 Posted March 25, 2020 1 hour ago, Vennox said: and where do i put it in the server so the players will download it like client resources You just have to copy the API from that file into your chat's javascript file, there's no need to take that file anywhere.
Vennox Posted March 26, 2020 Author Posted March 26, 2020 (edited) On 3/25/2020 at 9:57 PM, Xabi said: You just have to copy the API from that file into your chat's javascript file, there's no need to take that file anywhere. not working. everytime i fire up ragemp, the file (ui>js>main.js) resets to its original. also, i have some client-side vars that depend on the CEF chat. how do i port those? i had the file sampchat.js inside client_packages, that was loaded using require("sampchat.js"); in index.js. then, inside sampchat.js i created some variables and binds and loaded the chat in CEF (the code below) Spoiler global.chatOpen = false; mp.gui.chat.show(false); let chatbox = mp.browsers.new('package://sampchat_assets/index.html'); chatbox.markAsChat(); mp.keys.bind(0x54, true, function() { if(inDialog){ //mp.gui.chat.push("t pressed"); chatbox.execute(`$(skipchatopen())`); } }); mp.keys.bind(0x0D, true, function() { if(inDialog){ WindowDialog.execute(`$(onButtonClick(0))`); } }); mp.keys.bind(0x1B, true, function() { if(inDialog){ WindowDialog.execute(`$(onButtonClick(-1))`); } }); mp.keys.bind(0x4E, true, function() { if(!inDialog && !chatOpen){ mp.events.callRemote("player_action_toggle_lock_client_handle"); } }); mp.events.add("chatState", (enable) => { chatOpen = enable; }); in sampchat_assets i had all the chat CEF things, that are supposed to go in the ui folder: Spoiler Edited March 26, 2020 by Vennox
ragempdev Posted March 26, 2020 Posted March 26, 2020 If your chat is 0.3.7 compatible adding this wrapper should bring 1.1 compatibility as well: let api = {"chat:push": chatAPI.push, "chat:clear": chatAPI.clear, "chat:activate": chatAPI.activate, "chat:show": chatAPI.show}; for(let fn in api) { mp.events.add(fn, api[fn]); } 1
KevY Posted May 21, 2020 Posted May 21, 2020 Apparently, I came across this issue, after playing around for quite a lot of time. I figured out the issue. Client could not immediately toggle mp.gui.chats.show(false); It wouldn't just disable the chat if you did it right after require'ing the script or connecting.. What made it disable was using a timer via setTimeout or a triggered event from server (under Event.PlayerConnect) This however fixed it and triggering this under OnPlayerConnect. mp.events.add("InitiateCustomChat", () => { mp.gui.chat.show(false); const chatbox = mp.browsers.new('package://chat/index.html'); chatbox.markAsChat(); }); 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now