Search the Community

Showing results for tags 'Tutorial'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • RAGE Multiplayer
    • Announcements
    • Discussion
    • Suggestions
  • Scripting
    • Scripting
    • Resources
  • Community
    • Support
    • Servers
    • Media Gallery
  • Non-English
    • Русский - Russian
    • Français - French
    • Deutsch - German
    • Espanol - Spanish
    • Română - Romanian
    • Portuguesa - Portuguese
    • Polski - Polish


  • Scripts
  • Gamemodes
  • Libraries
  • Plugins
  • Maps
  • Tools

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start








Found 9 results

  1. This tutorial will only work if you already have your MySQL + RAGE project set up. Step 1 Right-click on your project and select 'Manage NuGet Packages...'. Browse for the following packages and make sure you install the same version for all! (this example uses version 2.2.0) Microsoft.EntityFrameworkCore Microsoft.EntityFrameworkCore.Tools Pomelo.EntityFrameworkCore.MySql Step 2 Create a Player.cs class with the following code: Step 3 Create a new class called '<myProject>Context.cs', in this example we will use TutorialContext.cs Paste the following code: Step 4 To make things easier for future classes, we will make an interface called IRepository.cs. This is not part of EF Core but it's a nice programming pattern to use with it. Copy-paste the code below into your interface: Step 5 Create a class called PlayerRepository.cs Now we will implement the interface we just created in our PlayerRepository.cs Step 6 Create a class called Main.cs so we can test our code on ResourceStart event. Paste the following code Step 7 Build and run your server You may get an error like: This means that in your RAGE runtime folder (D:\RAGEMP\server-files\bridge\runtime) you are missing the necessary dlls. Head over to (for example) A:\Program Files\dotnet\sdk\NuGetFallbackFolder\microsoft.entityframeworkcore\2.2.0\lib\netstandard2.0 and copy the needed .dll to the runtime folder of RAGE. You might have to do this for a couple of dlls. Just go back to the NuGetFallbackFolder and find the right one. If you fixed these errors, this should be the result: Step 8 (Extra) If you're adding more and more classes and you want to add changes to your database, use the following method: Create your new class (House.cs for example) and go back to your TutorialContext.cs and add public DbSet<House> Houses { get; set; } under Players (which we did in this tutorial). On the top left of your Visual Studio you will see a tab called 'View'. Click on it, go to 'Other Windows' and select 'Package Manager Console'. In the Package Manager Console, type: Add-Migration addedHouse Wait for the console to finish and type: Update-Database Your house class has now been added to the database. Enjoy.
  2. Hallo allerseits! Ich selber habe lange damit zugebracht zu schauen wie ich EntityFrameworkCore möglichst so nutzen kann wie EF6 (EntityFramework 6). Nach einer langen Zeit auf Google habe ich es mittlerweile auf eine recht einfache Art hinbekommen, die so jeder übernehmen kann. Ich spare mir die meisten Erklärungen, ich zeige die Schritte die ihr anwenden müsst. Inkompatibilität wenn schon andere MySQL Packages installiert sind, kann durchaus vorkommen, bitte vorher löschen. Erster Schritt Ladet folgende NuGet Packages herunter Microsoft.EntityFrameworkCore Microsoft.EntityFrameworkCore.Tools Pomelo.EntityFrameworkCore.MySQL Pomelo.EntityFrameworkCore.MySQL.Designer Der zweite Schritt Jetzt müsst ihr eurer Projekt entladen, und dann die CSProj Datei bearbeiten. Dort fügt ihr einfach folgende zwei Informationen ein: GenerateRuntimeConfigrationFiles ist ein Workaround was den Fehler behebt wenn er beim Datenbank-Model erzeugen den Net.Core nicht finden kann. Tools.DotNet... benötigen wir damit wir (dotnet ef...) nutzen können. <PropertyGroup> <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles> </PropertyGroup> <ItemGroup> <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0" /> </ItemGroup> Und jetzt der dritte Schritt Jetzt compilieren wir einmal das komplette Projekt (dafür das entladene Projekt wieder laden und dann neu erstellen). Wenn das erfolgreich war, können wir zum nächsten Schritt springen. Falls nicht, alle bisherigen MySQL Funktionen ausklammern, damit wir gleich das Model generieren können, müssen wir einmal compiliert haben. Jetzt der vierte Schritt, zusammgengefasst Wir öffnen jetzt Powershell oder CMD (am besten als Administrator). Jetzt navigieren wir zu unseren Projektfiles (wo die .csproj Datei liegt). Beispiel: "cd C:\Users\Administrator\ragemp_project\proj" Dort führen wir schnell noch einen kleinen Befehl aus - "dotnet restore" Um jetzt die Modelle zu generieren, müssen wir uns einen kleinen Befehl zusammenschreiben. dotnet ef dbcontext scaffold "Host=localhost;Port=3306;Database=vita;Username=root;Password=xxx" Pomelo.EntityFrameworkCore.MySql -o Model -f Hier die richtigen MySQL Daten hinterlegen. Wenn wir das jetzt ausführen, und wir keine Fehler erhalten, müssten im Projekt jetzt die Modelle liegen unter dem Ordner "Model". Wenn ihr Änderungen an der Datenbank durchführt, dann müsst ihr das nochmal ausführen, am besten schreibt ihr dafür eine .bat Datei! Der fünfte Schritt, ein Beispielcode Jetzt haben wir EntityFrameworkCore funktionsfähig in das Projekt integriert. Wir können jetzt auf die Datenbank zugreifen, siehe Beispiel! using System.Linq; using(var db = new Model.databasenameContext()) { var accounts = db.Accounts.FirstOrDefault(x => x.SocialClub == player.SocialClub); // Accounts = Model if(accounts == null) return; // Account wurde nicht gefunden accounts.Online = 1; db.SaveChanges(); } Bei Fragen einfach melden, oder falls ich etwas nicht richtig geschrieben habe einfach bescheid geben! Viel Spaß damit. Mit freundlichen Grüßen, Max Jackson
  3. Hello Someone asks me, how to create a car at right side next to player. So i just wrote this little tutorial about. I hope you enjoy this little thing, which was did in two hours, and explained with a horrible english ;D Spend time: 2 hours testing the spawn of vehicles and coding + doc 3 hours making this tutorial with translation 0.5 hours thinking about, why i am doing this ... (i didn't found an answer -.-) First we have to know some things: How is the World working How is the Position working How is the Rotation working How can i spawn a car (Code snippet) How is the World working? => It is a north axis oriented map. If you open the full map ingame, top is north, bottom is south. It is every time a constant and will not change How is the Position working? => It is a Vector based information. It has three types. X => left - | + right Y => top - | + bottom Z => down - | + up The "+" and "-" are the operators here in our coordination system, which we have to use later. How is the Rotation working? => It is a Vector based information. Same here we have three types, but the number is always positive. So we can just use the Z variable. X => back | front (Not tested) Y => left | right (Not tested) Z => ground Then we will get four options: N => 0° E => 270° S => 180° W => 90° We have to use the radius to know how the player is rotated away from north. Just think about your shool days. back then you had geometry and raius was a topic of it. Ok, we got our information. Let us code that stuff Small version Doc version
  4. Requirements Rage MP server files NodeJS VS Code (or preferred IDE/text editor) Basic typescript knowledge typescript in 5 minutes typescript overview Basic js/nodeJs knowledge Rage:MP TypeScript type definition for Server-side (credit: CocaColaBear) Introduction We are going to setup a simple rage mp server using typescript Getting Started Install typescript globally > npm install -g typescript Verify that you installed typescript correctly > tsc -v //version 2.9.2 (or whatever version you installed) Download Rage MP Typescript type files from: Place the the following files inside server-files folder index.d.ts vehicle_hashes.d.ts ped_hashes.d.ts weapon_hashes.d.ts enums.d.ts Setting Up Environment Go inside server-files and initiate a new npm project > npm init keep pressing enter until it asks "is this ok" and type yes or press enter. Now you should have a package.json in your server-files folder. Next install typescript dev dependencies > npm install --save-dev typescript After the install is complete, open your package.json and you should see typescript under devDependencies Next create a tsconfig.json file by running the following command > tsc --init You should now have a tsconfig.json file in your server-files directory. Open tsconfig.json and replace with: { "compileOnSave": true, "compilerOptions": { /* Basic Options */ "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */ "module": "commonjs", /* Specify module code generation: 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ "resolveJsonModule": true, /* needed to read json*/ "esModuleInterop": true, /* needed to read json*/ "outDir": "./packages/mygamemode", /* Redirect output structure to the directory. */ "strict": true /* Enable all strict type-checking options. */ }, "files": [ "index.d.ts", "vehicle_hashes.d.ts", "weapon_hashes.d.ts", "ped_hashes.d.ts", "enums.d.ts" ], "include": [ "src/**/*" ], "exclude": [ "node_modules", "**/*.spec.ts" ] } Next create a new folder called "src" inside server-files Inside of src folder create another folder called "mygamemode" or whatever your gamemode will be. Note*: make sure your "outDir": "./packages/[GAMEMODENAMEHERE]" matches your gamemode folder name in tsconfig.json Within the mygamemode create a typescript file called index.ts(this will be your initial index.js file) mygamemode/index.ts import './commands'; Next create a folder within mygamemode called commands and inside this new commands folder create a new typescript file called index.ts mygamemode/commands/index.ts function setArmour(player: PlayerMp) { player.armour = 100; }'armour', setArmour); Compiling Now we will compile the typescript files to output to packages/mygamemode open command and type > tsc -w what this command does is it compiles your whole project first and then watches for all .ts file changes and compiles/outputs them to packages/mygamemode which is specified in the tsconfig.json. Note*: Whenever you edit a .ts file, the typescript watch (tsc -w) will automatically compile the files to packages/mygamemode. Finally run your server.exe and enjoy coding in typescript! GitHub link:
  5. Hello, I would like to show you how to properly install the RageMP server on the Centos 7 linux distribution. Table of Contents: System update Package installation Building GCC 7.3.0 Adding a user Server installation Starting the server Informations: Yum - Package manager in the RHel system Update - Argument to yum Install - Argument to yum -y - skipping accepting installation Screen - Allows you to run processes in the background Warning! Change USERNAME to your username! 1. System update yum update -y; 2. Package installation yum install epel-release -y; yum install nano zip unzip libunwind libunwind-devel libicu libicu-devel nodejs npm screen psmisc curl wget gmp-devel mpfr-devel libmpc-devel; yum groupinstall 'Development Tools'; 3. Building GCC (7.3.0) - The process takes about 1H or 2H depends on what server you have. cd /root; wget; tar -xf gcc-7.3.0.tar.gz; mkdir gcc-build; cd gcc-build; ../gcc-7.3.0/configure --enable-languages=c,c++ --disable-multilib --prefix=/usr/ ; make -j$(nproc); make install; 4. Adding a user adduser USERNAME Setting the password passwd USERNAME 5. Server installation su - USERNAME wget; tar -xf ragemp-srv.tar.gz; cd ragemp-srv; mv * ../; cd ../; rm -rf ragemp-srv; wget; tar -xf bridge-package-linux.tar.gz; rm -rf *.tar.gz 6. Starting the server screen -dmS serwer ./server Going to the console screen -r serwer Original Polish Tutorial: 2018 © Matix8981 All rights reserved
  6. Create file 'commandline.js' to dir 'packages/keker' with the following code: const readline = require('readline'); const rl = readline.createInterface({ input: process.stdin, output: process.stdout }); function ParseCmd(s){ var args = s.split(" "); var cmd = args[0].toLowerCase(); var res = ''; switch(cmd){ case "ban": mp.players.forEach(player => { if( == args[1].toLowerCase()){ player.ban("Console"); res = " Player "" was banned!!!"; } }); break; case "kick": mp.players.forEach(player => { if( == args[1].toLowerCase()){ player.kick("Console"); res = " Player "" was kicked!!!"; } }); break; case "tppos": if(args.length>4){ mp.players.forEach(player => { if( == args[1].toLowerCase()){ player.position = new mp.Vector3(parseFloat(args[2]), parseFloat(args[3]), parseFloat(args[4])); res = " Player "" was teleported to X:"+parseFloat(args[2])+" Y:"+parseFloat(args[3])+" Z:"+parseFloat(args[4])+"!!!"; } }); } else { res = " Invalid arguments!!!" } break; case "give.weapons": if(args.length>3){ mp.players.forEach(player => { if( == args[1].toLowerCase()){ player.giveWeapon(mp.joaat(args[2]), parseInt(args[3])); res = " Player "" received weapons!!!"; } }); } else { res = " Invalid arguments!!!" } break; case "status": res = "\n Players: "+mp.players.length+"/"+mp.players.size+"\n Vehicles: "+mp.vehicles.length+"\n Objects: "+mp.objects.length+"\n Wheather: ""\n Game Time: "+mp.environment.time.hour+"h\n Uptime: "+process.uptime()+"\n"; break; case "online": res = "\n Online: "+mp.players.length+"/"+mp.players.size+"\n "; mp.players.forEach(player => { res +=" | "+player.ip+" | ""\n "; }); break; default: res = " Unknown command!!!"; break; } return res; } rl.on('line', (s) => { var res = ParseCmd(s); console.log(res); }); After that, append to file 'packages/keker/index.js' the following line: require("./commandline"); Then you can execute commands on the server console. The list of available commands as seen from the code: ban <PlayerName> -> Kiked player kick <PlayerName> -> Baned player tppos <PlayerName> <X> <Y> <Z> -> Teleport player to coordinates give.weapons <PlayerName> <WeaponName> <Amount> -> Give weapon to player status -> Show server info online -> Show players list with info(Name,IP,Ping)
  7. lucas

    RageMP + Kotlin

    Getting Started with Development 🛠 🔰 The easiest way is with no doubt to download the boilerplate / example project from GitHub.You can look at the example package that is included in there to figure out how everything works. Once you've ran the Package option in IntelliJ within the boilerplate, copy the contents of the client_packages folder that should now have appeared in the project folder to the server's client_packages folder. It's that simple? Is there some kind of catch? 🤔 Nope! There is no catch. All you need to get started is an IDE that supports Kotlin. I recommend JetBrain's IntelliJ IDEA due to its performance, flexibility and customization options. I'm super excited for what the simplicity of Kotlin will bring to the RageMP community and all of your creations that have been made just a tiny bit easier 😉 (PS If you click on the header picture, it'll take you straight to the GitHub page for the library with more examples)
  8. Witajcie, Chciał bym wam zaprezentować jak zainstalować poprawnie serwer RageMP na dystrybucji linux'a Centos 7. Spis treści: Aktualizacja systemu Instalacja pakietów Budowanie GCC 7.3.0 Dodawanie użytkownika Instalacja serwera Uruchamianie serwera Informacje: Yum - Menadzer pakietów w systemie RHel'owskich Update - Argument do yum Install - Argument do yum -y - skip'owanie akceptacji Screen - Umożliwia uruchamiać procesy w tle 1. Aktualizacja Systemu yum update -y; 2. Instalacja pakietów yum install epel-release -y; yum install nano zip unzip libunwind libunwind-devel libicu libicu-devel nodejs npm screen psmisc curl wget gmp-devel mpfr-devel libmpc-devel; yum groupinstall 'Development Tools'; 3. Budowanie GCC (7.3.0) - Proces trwa około 1H lub 2H zależy jaki posiadasz serwer. cd /root; wget; tar -xf gcc-7.3.0.tar.gz; mkdir gcc-build; cd gcc-build; ../gcc-7.3.0/configure --enable-languages=c,c++ --disable-multilib --prefix=/usr/ ; make -j$(nproc); make install; 4. Dodawanie użytkownika adduser nazwaużytkownika Ustawianie hasła passwd nazwaużytkownika 5. Instalacja serwera su - nazwaużytkownika wget; tar -xf ragemp-srv.tar.gz; cd ragemp-srv; mv * ../; cd ../; rm -rf ragemp-srv; wget; tar -xf bridge-package-linux.tar.gz; rm -rf *.tar.gz 6. Uruchomienie serwera screen -dmS serwer ./server Przechodzenie do konsoli screen -r serwer 2018 © Matix8981 Wszelkie prawa zastrzeżone 2018 © Matix8981 All rights reserved
  9. Lunix

    /model id (Changed)

    Hello. For the lazy and I do not know, give a little tutorial how to use id PS This tutorial is desirable for a pure server. So, let's begin!) To get started in the "events" create a file "skin.js" Then we declare a global variable global.ped = { }; Then take out the list of our skins, I took only the animals global.ped = { skin: mp.joaat(["A_C_Boar", "A_C_Chickenhawk", "A_C_Chimp", "A_C_Chop", "A_C_Cormorant", "A_C_Cow", "A_C_Coyote", "A_C_Crow", "A_C_Deer", "A_C_Fish", "A_C_Hen", "A_C_Husky", "A_C_MtLion", "A_C_ig", "A_C_igeon", "A_C_Rat", "A_C_Retriever", "A_C_Rhesus", "A_C_Rottweiler", "A_C_Seagull", "A_C_SharkTiger", "A_C_shepherd")] }; I apologize for this ugly code)) in the description I'll leave the file with a complete list of skins)) Then go to the folder "commands" in "basiccommands.js" file We are looking for the string "model": (player, args) => and replace command "model": (player, args) => { if (args[1] >= 723) { player.outputChatBox("Use /model 0-722"); } else if (args[1] >= 0 || args[1] <= 722) { player.model =[args[1]]; } else if (typeof args[1] === 'string') { player.outputChatBox("Use /model 0-722"); } }, 1. We checked for correct input id skin 2. If you enter /model 0 the output functions player.model = [args [1]]; 3. If you enter /model A_C_Boar the output error player.outputChatBox("Use /model 0-722"); It was decided to withdraw a mistake because can ruin, using say /model infernus And so, what we have: when you type the command "/model 0" we will give the skin a boar If you somehow liked the tutorial support a good comment Sorry for my English, an interpreter)) skin.js - Help in correcting code CocaColaBear