Jump to content

12 Screenshots

About This File

RAGEMP ROLEPLAY GAMEMODE

A perfect game mode to get started with if you're about to make a roleplay server!

 

This game mode is still work in progress, I will maintain and update it generally, plenty features are planned to be added so stay tunned!

At current state, this gamemode is perfect to be used as a boilerplate for you to start a rp server!

Built in:

Client side:

  • Typescript
  • Webpack

Server side

  • Typescript
  • Webpack
  • Typeorm
  • PostgreSQL

Frontend(CEF)

  • ReactTS
  • MobX

 

Current Features

  •  - Account system (Login/Register).
  •  - Character System (3 Available slots to create)
  •  - Inventory System
  •  - Notification system
  •  - Chat System
  •  - Command system

 

Getting started with setting up:

Database setup:
This code requires you to have PostgreSQL installed on your machine, read more at https://www.postgresql.org/
After installing PostgreSQL, connect to your database using PGAdmin or HeidiSQL and create a new database by executing a query like: 

CREATE DATABASE mydb;

After creating a database successfully, head back to the server files and edit .env by describing the database connection details there.
Once you're setup with that, simply start the server, and the TypeORM will start creating the required database tables on its own (see Database.module.ts for deeper info)

 

Code Structure:

ragemp-rp-gamemode
├───config #contains webpack configuration files
├───frontend
│   └───src
│       ├───assets #contains assets such as page images or videos
│       ├───events #contains page events which can be called from the backend
│       ├───pages #contains pages
│       ├───stores #contains temporary stores
│       ├───styles #contains global styling
│       └───utils #contains useful code methods
│
├───source #contains backend code
│   ├───client #contains client-side code
│   ├───server #contains server-side code
│   └───shared #contains shared data between server and client
│
└───.env #contains database connection details

 

Getting started with development:

(BACKEND)

  1. Make sure you have an empty ragemp-server folder ready.
  2. After downloading the gamemode, move all files to your ragemp-server folder.
  3. Open the gamemode to your terminal and simply install the required packages executing 'npm install', this will install all required packages the gamemode uses.
  4. After the packages are installed make sure you created the database explained above.
  5. Start server-side in development mode: Simply execute 'npm run watch:server' to start watching server side in development mode.
  6. Start client-side in development mode: Simply execute 'npm run watch:client' to start watching client side in development mode.

(FRONTEND)

  1. Create a folder named package2 in client_packages folder.
  2. Navigate to frontend folder in your terminal.
  3. Install the required packages executing 'npm install'
  4. Once packages are done installing simply run 'npm run build'
  5. Once the build is done, it will automatically be moved to package2 folder.
  6. Once you're done, start the server and that's pretty much it.

 

Github link: shr0x/ragemp-rp-gamemode: A startup rp script to make your way into making a rp server easier! (github.com)

More docs are in the github repo, also keep an eye since most of the updates will be published there first then will eventually be updated in this post.

 

 

Edited by shrox
github link (shows now gamemode instead of framework)


What's New in Version 0.0.7-b1   See changelog

Released

 Version 0.0.7-b1

Additional

[+] Added /do to describe a rp action.
[+] Added /s(hout) to shout out a message.
[+] Added /w(hisper) to whisper another player (/w [target] [message]).
[+] Added /admins to list all online admins. (for level 1 admin)
[+] Added /givecash (/givemoney) [player] [amount].
[+] Added /goto for level 1 admins & a bunch of admin teleport locations.
[+] Added /gethere for level 1 admins to teleport a player to their position.

[+] Added chat module with various chat methods (see below).
[+] Added in-vehicle interaction, you can now interact with the vehicle you're in by pressing G.
[+] Added player nametags.
[+] Added player.setEmoteText(color: array4d, text: string, timeout: number /*seconds*/);
[+] Added DynamicPoint.createBlip(sprite: number, position Vector3, ...options);
[+] Added DynamicPoint.destroyBlip();
[+] Added player-crawling, not being used currently but it might in future.
[+] Added DynamicPoint.createMarker(type: number, position: Vector3, scale: number, ...options);
[+] Added DynamicPoint.destroyMarker();
[+] Added new interactive progress bar for inventory.
[+] Added Client.isDead (get) -> Returns true if a player is in death state, false if not.

[+] Added player-attachments with slightly changes and a bunch of attachments which may come handy to you for your creative content. (Credits: https://rage.mp/files/file/144-efficient-attachment-sync/)
--->player.addAttachment(name:string, attach:boolean);

[+] Added player.character.cash property (get/set)
[+] Added player.giveMoney(amount: number, logMessage?:string);

[+] (UI) Added player cash to HUD.
[+] (UI) Added a way to exit the interaction menu when in the first page.
[+] (UI) Added native menu.
[+] (UI) Added interactive button, supports progress bar & input.
[+] (UI) (WIP) Added player settings menu, to change account password, manage display settings & keybindings.

Changes

[/] Few changes on creator icons.
[/] Increased size of radial menu.
[/] Players can no longer open inventory or use quick slots while they're in injured state.
[/] Updated draw distance for interactable NPC text label.
[/] Moved some inventory exported enums to shared folder.
[/] You can now press ESC(escape) to close most of the pages that you're allowed to.

 

New


Radial Menu Changes

Now it has a center button to exit the menu if in first page.
https://camo.githubusercontent.com/a1a8f5fdefc810e7bbbe14760b418044b5f7ad5b01972b187b75cee304cd01af/68747470733a2f2f692e696d6775722e636f6d2f787735496654542e706e67

 

Interaction UI

https://camo.githubusercontent.com/cb95554412b0002b889872f24fee971b0fd14279523f31c60cfa350ddd2c0a74/68747470733a2f2f692e696d6775722e636f6d2f55556f6c5959702e706e67
https://camo.githubusercontent.com/07d25bbf9a07ec178e488e7063691d4272c3dc92c537ded7f88c297a7b949ae7/68747470733a2f2f692e696d6775722e636f6d2f554c474f4e51462e706e67
https://camo.githubusercontent.com/208a57c7ec8596052938861ad3f702c40c65e35a1de9afc752511ee0e5c9c8cf/68747470733a2f2f692e696d6775722e636f6d2f347062486679422e706e67

Example

//Example of how to show a button
const buttonData: RageShared.Interfaces.IInteractButton = {
    button: "Esc",
    autoStart: false,
    time: 0,
    count: 0,
    image: "default",
    rarity: 0,
    header: "Hello World",
    description: "This is a description"
};
RAGERP.cef.emit(player, "hud", "showInteractionButton", buttonData);

//Example of how to hide it
RAGERP.cef.emit(player, "hud", "showInteractionButton", null);

Player emotes

Creates a player emote text-label above their head.

Example

player.setEmoteText([255, 255, 255, 255], "Hello world", 7);

https://camo.githubusercontent.com/439cce39be4b9402ba1c79777af1f54e33a235cb4db556edf57cf81502368504/68747470733a2f2f692e696d6775722e636f6d2f447972364a63722e706e67

 

Chat methods

RAGERP.chat.sendNearbyMessage(position: Vector3, radius: number, message: string);
RAGERP.chat.sendSyntaxError(player: PlayerMp, message: string);
//color must be 32-bit hex (eg 0x00AA00AA)
RAGERP.chat.sendAdminWarning(color: number, message: string, level: number = ADMIN_LEVEL_ONE);

/* Sends a syntax error message */
RAGERP.chat.sendSyntaxError(player: PlayerMp, message: string);

//Example
RAGERP.commands.add({
    name: "message",
    run: (player: PlayerMp, text: string) => {
        if (!text.length) return RAGERP.chat.sendSyntaxError(player, "/message [text]"); //returns "Usage: /message [text]"
        //do what you want
    }
});

Player Crawling (client-side only)

import {Client} from './path/to/classes/Client.class.ts';

//enable or disable player-crawling animation for local player.
Client.toggleCrawling();

 

Native Menu (currently, server-side only)

Native menu will make your job easier as developer to create stuff for players to quickly interact with.
Currently it supports 3 button types, default button, a string list switcher (left and right) and a checkbox.

 

//initialize a new native menu:
new NativeMenu(player: PlayerMp, id: number, header: string, desc: string, items: Array<[]>);

//A promise awaiting the response of item data that player has selected in native menu
nativemenu.onItemSelected(player).then((data) => {
    //do what you want
});

//destroy a menu for given player
nativemenu.destroy(player);


//example
RAGERP.commands.add({
    name: "testnativemenu",
    adminlevel: RageShared.Enums.ADMIN_LEVELS.LEVEL_SIX,
    run: async (player: PlayerMp) => {
    
        const items = [
            { name: "test", type: RageShared.Enums.NATIVEMENU_TYPES.TYPE_DEFAULT, uid: 0 },
            { name: "test 2", type: RageShared.Enums.NATIVEMENU_TYPES.TYPE_DEFAULT, uid: 1 },
            { name: "test 3", type: RageShared.Enums.NATIVEMENU_TYPES.TYPE_DEFAULT, uid: 2 }
        ]
    
        player.nativemenu = new NativeMenu(player, 0, "Hello World", "This is a description", items);

        player.nativemenu.onItemSelected(player).then((res) => {
            if (!res) return player.nativemenu?.destroy(player);
            
            const data = RAGERP.utils.parseObject(res);
            
            console.log("onItemSelected called, with result: ", data);

            switch (data.listitem) {
                case 0: {
                    console.log("player selected the first item in native menu");
                    return;
                }
                default: {
                    return console.log(`player selected index ${data.listitem} | name: ${data.name} | uid: ${data.uid}`);
                }
            }
        });
    }
});

 

https://camo.githubusercontent.com/467cb2e0f97cffd5308a7258d5ce826af6d50e8291e73e519d8fa0e1dd3234ae/68747470733a2f2f692e696d6775722e636f6d2f78506d774b6a6a2e706e67

Settings

Settings menu is currently done only in UI and is not connected with backend, however here's a screenshot of how it looks like, in this menu you'll be able to cchange your account's password, display settings and keybinding.
https://camo.githubusercontent.com/45112266db068b8e548809ffa4fc54229a67580fcd1a203da5cce133aaf3e978/68747470733a2f2f692e696d6775722e636f6d2f5649385642494d2e706e67

Inventory progress bar

Inventory progress bar will allow you to show players an interactive progress bar which they can cancel at any time
An example would be when they're using an item, such as when they're eating, you can create a new progress bar with the given item, animation and time which player can cancel when they have to by pressing ESC

interface IUsingItemData {
    item: RageShared.Inventory.Interfaces.IBaseItem;
    animDict?: string;
    animName?: string;
    flag?: number;
    attachObject?: string;
}

/*
  * @param {PlayerMp} player - The player interacting with the item.
  * @param {string} description - The description of the progress bar.
  * @param {number} time - The duration of the progress bar in seconds.
  * @param {IUsingItemData} data - The data related to the item being used.
  * @param {() => void} onFinish - Callback function to execute when the progress bar finishes.
 */
player.character.inventory.startUsingItem(player: PlayerMp, description: string, time: number, data: IUsingItemData, handler: () => void)


//example (NOTE: this item does not exist, its just an example)
const items = player.character.inventory.getItemsInCategoryByType([RageShared.Inventory.Enums.INVENTORY_CATEGORIES.POCKETS], RageShared.Inventory.Enums.ITEM_TYPES.ITEM_TYPE_BURGER);
if (!items.length) return;

const actionData = {
    item: items[0],
    animDict: "mp_player_inteat@burger",
    animName: "mp_player_int_eat_burger",
    flag: 49,
    attachObject: "item_hamburger"
}

player.character.inventory.startUsingItem(player, "Press ESC to cancel this action", 5, actionData, async () => {
    console.log("Player has finished eating a burger!");
});

 

  • Like 2

User Feedback

Create an account or sign in to leave a review

You need to be a member in order to leave a review

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

ragempdev

   6 of 6 members found this review helpful 6 / 6 members

Awesome contribution - thanks for the release!

Mastin16

   1 of 1 member found this review helpful 1 / 1 member

Nice gamemode
How do I get the highest staff rank?

Response from the author:

Hi, either set it from the database or make a custom command for it.

TheePandaa

  

So Cool. What's the server PORT and how can i connect it? like this?: 127.0.0.1:22005 ?

×
×
  • Create New...