Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/20/18 in all areas

  1. Version 1.2

    4749 downloads

    UPDATE I highly recommending using my more updated resource "MySQL Accounts" instead as it fixes known issues and runs better: This resource will stay up, however I will not be giving any help for this resource as I don't believe it should be used for serious projects. ---- Basic MySQL Gamemode Github Link: https://github.com/MrPancakers/ragemp-mysql Resource Thread: Discord: MrPancakers#9283 This is a template of a very basic login/registration system you can implement into your game mode to get started. This template only stores usernames, passwords(encrypted with BCrypt), position and money so anything extra will need to be implemented yourself. This is intended for beginners so the code is pretty basic and nothing fancy has been done so it is easily readable. If you find any issues, leave a comment on my thread or leave a comment on this resource. Installation You'll need to have a MySQL server setup, either using WAMP/XAMPP/or from a server. To keep this short I will not go through setting these up, simply Google 'How to set up WAMP' for example to get it set up. Unzip the source and place it inside of your server files folder. Open your command prompt and change your directory to your server folder. Then do 'npm install' to install the required node_modules. Create a new database and call it whatever you want (Inside the script it is called 'ragemp-mysql'). Once created, import the ragemp-mysql.sql into your newly created database. Go to packages/mysql/mysql.js and open it. At the top is the connection info, change this to whatever your IP and MySQL username/password is. If you're hosting this locally and you haven't made/changed the MySQL info, the default should be fine. You're all set to go.
    1 point
  2. Version 1.0.0

    1111 downloads

    Small script that adds instantly killing headshots. Installing Put headshots into your server's client_packages directory, then add require('headshots'); to client_packages/index.js.
    1 point
  3. Requirements Rage MP server files NodeJS VS Code (or preferred IDE/text editor) Basic typescript knowledge typescript in 5 minutes typescript overview Basic js/nodeJs knowledge Rage:MP TypeScript type definition for Server-side (credit: CocaColaBear) Introduction We are going to setup a simple rage mp server using typescript Getting Started Install typescript globally > npm install -g typescript Verify that you installed typescript correctly > tsc -v //version 2.9.2 (or whatever version you installed) Download Rage MP Typescript type files from: https://github.com/CocaColaBear/types-ragemp-s Place the the following files inside server-files folder index.d.ts vehicle_hashes.d.ts ped_hashes.d.ts weapon_hashes.d.ts enums.d.ts Setting Up Environment Go inside server-files and initiate a new npm project > npm init keep pressing enter until it asks "is this ok" and type yes or press enter. Now you should have a package.json in your server-files folder. Next install typescript dev dependencies > npm install --save-dev typescript After the install is complete, open your package.json and you should see typescript under devDependencies Next create a tsconfig.json file by running the following command > tsc --init You should now have a tsconfig.json file in your server-files directory. Open tsconfig.json and replace with: { "compileOnSave": true, "compilerOptions": { /* Basic Options */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "resolveJsonModule": true, /* needed to read json*/ "esModuleInterop": true, /* needed to read json*/ "outDir": "./packages/mygamemode", /* Redirect output structure to the directory. */ "strict": true /* Enable all strict type-checking options. */ }, "files": [ "index.d.ts", "vehicle_hashes.d.ts", "weapon_hashes.d.ts", "ped_hashes.d.ts", "enums.d.ts" ], "include": [ "src/**/*" ], "exclude": [ "node_modules", "**/*.spec.ts" ] } Next create a new folder called "src" inside server-files Inside of src folder create another folder called "mygamemode" or whatever your gamemode will be. Note*: make sure your "outDir": "./packages/[GAMEMODENAMEHERE]" matches your gamemode folder name in tsconfig.json Within the mygamemode create a typescript file called index.ts(this will be your initial index.js file) mygamemode/index.ts import './commands'; Next create a folder within mygamemode called commands and inside this new commands folder create a new typescript file called index.ts mygamemode/commands/index.ts function setArmour(player: PlayerMp) { player.armour = 100; } mp.events.addCommand('armour', setArmour); Compiling Now we will compile the typescript files to output to packages/mygamemode open command and type > tsc -w what this command does is it compiles your whole project first and then watches for all .ts file changes and compiles/outputs them to packages/mygamemode which is specified in the tsconfig.json. Note*: Whenever you edit a .ts file, the typescript watch (tsc -w) will automatically compile the files to packages/mygamemode. Finally run your server.exe and enjoy coding in typescript! GitHub link: https://github.com/tameemi/ragemp-typescript
    1 point
  4. I do not see any files from the zip archive. look like mine https://imgur.com/a/bKpytiy
    1 point
  5. 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.
    1 point
  6. Check out the freeroam gamemode. Has a few examples of interacting with server side from client side gui. https://github.com/n-n1ks/rage.mp-freeroam
    1 point
  7. 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...
    1 point
×
×
  • Create New...