Jump to content

Search the Community

Showing results for tags 'Player'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

Categories

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

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Facebook


Youtube


Skype


Web


VK

Found 10 results

  1. Version 1.0.0

    1000 downloads

    This simple script gives the player a random color for the chat when he joins. If you already have a chat, i recommend you removing it & modifying this one to make it look like your old chat or merge them.
  2. Hallo Leute, ich möchte gerne für einen bestimmten Spieler ein blip erstellen, um genauer zu sagen für einen der in einem Job ist. Damit er dann auch nur die Job Map-Icons (Blips) sehen kann und die anderen, die diesen job nicht haben, dies nicht sehen bzw haben. Freundliche Grüße und Dank im voraus, Concil
  3. Hey Guys, hope you can help me with my problem. i want to end a function in a Event, if the player disconnects or leave the Server. But i only get crashes. Here my Code: function playerQuit(player) { console.log(`${player.name} has quit.`); } mp.events.add("playerQuit", playerQuit); // After player die mp.events.add("playerDeath", (player, reason, killer) => { //Set values hospital -> player dead/alive //hospitaltime -> time that he have to be in hospital player.hospital = 1; player.hospitaltime = 12; //update values in database gm.mysql.handle.query('UPDATE `accounts` SET hospital = ?, hospitaltime = ? WHERE username = ?', [player.hospital, player.hospitaltime, player.name], function(err, res, row){ if(err) console.log(err); }); if(player){ gm.mysql.handle.query('SELECT hospital, hospitaltime FROM `accounts` WHERE username = ?', [player.name], function(err, res){ if(err) console.log(err); //Read Values from Database player.hospital = parseInt(res[0]["hospital"]); player.hospitaltime = parseInt(res[0]["hospitaltime"]); }); //if player is dead do -> if(player.hospital == 1){ var timeLeft = parseInt(player.hospitaltime); var timerID = setInterval(countdown, 5000); //Countdown for hospitaltime function countdown(){ //if time over player have to be spawned and timeout have to be cleared if(timeLeft == 1){ clearTimeout(timerID); player.hospitaltime = 0; player.hospital = 0; gm.mysql.handle.query('UPDATE `accounts` SET hospital = ?, hospitaltime = ? WHERE username = ?', [player.hospital , player.hospitaltime, player.name], function(err, res, row){ if(err) console.log(err); }); player.spawn(new mp.Vector3(-799.5113525390625, -99.25785827636719, 37.604530334472656)); return; } else { // if player leave put values in database if(playerQuit.player.name == player.name){ clearTimeout(timerID); player.hospital = 1; player.hospitaltime = timeLeft; gm.mysql.handle.query('UPDATE `accounts` SET hospital = ?, hospitaltime = ? WHERE username = ?', [player.hospital , player.hospitaltime, player.name], function(err, res, row){ if(err) console.log(err); }); return; } //write new values timeLeft--; gm.mysql.handle.query('UPDATE `accounts` SET hospitaltime = ? WHERE username = ?', [timeLeft, player.name], function(err, res, row){ if(err) console.log(err); }); } } } } }); to test this code i have in my cmd.js this: mp.events.addCommand('kick', (player, target) => { let newTarget = mp.players.at(target); if(!target || isNaN(target)) return player.outputChatBox("Syntax: /kick [playerID]"); if(newTarget === null) return player.outputChatBox("There is no player online with the ID given.") newTarget.outputChatBox("You have been kicked from the server."); newTarget.kick('Kicked.'); }); My server crashes everytime when i kick me, when im in the hospital. it also crashes without this Code section: // if player leave put values in database if(playerQuit.player.name == player.name){ clearTimeout(timerID); player.hospital = 1; player.hospitaltime = timeLeft; gm.mysql.handle.query('UPDATE `accounts` SET hospital = ?, hospitaltime = ? WHERE username = ?', [player.hospital , player.hospitaltime, player.name], function(err, res, row){ if(err) console.log(err); }); return; } i get following logs in my console: Error: asyc stack has become corrutep (actual: 29, expected: 30) 1: 00007FF824079805 2: 00007FF824059B82 3: 00007FF824069CB3 4: 00007FF82409ABD0 5: 00007FF82415BCDE 6: 00007FF8241F810D 7: 00007FF8241F5066 [...]***more of them*** Edit: The problem was, that i had 2 events with the same name. now it does not crash anymore
  4. Hey guys, i just started new with JS and ragemp(big noob) and have a question. It probably sounds dumb. I wanted to get a console log after a player disconntects. I got this from the wiki and put it in my "./packages/project/index.js": function playerQuitHandler(player, exitType, reason) { let str = player.name; if (exitType != "kicked") { str += " quit."; } else { str = ` kicked. Reason: ${reason}.`; } console.log(str); } mp.events.add("playerQuit", playerQuitHandler); After i quit game i only get a message like(the message also comes a bit late): [N] 127.0.0.1:51274 has been disconnected. i probably forget something to add but dont know what. Thank you for your help! edit: did "solve" the problem by using: mp.events.add("playerQuit", (player) => { console.log(player.name + " quit."); );
  5. Flashrex

    Soundviewer

    Version 1.0.0

    321 downloads

    Just a simple js-script that let you play every sound in the following list and gives you info about the current sound on the bottom of the screen: https://wiki.rage.mp/index.php?title=Sounds Install: Simply drop the files in your client-packages folder and merge the index.js with your index.js. How to use: Type /s or /sound to activate/deactivate it. Use Left-Arrow, Right-Arrow to navigate trough the sounds. Credits: Thanks to n0minal and his interior Resource with which i learned how to create commands in js.
  6. Hello Guys, is there any way to create player only blips? like players who have a job and for them create the blips... Greetz, Concil
  7. 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
  8. Good day dear people I wanted to ask how it is possible to check if a player is near another player I would appreciate an answer Thank you regards
  9. tl;dr: - How to check if player is carrying a specific weapon - How to check how much ammo he is carrying Hello, i hope that this is the right subforum for my problem. I am trying to make an armory where players can take and put weapons/ammo. The "take" is working fine, but I don't find a way to check (on server-side) if a player carries the weapon he wants to put in and how much ammo he is carrying, so when a player wants to put a weapon in the armory, i don't know if hes actually carrying the weapon. In the wiki i have found: Player::getWeaponAmmo (not working with weapon hash, always returns 0) Player::weaponAmmo (don't know how to use) Player::weapons (don't know how to use) Player::allWeapons (returns "{}") Regards, Pacco (i'm not a native english speaker, so please have indulgence)
  10. После создании структуры персонажа не удается вызвать функцию из структуры Существует данный скрипт global.PLAYERS = {}; function AddPlayer(playerid, skin, name, health, armor, eat, money, bank, weapons, arrests, stars, drugs, fraction, rank) { PLAYERS[playerid] = {}; const temp = {}; temp.name = name; temp.skin = skin; temp.health = health; temp.armor = armor; temp.eat = eat; temp.money = money; temp.bank = bank; temp.weapons = weapons; temp.arrests = arrests; temp.stars = stars; temp.fraction = fraction; temp.rank = rank; temp.drugs = drugs; this.GetName=function(){ return this.name; } this.GetSkin=function(){ return this.skin; } this.SetSkin=function(skin){ this.skin = skin; } this.GetHp=function(){ return this.health; } this.SetHp=function(health){ this.health = health; } this.GetHp=function(){ return this.health; } this.SetHp=function(health){ this.health = health; } this.GetArm=function(){ return this.armor; } this.SetArm=function(armor){ this.armor = armor; } this.GetEat=function(){ return this.eat; } this.SetEat=function(eat){ this.eat = eat; } this.GetMoney=function(){ return this.money; } this.SetMoney=function(money){ this.money = money; } this.GetBank=function(){ return this.bank; } this.SetBank=function(bank){ this.bank = bank; } this.GetDrugs=function(){ return this.drugs; } this.SetDrugs=function(drugs){ this.drugs = drugs; } this.GetWeapons=function(){ return this.weapons; } this.SetBank=function(weapons){ this.weapons = weapons; } this.AddWeapon=function(weapon){ this.weapons.push(weapon);} this.RemoveWeapon=function(weapon){ this.weapons.remove(this.indexOf(weapon));} this.GetArrests=function(){ return this.arrests; } this.AddArrests=function(){ this.arrests += 1; } this.GetStars=function(){ return this.stars; } this.SetStars=function(stars){ this.stars = stars; } this.GetFraction=function(){ return this.fraction; } this.SetFraction=function(fraction){ this.fraction = fraction; } this.GetRank=function(){ return this.rank; } this.SetRank=function(rank){ this.rank = rank; } PLAYERS[playerid] = temp; } function RemovePlayer(playerid) { PLAYERS[playerid] = {}; } При подключении игрока вызывается эвент "playerJoin" а в нем функция : AddPlayer(player.id, models["a_f_y_hipster_02"], player.name, 100, 100, 100, 500, 0, {"Pistol": 900}, 0, 0, 0, 0, 0); В мод добавлена команда: "getdata": (player, args) => { let id = player.id; player.outputChatBox('Name:<br /><b>'+PLAYERS[id].name+'</b>'); player.outputChatBox('skin:<br /><b>'+PLAYERS[id].skin+'</b>'); player.outputChatBox('health:<br /><b>'+PLAYERS[id].health+'</b>'); player.outputChatBox('armor:<br /><b>'+PLAYERS[id].armor+'</b>'); player.outputChatBox('eat:<br /><b>'+PLAYERS[id].eat+'</b>'); player.outputChatBox('money:<br /><b>'+PLAYERS[id].money+'</b>'); player.outputChatBox('bank:<br /><b>'+PLAYERS[id].bank+'</b>'); }, При вызове команды выходит ошибка, PLAYERS[0].name is not defined где именно я накосячил с ООП структурой? (P.S переходил с Lua )
×
×
  • Create New...