S0beit Posted March 3, 2023 Posted March 3, 2023 Is there a way that you can implement Python as a scripting language for rage.mp? If yes, then how?
lifesheets Posted June 7, 2023 Posted June 7, 2023 (edited) Unfortunately, Python is not a popular multiplayer programming API for Grand Theft Auto V. However, JavaScript can be used to create a new window within the game. Sample JavaScript code to open a new window with the URL "package://cef/index.html" using the Multiplayer API (mp): mp.gui.chat.push("Opening browser window..."); mp.events.add("render", () => { if (!mp.gui.cursor.visible) { mp.gui.cursor.visible = true; } mp.game.ui.displayRadar(false); }); mp.events.add("keydown", (key) => { if (key === 27) { // ESC key mp.gui.cursor.visible = false; mp.game.ui.displayRadar(true); } }); mp.gui.browser.create("package://cef/index.html"); If you choose to use Python, you may find the RAGE Multiplayer API Python Wrapper package useful, which allows you to work with Ragemp partly through Python. However, this library is limited in functionality and may not be suitable for complex Ragemp 1.1 projects. Sample code using the Python Wrapper RAGE Multiplayer API: import rage import time def on_player_connect(player): player.output_chat_box("Привет, это сервер RAGE Multiplayer!") # Пример создания транспорта player_pos = player.position vehicle = rage.Vehicle(hash=0xB779A091, position=position, number_plate="PYTHON") vehicle.engine_on = True player.put_in_vehicle(vehicle) rage.on_player_connect(on_player_connect) while True: rage.sleep(1000) This code will create a simple Ragemp server that will tell players when they connect and create a transport for each player when they connect. However, for more complex functions, you may need to use JavaScript or C#. Edited June 7, 2023 by lifesheets English translation
Kopra Posted June 8, 2023 Posted June 8, 2023 Not a big fan of python, but would love to see Python API take over current JS one. Anyways it will never happen, but nice to imagine.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now