Remco1337 Posted January 8, 2019 Share Posted January 8, 2019 (edited) Hi there, I am having a bit of trouble with making a faction through a CEF system, I have followed several tutorials also how to debug the CEF but it didn't work till now so I decided to post it here In the client_package folder I have: var openedConsole = false; let loginBrowser; let displayFactionDialoge = (player_ID) => { loginBrowser = mp.browsers.new("package://faction/createfaction.html"); mp.gui.cursor.show(true, true); openedConsole = true; }; mp.events.add("SendFactionCreateData", (user, pass, state) => { mp.gui.chat.push("SendFactionCreateData - has been activated"); mp.events.callRemote("sendFactionDataToCreateServer", user, pass, state); }); mp.keys.bind(0x1B, true, function() { if (openedConsole) { loginBrowser.destroy(); mp.gui.cursor.show(false, false); } }); mp.events.add('ShowFactionCreate', displayFactionDialoge); Which is included in the index.js which is in the same folder, then I got a folder with faction where this is .html is located: Quote <!DOCTYPE html> <html> <head> <link rel="stylesheet" type="text/css" href="assets/css/style.css"> <link rel="stylesheet" type="text/css" href="assets/css/bootstrap.min.css"> <script src="assets/js/jquery-3.2.1.js"></script> <script src="assets/js/popper.js"></script> <script src="assets/js/bootstrap.min.js"></script> </head> <body> <div class="container"> <div class="card"> <div class="card-body"> <h1 class="text-center">Create Faction</h1> <br> <div class="tab-content"> <div class="tab-pane fade show active" id="factionCreate" role="tabpanel"> <div class="input-group mb-3"> <input type="text" class="form-control" id="factionName" placeholder="Faction name"> </div> <div class="input-group mb-3"> <input type="text" class="form-control" id="factionType" placeholder="Faction type"> <button type="button" class="btn btn-primary btn-lg btn-block" id="confirmButton" onclick="sendFactionData();">Create</button> </div> </div> </div> </div> </div> <script src="assets/js/main.js"></script> </body> </html> Then I got an assets folder where my css and js are and for this occasion we only need the main.js file which is in the folder of javascript: Main.js: mp.gui.chat.push("Main.js called"); function sendFactionData() { mp.gui.chat.push("SendFactionData - completed"); mp.trigger('SendFactionCreateData', $('#factionName').val(), $('#factionType').val()); } $('#confirmButton').click(function() => { mp.gui.chat.push("Login succedsadasdasssful"); mp.trigger('SendFactionCreateData', $('#factionName').val(), $('#factionType').val()); }); Now the issue is that the website will pop-up but when I fill in the information and press the create button it doens't do anything, I also tried to debug the main.js as you can see but that wasn't even executed so I am kinda wondering how this is possible. Thanks in advance! PS: I don't think it's needed because it isn't even being called to the main.js I believe but here is the server-side file factions.js: mp.events.add("sendFactionDataToCreateServer", (player, factionName, factionType, state) => { gm.mysql.handle.query('INSERT INTO `factions` SET factionName = ?, factionType = ?', [factionName, factionType], function(err, res){ if(!err){ console.log(` Faction ${factionName} has just been made.`); } else { console.log("\x1b[31m[ERROR] " + err) } }); }); Edited January 8, 2019 by Remco1337 Link to comment Share on other sites More sharing options...
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