/ragemp-keypad

A RageMP script for creating keypads server-side and hook actions to the callback

Primary LanguageJavaScriptMIT LicenseMIT


Logo

RageMP generic keypad

This allows you to create keypads and display them to the player at any given time.
Explore the code

Disclaimer: This was originally developed in 2019ish, so it might not work

Table of Contents
  1. About The Project
  2. Prerequisites
  3. Getting Started
  4. Demonstration
  5. License
  6. Contact

About The Project

Originally created around 2019, so it might be broken with newer versions of RageMP, though I believe I fixed this at some point.

The system allows you to set up a keypad server-side and hook an action to the Confirm button in the keypad. The action is invoked server-side and as argument you get the value which the user put in the keypad client-side. You can set the title, subtitle and even control if the input in the field will be asterisks for cases where the player would be typing a pin etc.

The entire keypad requires no CEF at all, and no web related dependencies. Instead the whole thing is defined and rendered using native GTA:V UI elements.

(back to top)

Prerequisites

You wont need much..

  • A RageMP server with C#

(back to top)

Getting Started

To get started put the keypad.js in your client folder and remember to include it in the index.js. Then grab the KeypadLibrary.cs and put it in your server project. With this you are ready to create keypads wherever you need them. Invoke the following function:

StartKeypadForPlayer(Player player, string title, string subTitle, bool useAsterisk, Action<Player,int> callback)

as such:

KeypadLibrary.StartKeypadForPlayer(
    ply, "Withdraw", 
    $"Current bank balance: ~g~${ply.cash}", 
    false, 
    (ply, x) =>
    {
        ply.SendChatMessage("You are withdrawing: " + x);
    });

The system supports all native colors from GTA:V so you can color the title and subtitle if needed.

(back to top)

Demonstration

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

Contact

Andreas - Website to be inserted

(back to top)