tonihenkel

Execute Game Varible in HTML Browser

Recommended Posts

Posted (edited)

Hi, I build aATM Broser and will execute a Variable from .js-File to the ATM Browser (Pocket Money and Bank Money), but it doesn't work :(

 

 

client_package/BANK/index.js:

[..]

function openCef(url) {
    if (cef) cef.destroy();
    cef = mp.browsers.new(url);
    cef.execute(`money_bank=200; money_pocket=400;`);
}
exports.openCef = openCef;

openCef(index.html);

[..]

 

html-file:

[..]

<td class="infobox_table"><center>Bank<br><script type="text/javascript">document.write(" " + money_bank + " $");</script></td>

[..]

 

I test this and works, but no with the variables:

cef.execute(`alert(\`It's a test.\`);`)

 

Edited by tonihenkel

Share this post


Link to post
Share on other sites
Posted (edited)

Mhh ok, I set:

 

Zitat

        let money_pocket = `money_pocket = 1200;`;
        let money_bank = `money_bank = 1200;`;
        openCef("bank/index.html",  money_pocket, money_bank);

I'm a beginner.I need  asimple injection of the current Money Bank and Money Pocket for the Websiten and auto-update this money, when  the money chaneged background and ARTM Browser is open (Daily payment or Player Transfer)

Look at this, this is the HTML Page http://prntscr.com/nf5fpc

 

Zitat

 

This inner example is a button event

Edited by tonihenkel

Share this post


Link to post
Share on other sites
Posted (edited)

Unfortunately there aren't any simple way to make things. You need to code all by yourself or you can use scripts already done.
You can use JS + Vue, you can use js + react, you can use c# ... There are a lot you can do to make the systems you want.

One very nice script is the menu builder:

It's client side, but you can use Events::callRemote to call a server-side event from a client-side script: https://wiki.rage.mp/index.php?title=Events::callRemote

 

There are one starter project with Vue (by MarkCavalli: https://rage.mp/profile/19144-markcavalli/)
https://github.com/MarkCavalli/rage-server-start-template

I found today a nice guide:

 

Edited by joew
  • Like 1

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.