CEF not properly working.

Recommended Posts

Posted (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 ="package://faction/createfaction.html");, true);
  openedConsole = true;
};"SendFactionCreateData", (user, pass, state) => {"SendFactionCreateData - has been activated");"sendFactionDataToCreateServer", user, pass, state);

mp.keys.bind(0x1B, true, function() {
    if (openedConsole) {
      loginBrowser.destroy();, false);
});'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:



<!DOCTYPE html>
        <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>
        <div class="container">
            <div class="card">
                <div class="card-body">
                    <h1 class="text-center">Create Faction</h1>
                    <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 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>
        <script src="assets/js/main.js"></script>


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:"Main.js called");

function sendFactionData() {"SendFactionData - completed");
    mp.trigger('SendFactionCreateData', $('#factionName').val(), $('#factionType').val());
$('#confirmButton').click(function() => {"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:"sendFactionDataToCreateServer", (player, factionName, factionType, state) => {
  gm.mysql.handle.query('INSERT INTO `factions` SET factionName = ?, factionType = ?', [factionName, factionType], function(err, res){
          console.log(` Faction ${factionName} has just been made.`);
      } else {
          console.log("\x1b[31m[ERROR] " + err)





Edited by Remco1337

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.