GangstaSunny

Client-Side Scripting - How to start?

Recommended Posts

Hello,

since I'm from sa-mp i obviously only know the server-side scripting.
I already did some stuff like MySQL-connection, different disconnecting messages (depending on exitType) and so on.

 

To get all the abilities from RageMP I (of course) also want to use the client-side scripting.
First, I just want to get myself in and do stuff like 

mp.gui.chat.colors = true;
mp.game.player.setHealthRechargeMultiplier(0.0);

Both things are client-side functions.
 

So, how to start with client-side scripting, which file(s) do I need to create and where to put them?

Thanks a lot.

 

//edit

Oh wow! It's simple as that. Just need to create .js files inside the server-files/client-packages/ directory. That's it.

Edited by GangstaSunny

Share this post


Link to post
Share on other sites

Here's a simple tutorial for you to be organized in Client-side scripting:

1) Create a index.js  in client_packages folder

2) Create a folder in client_packages called lets say gamemode.

3) Add the index.js 

 

 

require('gamemode/index');

4) After that enter the folder you created and add another index.js

5) Inside the gamemode folder you can add as much as files you want with client side scripting stuff as Mr.Pancake said.

Client-side Scripting

6) Don't forget to link every file you create to the index.js inside gamemode folder

it'll simply be like that
 

require('./gamemode/file.js')


That's all you need to know about Client side scripting for now...

  • Like 1

Share this post


Link to post
Share on other sites

Since i do require those files this is only to get a clear view about my stuff, am i right?

Which basicly mean i could also add everything just inside my index.js. Am i right again?

Also i would like to know whetever ragemp is specially looking for an index.js or am I able to use any file name even if there may as mentioned above is only one file.

 

// smartphone - bad english possible

Edited by GangstaSunny

Share this post


Link to post
Share on other sites

Yes, RAGE does look for the specific file index.js. that's the first file where your client side initalize from

Share this post


Link to post
Share on other sites
vor 5 Stunden schrieb Captien:

Yes, RAGE does look for the specific file index.js. that's the first file where your client side initalize from

I guess this counts for server-side too then?

 

// smartphone - bad english possible

Edited by GangstaSunny

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.