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
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.
You wont need much..
- A RageMP server with C#
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.
Distributed under the MIT License. See LICENSE.txt
for more information.
Andreas - Website to be inserted