Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/13/18 in Posts

  1. Нет, о эрпэ даже не думал, хочу дм, идеи есть, навыков нету, в общем буду пробывать =)
    1 point
  2. This function is intended to simulate that the tires break when fired. getClosestVehicle() returns only one int, not the vehicle handle. Here is my working client-side script: mp.events.add('playerWeaponShot', (targetPosition) => { let nearestVehicle = mp.game.vehicle.getClosestVehicle(targetPosition.x, targetPosition.y, targetPosition.z, 2, 0, 70); if( nearestVehicle != 0 ) { // chance of damage if( Math.floor((Math.random() * 100) + 1) < 25 ) { for (var i = 0; i < 4; i++) { var DamagedWheel = Math.floor((Math.random() * 9)); mp.vehicles.atHandle(nearestVehicle).setTyreBurst(DamagedWheel, true, 1000); } } } }); But I think it's easier and safer to run these functions on the server side. Here is an example from my server: mp.events.add('vehicle_toggle_lock', (Player) => { var NearbyVehicles = []; mp.vehicles.forEachInRange(Player.position, 2.5, (NerbyVehicle) => { NearbyVehicles.push(NerbyVehicle); }); // sort the vehicles by range (0 is closest to the player) NearbyVehicles.sort(function(a, b){return b.dist(Player.position)-a.dist(Player.position)}); if( NearbyVehicles.length > 0 ) { if( NearbyVehicles[0].locked ) { NearbyVehicles[0].locked = false; Player.notify("You ~g~unlocked the vehicle."); // MySQL_Conn.query("UPDATE vehicles SET veh_locked='0' WHERE vehicle=?", [NearbyVehicles[0].data.id]); } else { NearbyVehicles[0].locked = true; Player.notify("You ~r~locked the vehicle."); // MySQL_Conn.query("UPDATE vehicles SET veh_locked='1' WHERE vehicle=?", [NearbyVehicles[0].data.id]); } } });
    1 point
  3. Use explode() in server-side
    1 point
  4. No, did some quick test getClosestVehicle returned for me typeof(thenearestVehicle) is number and JSON.stringify(thenearestVehicle) is 7682 which i consider to be handle id. When you add some more test code from wiki for example testob.setTyreBurst(0, false, 1000); testob.setTyreBurst(1, false, 1000); testob.setTyreBurst(4, false, 1000); testob.setTyreBurst(5, false, 1000); you will see that the closest vehicle has all tires popped but did not explode, because .explode() method does not seem to be working even trying example from wiki if( commandName === "exptest") { var vehicle = mp.vehicles.new(989294410, localPlayer.position); //Spawns Voltic2 at 'player' position vehicle.explode(); } car was spawned without explosion in current 0.3.5 release. So stuff with atHandle mentioned earlier is the right way to do this edit: btw i made it explode using testob.explodeInCutscene(true);
    1 point
  5. The Chromium Embedded Framework (CEF) is a useful "embedding framework" that allows applications to make use of browser based technologies. (https://bitbucket.org/chromiumembedded/cef) CEF is comprised (especially in the example and answer to your question, provided by Kemperr) of HTML, CSS and Javascript on a frontend basis. You can store these files clientside and use them within your CEF calls (as part of index.js or required within thereof). To render them we refer to a URL that references the path of the client_packages directory (inside your server's directory). EXAMPLE: mp.browsers.new('package://menu/index.html'); // This would refer to client_packages/menu/index.html A working example would be to place that in an event handler on your clientside, like so: mp.events.add('guiReady', () => { mp.browsers.new('package://menu/index.html'); // Here we display the browser instance to the client }); CEF can handle ES5 and ES6 scripting, so there is very little limitation on what you can do in terms of front-end work. --- Alternatively, you can opt-in to using the NativeUI stuff: https://github.com/alexguirre/RAGENativeUI Which I wouldn't recommend if you are not well versed in .NET (or rather, C#)
    1 point
×
×
  • Create New...