Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/02/19 in Posts

  1. 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(player.name.toLowerCase() == args[1].toLowerCase()){ player.ban("Console"); res = " Player "+player.name+" was banned!!!"; } }); break; case "kick": mp.players.forEach(player => { if(player.name.toLowerCase() == args[1].toLowerCase()){ player.kick("Console"); res = " Player "+player.name+" was kicked!!!"; } }); break; case "tppos": if(args.length>4){ mp.players.forEach(player => { if(player.name.toLowerCase() == args[1].toLowerCase()){ player.position = new mp.Vector3(parseFloat(args[2]), parseFloat(args[3]), parseFloat(args[4])); res = " Player "+player.name+" 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(player.name.toLowerCase() == args[1].toLowerCase()){ player.giveWeapon(mp.joaat(args[2]), parseInt(args[3])); res = " Player "+player.name+" 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: "+mp.environment.weather+"\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.name+" | "+player.ip+" | "+player.ping+"\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)
    1 point
  2. как вариант попробуй взять клиентские файлы сервера и закинуть их в рейдж возможно поможет
    1 point
  3. Hello all, I've spent some time working with the rotation property of the vehicle object (server side of course) and I've worked out why things are "broken" with it... The setter requires x, y, z angles relative to the vehicle where the x is roll, y is pitch and z is heading. The getter returns the x, y, z angles relative to the world. That is, if the vehicle is facing south (z = 180), the setter and getter values are equal, but at any other heading, the getter object cannot be used as the setter. To solve this, I came up with the following function - I thought it might be helpful to others... const relativeRotation = (rotation) => { const {x, y, z} = rotation; const rx = (360-z) / 180 * Math.PI; const ry = z / 180 * Math.PI; return { x: x * -Math.cos(rx) + y * Math.sin(rx), y: y * -Math.cos(ry) + x * Math.sin(ry), z }; }; Basic usage... // get the rotation of the vehicle relative to the vehicle. let {x, y, z} = relativeRotation(vehicle.rotation); x += 45; // adjust the pitch of the vehicle by 45 degrees // update the vehicle rotation. vehicle.rotation = new mp.Vector3(x, y, z);
    1 point
×
×
  • Create New...