Search the Community
Showing results for tags 'nodejs'.
-
Hello everybody, first of all , its a delightfull pleasure to find myself here and read about this world of RageMP Development. I consider you all do some honorable work and for that I congratulate everybody :). Few words: I am new to RAGEMP development. I started few days ago and still study most of the related posts from this forum. So please try to keep your calm if I ask some weird questions :). I used to develop few years ago for VC:MP and SA:MP servers and now I am glad this GTA5 Mod appeared and I can't wait to find/script more. Questions: 1. In the local server working environment, is there a way to create a reloading script (packages) for server in order to keep a live testing available? Example: I start the server ,at this moment with this command: nodemon --watch packages --watch client_packages --exec server.exe -e * altought, it seems like every time I change someting in code , it reloads but my client goes in the loading screen and returns a similar message to "Connection closed". Are there some known workarounds/solutions or for every update I need to force close client (Task Manager -> End Process) and reenter the game? 2. Is there a known way to test a +2 Players algorithm? For example lets say a /pay command where another player needs to be close? Do I need to find someone to test this with or is there a workaround for an fake event call of a virtual player? (playerJoined, playerSpawned, etc..)? 3. Is there any active community social media (for instance Discord) where certain Scripters help each other? If yes, can someone name it? Thank you dear reader for spending time to read all the upper sentence. Sincerly, StefanCG.
-
We are a professional heavy-text roleplay community in need of another server developer that can help us reach our next goals. The community currently holds over 1700 unique discord users and 1500 forum accounts. We are a very active community and the development team is composed of very experienced programmers that work in this field in real life. This is obviously a long-term and paid work. I. REQUIREMENTS Advanced knowledge of at least one of the following: JS, NodeJS + MySQL. II. EXPECTATIONS Ability to meet deadlines. Able to work in a team and share ideas. Past experience in SA:MP or GTA V scripting is a plus. Must know RAGE API and have proven experience in scripting for RAGE, as well as a portfolio to be presented. If you're looking to be part of a professional and huge community as a developer, and you believe you meet your requirements and expectations, please add me on discord oRe#4300 .
- 4 replies
-
- 2
-
-
- heavy-text roleplay community
- js
-
(and 1 more)
Tagged with:
-
Version 1.0.1
569 downloads
Hey all! Included in the package are the following files: 1) packages/mugshot.js - include this from within your packages/index.js file such as require("mugshot"); 2) client_packages/mugshot.js - include this in your client_packages/index.js such as require("./mugshot.js"); 3) client_packages/mugshot (Folder) - upload this directly to your client_packages folder To take a screen simply call the event: prepareScreenshot Server side: player.call("prepareScreenshot"); Client side: mp.events.call("prepareScreenshot"); The process of taking a screenshot: Request the player headshot Wait 2 seconds for it to load (best result thanks to GTA Forums reference) Get the Pedheadshot TXD String for Sprite and set Variable to true to display sprite in Render event Sprite is shown on screen for 1 frame! On the next call of Render - it will take a screenshot, which takes a screenshot of the previous frame. It will then stop processing the render event, unregister the pedheadshot and notify that a Headshot has been taken Client side will now trigger a HTML window to open ready to accept an event The event will trigger when the domReady is recieved and this event will contain the URL of the screenshot taken and the resolution of the game The HTML will then take the image, crop out only the mugshot and then convert it to base64 - roughly 50kb per mugshot The CEF will then notify Client Side to upload the data to the Server The server will recieve the Mugshot as a Base64 Image string (which can be decoded manually for testing at: https://base64.guru/converter/decode/image) It will then upload the Image currently to imgur with anonymous setting and provide you back the URL uploaded in console. To use IMGUR Go to https://api.imgur.com/oauth2/addclient - Log into your Imgur account and create an Application Set the type to Anonymous Set the callback URL to: https://www.getpostman.com/oauth2/callback Give it a name, email and description Click submit and you will get your Client ID - add this to packages/mugshot.js NOTICE: You will see the mugshot appear on screen for a brief 1-2 frames however this is unavoidable no matter what I have tried as this is how the Screenshot tool takes the screenshot in the first place.- 4 reviews
-
- 1
-
-
- mugshot
- screenshot
-
(and 3 more)
Tagged with:
-
I have been looking because I am working in a mixed cs and node js gamemode for ragemp and I need to comunicate data between the two interfaces. It shouldn't need to be any player connected. How that could be possible? I have found out this post in the wiki: https://wiki.rage.mp/index.php?title=Events::callLocal How has to be declared in c#? How would be to communicate the other way round? Thank you very much. PD1: I tknow an option would be using MySql for that, but would be too slow and/or laggy.
-
Who we are A small but ambitious team thrilling to deliver top service and best role-playing game experience to all gamers as ourselves. We are working hard to fulfill our mission and are currently looking for a Server Developer (RAGE MP) longing to become a part of our group. Job Description As a Server Developer you will be responsible for fixing bugs and maintenance of the code. A perfect candidate will be a flexible gamer ready to take on other (sometimes emerging) tasks. Your daily activity will involve C# or NodeJS knowledge as well as mapping skills. Previous experience with Rage MP server is a great asset, but not a mandatory requirement. Nice to have Experience with multiplayer games. Being an active gamer. If you are ready to take up this challenge, send us your application! What we offer · Becoming a part of interesting project · Competitive salary · A lot of challenges and ambitious tasks · Pleasant and joyful atmosphere · Further cooperation on both counterparties agreement No need to send your CV. Please contact us in Discord (Just_Frozen#9097) and we will talk about your experience and expectations. Cheers!
-
- Game Developer
- c
- (and 4 more)
-
Hi, This small tuturial how make auto server restart on file change by using webpack. 1. All doing in webpack.config.js file 2. On file top initialize empty variable: let gameServer; 3. In exports object add new plugin (with hook): plugins: [ // ... { apply: compiler => { compiler.hooks.afterEmit.tap('AfterEmitPlugin', () => { // Kill started server if (!!gameServer) { console.log('\nKill game server'); gameServer.kill(); } console.log('\nStart game server'); // Start server gameServer = spawn(path.join(__dirname, 'server.exe')); gameServer.stdout.on('data', data => process.stdout.write(data)); gameServer.stderr.on('data', data => process.stderr.write(data)); }); } } ] 4. Profit
-
В этом топике будет приведен пример добавления некоторых методов в стандартное API RageMP, основной целью этого действа является сокращение кода и ускорение разработки в будущих скриптах. Пример: // За место этого: mp.players.forEach(_player => { _player.outputChatBox("Hello!!!"); }); //Можно будет использовать удобное сокращенное: mp.players.BroadcastMessage("Hello!!!"); Начнём. Создаем в каталоге 'packages/keker' файл 'new-api.js', и сразу же объявим его в 'packages/keker/index.js' добавив туда строку: require('./new-api'); Теперь начнем добавлять наш код в 'new-api.js', начнем с методов для работы с векторами, точнее для вычисления дистанции между ними: mp.Vector3.Distance = function (v1, v2){ return Math.abs(Math.sqrt(Math.pow((v2.x - v1.x),2) + Math.pow((v2.y - v1.y),2)+ Math.pow((v2.z - v1.z),2))); } // функция вычисляющая расстояние между двумя точками в пространстве X;Y;Z; mp.Vector3.Distance2D = function (v1, v2){ return Math.abs(Math.sqrt(Math.pow((v2.x - v1.x),2) + Math.pow((v2.y - v1.y),2))); } // функция вычисляющая расстояние между двумя точками на плоскости X;Y; Теперь их можно вызывать в любом месте вашего кода. Пример: let distance = mp.Vector3.Distance(player.position, player.veh.position); // Вернет расстояние от игрока до его машины в пространстве X;Y;Z let distance = mp.Vector3.Distance2D(player.position, player.veh.position); // Вернет расстояние от игрока до его машины в горизонтальной плоскости X;Y; Теперь добавим в 'new-api.js' методы broadcast'a сообщений и удобного спавна машин: mp.players.BroadcastMessage = function(s, v, d, c){ if(typeof v == 'undefined'){ // если функция вызвана с 1 параметром BroadcastMessage("Wellcome!!!"); this.forEach( player => { player.outputChatBox(s); }); } else if( typeof v == 'string'){ // если функция вызвана с параметром цвета BroadcastMessage("Wellcome!!!", "#ddd"); this.forEach(player => { player.outputChatBox("<font color='"+v+"'>"+s+"</font>"); }); } else if(typeof v == 'object' && typeof d == 'number'){ // если функция вызвана с параметром радиуса действия BroadcastMessage("Wellcome!!!", new mp.Vector3(0, 0, 0), 50); this.forEach(player => { if(Math.pow((player.position.x - v.x), 2) + Math.pow((player.position.y - v.y), 2) + Math.pow((player.position.z - v.z), 2) < Math.pow(d, 2)){ // проверяем находится ли игрок в заданом радиусе if(typeof c == 'string') { // если функция вызвана со всеми параметрами BroadcastMessage("Wellcome!!!", new mp.Vector3(0, 0, 0), 50, "#ddd"); player.outputChatBox("<font color='"+c+"'>"+s+"</font>"); } else { player.outputChatBox(s); } } }); } } // функция выводящая сообщение в чат либо всем игрокам онлайн, либо игрокам находящимся в определенном радиусе, так же позволяет задать цвет текста mp.vehicles.Spawn = function(m, x, y, z){ if(typeof x == 'number' && typeof y == 'number' && typeof z == 'number'){ return this.new(mp.joaat(m), new mp.Vector3(x, y, z)); } else if(typeof x == "object") { return this.new(mp.joaat(m), x); } } // Спавн транспорта в заданной точке, либо по координатам X;Y;Z, возвращает созданый транспорт Их вызов в дальнейшем будет выглядеть так: //за место этого довольно маштабного кода: mp.players.forEach(_player => { _player.outputChatBox("<font color='#ddd'>Hello!!!</font>"); }); // Теперь можно использовать это, эти несколько вариантов mp.players.BroadcastMessage("Hello!!!"); // Разошлет сообщение всем игрокам сервера mp.players.BroadcastMessage("Hello!!!", "#ddd"); // Разошлет сообщение всем игрокам сервера, цвет текста будет #ddd mp.players.BroadcastMessage("Hello!!!", player.position, 50); // Разошлет сообщение всем игрокам в радиусе 50м от текущего, Local Chat mp.players.BroadcastMessage("Hello!!!", player.position, 50, "red"); // Разошлет сообщения всем игрокам в радиусе 50м от текущего, цвет текста красный // Удобный спавн траспорта // За место этого: let veh = mp.vehicles.new(mp.joaat('sultanrs'), new mp.Vector3(200, 14, 25)); // Теперь можно использовать это: let veh = mp.vehicles.Spawn('sultanrs', 200, 14, 25); // Создаст транспорт в указаных координатах, и вернет его в переменную veh //или это: let pos = player.postion; pos.x += 2; let veh = mp.vehicles.Spawn('sultanrs', pos); // Создаст транспорт в указанной точке и вернет его Ну и пару методов для работы с игроком, можно как добавить в 'new-api.js' это: mp.events.add({"playerJoin": player => { player.TeleportTo = function(x, y, z){ if(typeof x == 'object'){ // если первый параметр является вектором this.position = x; } else if(typeof x == 'number' && typeof y == 'number' && typeof z == 'number'){ // если координаты заданы по отдельности this.position = new mp.Vector3(x, y, z); } } // функция телепорта игрока к заданой точке, либо по координатам X;Y;Z; player.Message = function(s, c){ if(typeof s == 'string' && typeof c == 'string'){ // если задан цвет this.outputChatBox("<font color='"+с+"'>"+s+"</font>"); } else if (typeof s == 'string'){ this.outputChatBox(s); } } // функция для быстрой отправки сообщения игроку в чат, с возможностью задать цвет текста } }); Либо вставить код от сюда в 'packages/keker/evens/common.js', вызов этих методов будет выглядеть так: // Телепорт игрока player.TeleportTo(player.veh.position.x-2, player.veh.position.y, player.veh.postion.z); // Телепортирует игрока к точке сбоку от его машины let pos = player.veh.position; pos.x -= 2 player.TeleportTo(pos); // сделает тоже самое только сдесь в функцию передается вектор а не координаты // Удобный вывод сообщений игроку, с возможностью задать цвет текста player.Message("Hello!!!"); // Отправит сообщение в чат игроку player.Message("Hello!!!", "#ddd"); // Отправит сообщение в чат игроку, цвет текста #ddd Ну вот и все, надеюсь, что кому нибудь пригодится!
-
Guten Morgen Community, wir sind gerade an der Konzeption eines Projektes und wegen zur Zeit ab in welcher Sprache wir es entwickeln sollen. C# oder NodeJS? Würde mich über eure Antworten freuen und Gründe warum Ihr die gewählte Sprache nehmen würdet oder warum man sie nehmen sollte. Vielen Dank!
-
Hello, i have a ask for about scripting, which language is better Nodejs or CSharp for perormence (Server site)
-
Всем привет. Зашел я значить на вики, да бы посмотреть что и как, какой функционал допилили, описание немного почитать. Наткнулся на серверною и клиентскою часть ивентов и охренел. Хочу спросить у вас дорогие форумчане - почему так мало ивентов, будут ли допиливать новые, что слышали по этому поводу?. С описанием функций и примерами тоже проблемы, но это вопрос времени. И помимо этого хочу задать такой вопрос. (возможно он не много глупый) Я так понимаю что серверною часть можно писать на разных языках. И если это так то поправочка к первому вопросу, меня интересуют ивенты на nodejs.
-
Вставляем в common.js может кому будет полезно var setTimeTimer = 0; //Таймер, нужен что бы игровое время обновлялось не моментально а с n интервалом // setTimeout(function() { var date = new Date(); //получаем реальное время mp.environment.time.hour = date.getHours(); //устанавливаем игровое время (часы) mp.environment.time.minute = date.getMinutes();// устанавливаем игровое время (минуты) },0); //Игровой цикл setInterval(function(){ setTimeTimer++; //инкрементируем таймер if(setTimeTimer == 60) //60 - интервал обновления времени { //Получаем и устанавливаем время var date = new Date(); mp.environment.time.hour = date.getHours(); mp.environment.time.minute = date.getMinutes(); setTimeTimer = 0; //Обнуляем таймер } },1000); // 1000 - задержка между следующим вызовом setInterval в мс.
-
Очень часто люди задают вопрос, вроде: "как установить пакеты node.js для сервера?". В данной статье попытаюсь доходчиво объяснить как это сделать. Качаем, устанавливаем node.js, желательно версию 7.3.0, т.к. на сервер стоит именно она. Жмем пуск, открываем командную строку (Win + R, cmd). Переходим в папку с сервером (в моем случае это D:\rage_mp_server). Выглядит как-то так (текст из cmd): D: cd rage_mp_server Инициализируем npm package.json файл: npm init -y Устанавливаем необходимые нам пакеты (mysql к примеру): npm install mysql Далее можем делать require в интересующем нас .js файле (на примере index.js): var mysql = require('mysql'); var connection = mysql.createConnection({ host : 'localhost', user : 'me', password : 'secret', database : 'my_db' }); connection.connect(); connection.query('SELECT 1 + 1 AS solution', function(err, rows, fields) { if (err) throw err; console.log('The solution is: ', rows[0].solution); }); connection.end();