Sign in to follow this  
Mayo93

Client-side GUI

Recommended Posts

Hello.

I have a problem to make  a GUI on client side, which will trigger a function in server side file. Can you explain me step by step how to make this on example: Write cmd "/gui" and in this moment on my screen will be displayed a simple window GUI with one button and when I click it, he trigger server side function with message line: console.log("It works").

It will be very helpful for me to understand how works rage mp triggering and gui design. Or if this is too much for you community, will be okay to tell me, which functions should I use to make this.

Greetings

Mayo

Share this post


Link to post
Share on other sites

to trigger client event from html use mp.trigger(event, args) inside you html file (use <script>) https://wiki.rage.mp/index.php?title=Trigger

to trigger server event from client use mp.events.callRemote(event, args) https://wiki.rage.mp/index.php?title=Events::callRemote

to trigger client event from server side use player.call (event, args) https://wiki.rage.mp/index.php?title=Player::call

to execute some code to your html file use browser.execute(code) on client https://wiki.rage.mp/index.php?title=Browser::execute

 

Reply if you need some examples.

Edited by Hanvod
  • Like 1

Share this post


Link to post
Share on other sites

Okay, thank you so much for your feedbacks. Hanvod, first I will try make something, but when I get a problems I will reply :)

 

edit. Everything works fine !

 

Edited by Mayo93

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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.