Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 06/29/18 in all areas

  1. Version 1.0.0

    3868 downloads

    Easy way to create blips: create, teleport to blip and delete. The blips are loaded on script load. Install: Copy files to your server-files and don't forget to edit index.js in client_packages if you have more resources. Commands: /blipc or /blipcreator - Enable and disable creator mod /blipd or /blipdelete - Open menu with blips to teleport or delete Keys: ' (single quotation marks) - Open and close creator menu. (Only works if creator mod is enabled) 1 (number one) - Create blip in your position with the config pre-binded (Only works if you bind) 2 (number two) - Create blip in your position with the config pre-binded (Only works if you bind) The blips are saved in json file. if you want change the directory go to (packages/BlipCreator/index.js) and change const SAVE_FILE = './blips.json'; Anyone can create and delete blips, if you have permission system or whatever, put your verifications in the commands: function blipCreator(player) and function delBlips(player) and also in events mp.events.add("delBlip", (player, id) => and mp.events.add("blipCreate", (player, data) => in file (packages/BlipCreator/index.js) Did you see a grammar error please coment thks
    1 point
  2. Version 18w48a

    16614 downloads

    NativeUI for RageMP! This can only be used Clientside! Documentation: Click Github: Click
    1 point
  3. I wanted to make a tutorial that is a little different from what is currently offered on the wiki (https://wiki.gtanet.work/index.php?title=Setting_Up_a_Development_Environment_using_Visual_Studio) This tutorial gets you through setting up a project outside the RAGE MP folder, that automatically builds into a resource folder, and allows debugging by simply pressing "Run" or F5 in Visual Studio 2017 There's a download of a project set up this way in the bottom of the post, if you just want to get started as fast as possible. You'll need to change all the paths in the configured project obviously, but there you go. Prerequisites Visual Studio 2017 (At the time of writing, using version 15.7.1) RAGE MP installed and server set up. Common sense Setup Ensure the .NET Core cross-platform development package/product is installed. Open Visual Studio Installer from the start menu Click on modify under Visual Studio {Version} 2017 Find .NET Core cross-platform development and make sure it's checked If it wasn't installed previously, after checking the box on this item, click modify in the bottom right, and install the package. Creating the project Open Visual Studio, and click File -> New -> Project. In the tree on the left, go to Installed -> Visual C# -> .NET Core. Then select Class Library (.NET Core) in the list on the right. Give your project a name in the bottom, choose a location to store it (can be anywhere on your PC), and hit OK This should create a project that compiles as .NET Core 2.0, which is the version used for resources at the time of writing. It may change to 2.1 in version 0.4 of RAGE MP. To ensure the project compiles to Core 2.0, right click on your new project in the Solution Explorer, and select Properties. Under Target framework, ensure it says .NET Core 2.0 While we're here, we can configure debugging. On the left, select the Debug tab, change the Launch dropdown to Executable. A new item appears: Executable with a Browse... button. Click browse, and select your RAGE MP server.exe The second input below that is for Working directory, set that to the folder that contains server.exe Save this window and close it. Build configuration Now we need to change how the project is built. If you want use external NuGet packages, you'll want Visual Studio to copy their DLLs to the build directory. Right click on your project in the Solution Explorer, and click Edit {project name}.csproj Under <TargetFramework>netcoreapp2.0</TargetFramework> Add the following: <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> Save and close the file. Now we set up the Meta.xml file. Right click on your project, and select Add -> New Item... In the pop-up dialog, click on Installed -> Visual C# Items in the tree on the left, then scroll down and select Xml File in the list on the right, and name it meta.xml Replace the file contents with the following, replacing ExampleResource with the name of your project: <meta> <info name="ExampleResource" type="script" /> <script src="ExampleResource.dll" /> </meta> Save and close the file. Right click on the file in Solution Explorer and click Properties Set Build Action to Content and Copy to Output Directory to Copy always Now let's configure it to copy the built project to the resources directory. Go back to the project properties (Solution Explorer, right click on the project, Properties). Open the Build Events tab, and put the following code in the text box under Post-build event command line: del "D:\Games\RAGEMP\server-files\bridge\resources\ExampleResource\*.*" /Q xcopy "$(OutDir)*" "D:\Games\RAGEMP\server-files\bridge\resources\ExampleResource" /Y Make sure to replace the path to \bridge\resources and ExampleResource with the correct path to the resources, and your project name. Also make sure the folder exists, obviously. Save and close the properties window. Try going to Build -> Rebuild Solution in the top of Visual Studio. This should complete successfully, and several DLLs should now appear in the resource folder in your server installation. Add the resource to the server settings.xml Open the settings.xml file in the RAGE MP server directory under the bridge folder Add the following, replacing ExampleResource with the name of your resource <resource src="ExampleResource" /> Save and close the file. Creating the resource Alright, that should be the basic project and debugging configured. Now let's add the GTA Network package so we can create a resource. In the Solution Explorer, right click on your project and select Manage NuGet packages... Click on Browse in the top left, search for gtanetwork.api, and install the gtanetwork.api package. By default, there should be a Class1.cs with a class in it called Class1. I like to rename this to Main.cs with a class Main, I suggest you do the same as I'll be referring to it in the rest of the tutorial. Replace the content of the file with the following. I will not be explaining basic C#, but it'll demonstrate the project working, and give you an entry point for the code: using System; using GTANetworkAPI; namespace ExampleResource { public class Main : Script { [ServerEvent(Event.ResourceStart)] public void OnResourceStart() { NAPI.Util.ConsoleOutput("Example resource loaded!"); } } } Save the file, and HIT THAT MF DEBUG BUTTON in the top of Visual Studio The server should now start up and show our console output: Breakpoints Breakpoints should also work immediately, try placing one on the console output, and hit debug: If something still doesn't work, you can download an example project here, which was set up using the steps above. Obviously you'll need to change the paths configured in it to match your system, but it may help you debug any issues.
    1 point
  4. Version 1.0.1

    832 downloads

    Simple kill feed script that displays recent deaths on the server. Installing Put the files you downloaded in their respective places Add require('killfeed') to client_packages/index.js All done Notes Even though this is a kill feed script, you can send other messages to players by passing a string (your message) to pushToKillFeed event. The kill feed is located below the ammo counter HUD element. The kill feed displays 5 items (variable: maxKillFeedItems) and will display an item for 30 seconds. (variable: killFeedItemRemoveTime) Not all death reasons are detected but weaponData.json covers most cases. Default kill feed font might not support all characters.
    1 point
  5. Version 1.0.0

    978 downloads

    Installing Put the files you downloaded in their respective places Add require('levels') to client_packages/index.js Open packages/levels/database.js and put your MySQL config All done API /* Player level and XP is accessed through currentLevel and currentXP shared data keys. You should not change the value of these shared data keys, just use them to get data and use the API to set data. */ player.data.currentLevel OR player.getVariable("currentLevel") // returns level of the player player.data.currentXP OR player.getVariable("currentXP") // returns XP of the player /* setLevel(newLevel) Sets the player's level to newLevel. (will also change player's XP to level XP) */ player.setLevel(newLevel) /* setXP(newXP) Sets the player's experience to newXP. (will update player's level) */ player.setXP(newXP) /* changeXP(xpAmount) Changes the player's experience by xpAmount. (will update player's level) */ player.changeXP(xpAmount) /* hasReachedMaxLevel() Returns whether the player has reached max level or not. */ player.hasReachedMaxLevel() /* saveLevelAndXP() Saves the player's level and XP data. Automatically called a player disconnects. */ player.saveLevelAndXP() Events These events are called on serverside when a player's level or XP changes. /* playerXPChange This event is called when a player's XP changes. */ mp.events.add("playerXPChange", (player, oldXP, newXP, difference) => { // code }); /* playerLevelChange This event is called when a player's level changes. */ mp.events.add("playerLevelChange", (player, oldLevel, newLevel) => { // code }); Example Script Here's a script that lets you change your level/XP and writes it to console: mp.events.addCommand("setlevel", (player, newLevel) => { newLevel = Number(newLevel); if (!isNaN(newLevel)) { player.setLevel(newLevel); } else { player.outputChatBox("SYNTAX: /setlevel [new level]"); } }); mp.events.addCommand("changexp", (player, amount) => { amount = Number(amount); if (!isNaN(amount)) { player.changeXP(amount); } else { player.outputChatBox("SYNTAX: /changexp [amount]"); } }); mp.events.addCommand("setxp", (player, amount) => { amount = Number(amount); if (!isNaN(amount)) { player.setXP(amount); } else { player.outputChatBox("SYNTAX: /setxp [new xp amount]"); } }); mp.events.add("playerXPChange", (player, oldXP, newXP, difference) => { console.log(`${player.name} ${difference < 0 ? "lost" : "gained"} some XP. Old: ${oldXP} - New: ${newXP} - Difference: ${difference}`); }); mp.events.add("playerLevelChange", (player, oldLevel, newLevel) => { console.log(`${player.name} had a level change. Old: ${oldLevel} - New: ${newLevel}`); }); Credits Unknown Modder - RP List IllusiveTea - Rank bar scaleform Notes This script will load and save level and XP data of players on its own but a function to save player data yourself is provided. Like said before, don't change the values of currentLevel and currentXP shared data keys. Maximum reachable level is 7999 but a player can earn XP until his rank bar is full, kinda reaching 8000. Use player.hasReachedMaxLevel() to detect if a player is level 7999 and his rank bar is full.
    1 point
  6. Version 1.0.1

    2077 downloads

    Lets you crouch by pressing CTRL. Installing Put the files you downloaded in their respective places Add require('crouch') to client_packages/index.js All done Notes Since both this script and walking styles script uses setMovementClipset and resetMovementClipset, they probably won't work at the same time. Crouching is synced between players.
    1 point
×
×
  • Create New...